From 65ae32480365539cdb6877cfd6e25d4aba014638 Mon Sep 17 00:00:00 2001 From: VladislavOstapov Date: Tue, 6 Dec 2022 14:54:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F=20=D0=BE=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B0=D1=86=D0=B8=D0=B9=20=D1=81=20=D0=BF=D0=B0?= =?UTF-8?q?=D0=BD=D0=B5=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- emulator.cpp | 19 +++++++++++++++++++ emulator.h | 20 ++++++++++++++++++++ scheduler.c | 32 ++++++++++++++++---------------- 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/emulator.cpp b/emulator.cpp index e9b745d..b07a44d 100644 --- a/emulator.cpp +++ b/emulator.cpp @@ -22,6 +22,25 @@ char button_unload = 0; char button_unload_end = 0; char button_unload_remove = 0; +// времена операций для барабанов, устанавливается индивидуально каждому барабану +short hla_time_degreasing = 12; +short hla_time_washing_1a = 4; +short hla_time_washing_1b = 6; +short hla_time_etching = 25; +short hla_time_washing_2a = 6; +short hla_time_washing_2b = 8; +short hla_time_galvanizing = 60; +short hla_time_washing_3a = 8; +short hla_time_washing_3b = 10; +short hla_time_passivation = 3; +short hla_time_washing_4a = 12; +short hla_time_washing_4b = 14; + +// времена скапывания, одинаковые для всех барабанов +short hla_time_digging = 8; +short hla_time_reagent = 30; +short hla_time_washing_1 = 3; +short hla_time_washing_2 = 20; static const int ROWS = 10; static const int COLS = 23 * 5 + 1; diff --git a/emulator.h b/emulator.h index 62a136c..57dbfd5 100644 --- a/emulator.h +++ b/emulator.h @@ -44,6 +44,26 @@ extern char button_unload_remove; // Переменные, которые надо добавить в C Global variables +// времена для барабанов, нужно копировать их только при создании барабанов +extern short hla_time_degreasing; +extern short hla_time_washing_1a; +extern short hla_time_washing_1b; +extern short hla_time_etching; +extern short hla_time_washing_2a; +extern short hla_time_washing_2b; +extern short hla_time_galvanizing; +extern short hla_time_washing_3a; +extern short hla_time_washing_3b; +extern short hla_time_passivation; +extern short hla_time_washing_4a; +extern short hla_time_washing_4b; + +// времена скапывания, одинаковые для всех барабанов +extern short hla_time_digging; +extern short hla_time_reagent; +extern short hla_time_washing_1; +extern short hla_time_washing_2; + // lock-зоны, нельзя двигаться за них и за робота extern short robot1_lock_zone; diff --git a/scheduler.c b/scheduler.c index 6b2379b..1b30aa6 100644 --- a/scheduler.c +++ b/scheduler.c @@ -243,18 +243,18 @@ struct barrel makeBarrel(short flags, short zone, short timer) { b.flags.raw_word = flags; b.zone = zone; b.software_timer = timer; - b.time_degreasing = 12; - b.time_washing_1a = 4; - b.time_washing_1b = 6; - b.time_etching = 25; - b.time_washing_2a = 6; - b.time_washing_2b = 8; - b.time_galvanizing = 60; - b.time_washing_3a = 8; - b.time_washing_3b = 10; - b.time_passivation = 3; - b.time_washing_4a = 12; - b.time_washing_4b = 14; + b.time_degreasing = hla_time_degreasing; + b.time_washing_1a = hla_time_washing_1a; + b.time_washing_1b = hla_time_washing_1b; + b.time_etching = hla_time_etching; + b.time_washing_2a = hla_time_washing_2a; + b.time_washing_2b = hla_time_washing_2b; + b.time_galvanizing = hla_time_galvanizing; + b.time_washing_3a = hla_time_washing_3a; + b.time_washing_3b = hla_time_washing_3b; + b.time_passivation = hla_time_passivation; + b.time_washing_4a = hla_time_washing_4a; + b.time_washing_4b = hla_time_washing_4b; return b; } @@ -426,6 +426,7 @@ void create_operation(const short target_task, const struct scheduler_task* task code->code[cmd_index++] = ROBOT_CMD_TMR_SET(barrels[target_task].time_passivation); code->code[cmd_index++] = ROBOT_CMD_UP_WITH_BARREL(); + code->code[cmd_index++] = ROBOT_CMD_WAIT(hla_time_digging); code->code[cmd_index++] = ROBOT_CMD_MOVE_TO_ZONE_WITH_BARREL(ZONE_WASHING_4A); code->code[cmd_index++] = ROBOT_CMD_DOWN_WITH_BARREL(); @@ -461,8 +462,7 @@ void create_operation(const short target_task, const struct scheduler_task* task case ZONE_GALVANIZING_7: case ZONE_GALVANIZING_8: // время скапывания реактивов - // TODO добавить переменные времен скапывания - code->code[cmd_index++] = ROBOT_CMD_WAIT(30); + code->code[cmd_index++] = ROBOT_CMD_WAIT(hla_time_reagent); break; case ZONE_WASHING_1A: @@ -470,7 +470,7 @@ void create_operation(const short target_task, const struct scheduler_task* task case ZONE_WASHING_3A: case ZONE_WASHING_4A: // время скапывания 1-го каскада промывок - code->code[cmd_index++] = ROBOT_CMD_WAIT(3); + code->code[cmd_index++] = ROBOT_CMD_WAIT(hla_time_washing_1); break; case ZONE_WASHING_1B: @@ -478,7 +478,7 @@ void create_operation(const short target_task, const struct scheduler_task* task case ZONE_WASHING_3B: case ZONE_WASHING_4B: // время скапывания 2-го каскада промывок - code->code[cmd_index++] = ROBOT_CMD_WAIT(20); + code->code[cmd_index++] = ROBOT_CMD_WAIT(hla_time_washing_2); break; }