Исправления и централизация работы кнопок на линии
This commit is contained in:
parent
848e3cfdcb
commit
819436e34d
53
emulator.cpp
53
emulator.cpp
@ -345,6 +345,59 @@ int main() {
|
||||
button_load = 1;
|
||||
}
|
||||
|
||||
// ======= БЛОК КОДА bittons_logic =======
|
||||
|
||||
// авто сброс кнопок на выгрузке, если там нет барабана
|
||||
if (!zone_is_busy(ZONE_UNLOAD)) {
|
||||
button_unload = 0;
|
||||
button_unload_remove = 0;
|
||||
}
|
||||
|
||||
// кнопка загрузки барабана
|
||||
if (button_load) {
|
||||
if (!hla_night_mode) {
|
||||
if (!zone_is_busy(1)) {
|
||||
for (int i = 0; i < BARRELS_COUNT; i++) {
|
||||
if (!barrels[i].flags.is_exist) {
|
||||
barrels[i].flags.raw_word = 1; // только is_exist
|
||||
barrels[i].zone = 1;
|
||||
barrels[i].software_timer = -1;
|
||||
barrels[i].time_degreasing = hla_time_degreasing;
|
||||
barrels[i].time_washing_1a = hla_time_washing_1a;
|
||||
barrels[i].time_washing_1b = hla_time_washing_1b;
|
||||
barrels[i].time_etching = hla_time_etching;
|
||||
barrels[i].time_washing_2a = hla_time_washing_2a;
|
||||
barrels[i].time_washing_2b = hla_time_washing_2b;
|
||||
barrels[i].time_galvanizing = hla_time_galvanizing;
|
||||
barrels[i].time_washing_3a = hla_time_washing_3a;
|
||||
barrels[i].time_washing_3b = hla_time_washing_3b;
|
||||
barrels[i].time_passivation = hla_time_passivation;
|
||||
barrels[i].time_washing_4a = hla_time_washing_4a;
|
||||
barrels[i].time_washing_4b = hla_time_washing_4b;
|
||||
button_load = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
button_load = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// кнопка выгрузки
|
||||
if (button_unload_end) {
|
||||
button_unload_end = 0;
|
||||
remove_barrel_from_zone(0);
|
||||
}
|
||||
|
||||
// кнопка удаления барабана из 22 зоны
|
||||
if (button_unload_remove) {
|
||||
button_unload_remove = 0;
|
||||
remove_barrel_from_zone(22);
|
||||
}
|
||||
|
||||
// ================ КОНЕЦ ================
|
||||
|
||||
robot_main();
|
||||
scheduler_main();
|
||||
// increment_zone(ROBOT_ZONE_GAL);
|
||||
|
45
scheduler.c
45
scheduler.c
@ -134,51 +134,6 @@ void scheduler_main()
|
||||
increment_zone(ROBOT_ZONE_GAL);
|
||||
}
|
||||
|
||||
// кнопки на линии
|
||||
|
||||
// кнопка загрузки барабана
|
||||
if (button_load) {
|
||||
if (!hla_night_mode) {
|
||||
if (!zone_is_busy(1)) {
|
||||
for (int i = 0; i < BARRELS_COUNT; i++) {
|
||||
if (!barrels[i].flags.is_exist) {
|
||||
barrels[i].flags.raw_word = 1; // только is_exist
|
||||
barrels[i].zone = 1;
|
||||
barrels[i].software_timer = -1;
|
||||
barrels[i].time_degreasing = hla_time_degreasing;
|
||||
barrels[i].time_washing_1a = hla_time_washing_1a;
|
||||
barrels[i].time_washing_1b = hla_time_washing_1b;
|
||||
barrels[i].time_etching = hla_time_etching;
|
||||
barrels[i].time_washing_2a = hla_time_washing_2a;
|
||||
barrels[i].time_washing_2b = hla_time_washing_2b;
|
||||
barrels[i].time_galvanizing = hla_time_galvanizing;
|
||||
barrels[i].time_washing_3a = hla_time_washing_3a;
|
||||
barrels[i].time_washing_3b = hla_time_washing_3b;
|
||||
barrels[i].time_passivation = hla_time_passivation;
|
||||
barrels[i].time_washing_4a = hla_time_washing_4a;
|
||||
barrels[i].time_washing_4b = hla_time_washing_4b;
|
||||
button_load = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
button_load = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// кнопка выгрузки
|
||||
if (button_unload_end) {
|
||||
button_unload_end = 0;
|
||||
remove_barrel_from_zone(0);
|
||||
}
|
||||
|
||||
// кнопка удаления барабана из 22 зоны
|
||||
if (button_unload_remove) {
|
||||
button_unload_remove = 0;
|
||||
remove_barrel_from_zone(22);
|
||||
}
|
||||
|
||||
if (hla_correct_command) {
|
||||
if (one_robot_mode) {
|
||||
if (hla_robot2_en) {
|
||||
|
4
utils.c
4
utils.c
@ -493,10 +493,6 @@ 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()) {
|
||||
barrels[barrel_id].flags.is_night = -1;
|
||||
}
|
||||
|
||||
if (start_zone == 22) {
|
||||
button_unload = 0;
|
||||
}
|
||||
}
|
||||
|
||||
short cmd_index = 0;
|
||||
|
Reference in New Issue
Block a user