Исправление коррекции
This commit is contained in:
parent
dbc7143f01
commit
c4ed3b76f1
64
scheduler.c
64
scheduler.c
@ -114,28 +114,10 @@ void scheduler_main()
|
|||||||
scheduler_start_signal = 0;
|
scheduler_start_signal = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scheduler_en) {
|
|
||||||
|
|
||||||
// программный таймер, применяется ко всем существующим барабанам
|
|
||||||
if (_scheduler_software_timer) {
|
|
||||||
_scheduler_software_timer = 0;
|
|
||||||
for (int i = 0; i < 10; i++) {
|
|
||||||
if (barrels[i].flags.is_exist && barrels[i].software_timer > -9999) {
|
|
||||||
barrels[i].software_timer--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// автоматический инкремент зон травления и цинкования
|
|
||||||
if (etching_zone < 0) {
|
|
||||||
increment_zone(ROBOT_ZONE_ETCH);
|
|
||||||
}
|
|
||||||
if (galvanizing_zone < 0) {
|
|
||||||
increment_zone(ROBOT_ZONE_GAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hla_correct_command) {
|
if (hla_correct_command) {
|
||||||
if (one_robot_mode) {
|
if (one_robot_mode) {
|
||||||
|
switch (scheduler_correction_stage) {
|
||||||
|
case 0:
|
||||||
if (hla_robot2_en) {
|
if (hla_robot2_en) {
|
||||||
if (robot2_code.PC < 0) {
|
if (robot2_code.PC < 0) {
|
||||||
robot2_code.barrel_id = -1;
|
robot2_code.barrel_id = -1;
|
||||||
@ -144,19 +126,30 @@ void scheduler_main()
|
|||||||
robot2_code.code[2] = ROBOT_CMD_END();
|
robot2_code.code[2] = ROBOT_CMD_END();
|
||||||
robot2_code.PC = 0;
|
robot2_code.PC = 0;
|
||||||
|
|
||||||
hla_correct_command = 0;
|
scheduler_correction_stage++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (robot1_code.PC < 0) {
|
if (robot1_code.PC < 0) {
|
||||||
robot1_code.barrel_id = -1;
|
robot1_code.barrel_id = -1;
|
||||||
robot1_code.code[0] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_Z);
|
robot1_code.code[0] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_Z);
|
||||||
robot1_code.code[1] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_X);
|
robot1_code.code[1] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_X);
|
||||||
robot1_code.code[2] = ROBOT_CMD_END();
|
robot1_code.code[2] = ROBOT_CMD_MOVE_TO_PARKING();
|
||||||
|
robot1_code.code[3] = ROBOT_CMD_END();
|
||||||
robot1_code.PC = 0;
|
robot1_code.PC = 0;
|
||||||
|
|
||||||
hla_correct_command = 0;
|
scheduler_correction_stage++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case 1:
|
||||||
|
if (robot2_code.PC < 0 && robot1_code.PC < 0) {
|
||||||
|
scheduler_correction_stage++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
scheduler_correction_stage = 0;
|
||||||
|
hla_correct_command = 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (scheduler_correction_stage) {
|
switch (scheduler_correction_stage) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -184,7 +177,8 @@ void scheduler_main()
|
|||||||
robot1_code.barrel_id = -1;
|
robot1_code.barrel_id = -1;
|
||||||
robot1_code.code[0] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_Z);
|
robot1_code.code[0] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_Z);
|
||||||
robot1_code.code[1] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_X);
|
robot1_code.code[1] = ROBOT_CMD_CORRECT_AXIS(ROBOT_AXIS_X);
|
||||||
robot1_code.code[2] = ROBOT_CMD_END();
|
robot1_code.code[2] = ROBOT_CMD_MOVE_TO_PARKING();
|
||||||
|
robot1_code.code[3] = ROBOT_CMD_END();
|
||||||
robot1_code.PC = 0;
|
robot1_code.PC = 0;
|
||||||
|
|
||||||
scheduler_correction_stage++;
|
scheduler_correction_stage++;
|
||||||
@ -202,7 +196,27 @@ void scheduler_main()
|
|||||||
hla_correct_command = 0;
|
hla_correct_command = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!auto_mode_pause) {
|
} else if (scheduler_en) {
|
||||||
|
|
||||||
|
// программный таймер, применяется ко всем существующим барабанам
|
||||||
|
if (_scheduler_software_timer) {
|
||||||
|
_scheduler_software_timer = 0;
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
if (barrels[i].flags.is_exist && barrels[i].software_timer > -9999) {
|
||||||
|
barrels[i].software_timer--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// автоматический инкремент зон травления и цинкования
|
||||||
|
if (etching_zone < 0) {
|
||||||
|
increment_zone(ROBOT_ZONE_ETCH);
|
||||||
|
}
|
||||||
|
if (galvanizing_zone < 0) {
|
||||||
|
increment_zone(ROBOT_ZONE_GAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!auto_mode_pause) {
|
||||||
if ((hla_robot1_en && robot1_code.PC < 0) || (hla_robot2_en && robot2_code.PC < 0)) {
|
if ((hla_robot1_en && robot1_code.PC < 0) || (hla_robot2_en && robot2_code.PC < 0)) {
|
||||||
struct scheduler_task tasks[BARRELS_COUNT];
|
struct scheduler_task tasks[BARRELS_COUNT];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user