Исправления последовательности техпроцесса, исправления создания команд

This commit is contained in:
VladislavOstapov 2023-01-29 20:27:53 +03:00
parent 353aad9bec
commit 848e3cfdcb

23
utils.c
View File

@ -203,7 +203,7 @@ short can_move(struct barrel *bar, char robot_id) {
if (robot_id == 1) { if (robot_id == 1) {
approximate_time = bar->zone - robot1.dx.current_zone; approximate_time = bar->zone - robot1.dx.current_zone;
} else { } else {
approximate_time = bar->zone - robot1.dx.current_zone; approximate_time = bar->zone - robot2.dx.current_zone;
} }
// abs(approximate_time) // abs(approximate_time)
@ -239,8 +239,8 @@ short can_move(struct barrel *bar, char robot_id) {
if (border < robot2_lock_zone) { if (border < robot2_lock_zone) {
border = robot2_lock_zone; border = robot2_lock_zone;
} }
if (border < ZONE_WASHING_2A) { if (border < ZONE_ETCHING_2) {
border = ZONE_WASHING_2A; border = ZONE_ETCHING_2;
} }
border += LOCK_ZONE_BORDER; border += LOCK_ZONE_BORDER;
@ -493,6 +493,10 @@ void create_operation(struct robot_code *code, short barrel_id, const short star
if (hla_night_mode && barrels[barrel_id].flags.is_empty && dest_zone == get_first_night_zone()) { if (hla_night_mode && barrels[barrel_id].flags.is_empty && dest_zone == get_first_night_zone()) {
barrels[barrel_id].flags.is_night = -1; barrels[barrel_id].flags.is_night = -1;
} }
if (start_zone == 22) {
button_unload = 0;
}
} }
short cmd_index = 0; short cmd_index = 0;
@ -631,12 +635,16 @@ void create_operation(struct robot_code *code, short barrel_id, const short star
code->code[cmd_index++] = ROBOT_CMD_MOVE_TO_ZONE_WITH_BARREL(dest_zone); code->code[cmd_index++] = ROBOT_CMD_MOVE_TO_ZONE_WITH_BARREL(dest_zone);
if (barrel_id >= 0) {
if (!barrels[barrel_id].flags.is_empty) {
// инкремент зоны (если травление или цинкование) // инкремент зоны (если травление или цинкование)
if (dest_zone == ZONE_ETCHING_1 || dest_zone == ZONE_ETCHING_2) { if (dest_zone == ZONE_ETCHING_1 || dest_zone == ZONE_ETCHING_2) {
code->code[cmd_index++] = ROBOT_CMD_INC_ZONE(ROBOT_ZONE_ETCH); code->code[cmd_index++] = ROBOT_CMD_INC_ZONE(ROBOT_ZONE_ETCH);
} else if (dest_zone >= ZONE_GALVANIZING_1 && dest_zone <= ZONE_GALVANIZING_8) { } else if (dest_zone >= ZONE_GALVANIZING_1 && dest_zone <= ZONE_GALVANIZING_8) {
code->code[cmd_index++] = ROBOT_CMD_INC_ZONE(ROBOT_ZONE_GAL); code->code[cmd_index++] = ROBOT_CMD_INC_ZONE(ROBOT_ZONE_GAL);
} }
}
}
code->code[cmd_index++] = ROBOT_CMD_DOWN_WITH_BARREL(); code->code[cmd_index++] = ROBOT_CMD_DOWN_WITH_BARREL();
@ -646,11 +654,12 @@ void create_operation(struct robot_code *code, short barrel_id, const short star
code->code[cmd_index++] = ROBOT_CMD_UP(); code->code[cmd_index++] = ROBOT_CMD_UP();
code->code[cmd_index++] = ROBOT_CMD_DOWN(); code->code[cmd_index++] = ROBOT_CMD_DOWN();
} else { } else {
if (dest_zone != 0) { if (dest_zone != 0) {
// установка времени ожидания барабана // установка времени ожидания барабана
short tmp = -1; short tmp = -1;
if (barrel_id >= 0) {
if (!barrels[barrel_id].flags.is_empty) {
switch (dest_zone) { switch (dest_zone) {
case ZONE_DEGREASING: case ZONE_DEGREASING:
tmp = barrels[barrel_id].time_degreasing; tmp = barrels[barrel_id].time_degreasing;
@ -698,8 +707,12 @@ void create_operation(struct robot_code *code, short barrel_id, const short star
tmp = barrels[barrel_id].time_washing_4b; tmp = barrels[barrel_id].time_washing_4b;
break; break;
} }
} else {
tmp = 0;
}
}
if (tmp > 0) { if (tmp >= 0) {
if (tmp > 8000) { if (tmp > 8000) {
tmp = 8000; tmp = 8000;
} }