diff --git a/scheduler.c b/scheduler.c index 5c87344..c42b341 100644 --- a/scheduler.c +++ b/scheduler.c @@ -228,12 +228,6 @@ short get_operation_priority(short barrel_id) { return 1; } -// task->priority = 0; -// switch (barrel_process) { -// case PROCESS_RETURN_2: -// break; -// } - return 1; // 1 - нормальный приоритет } @@ -334,20 +328,20 @@ short scheduler_find_task(struct scheduler_task* tasks, const short curr_pos) { } #ifdef EMULATOR -void debug_print_robot1_code() { +void debug_print_robot1_code(const struct robot_code* code, const short robot_id) { // printf("INFO: code length is %d\n", cmd_index); - printf("Code for R0, B%d:\n", robot1_code.barrel_id); + printf("Code for R%d, B%d:\n", robot_id, code->barrel_id); for (int i = 0; i < 16; i++) { - const short cmd_arg = (short)(robot1_code.code[i] & (short)(~ROBOT_CMD_MASK)); + const short cmd_arg = (short)(code->code[i] & (short)(~ROBOT_CMD_MASK)); - printf(" %3d 0x%04X", i, robot1_code.code[i] & 0xFFFF); + printf("%5d 0x%04X", i, code->code[i] & 0xFFFF); - if ((robot1_code.code[i] & ROBOT_CMD_MASK) == ROBOT_CMD_END_code) { + if ((code->code[i] & ROBOT_CMD_MASK) == ROBOT_CMD_END_code) { printf(" END\n"); break; } - switch ((short)(robot1_code.code[i] & (short)ROBOT_CMD_MASK)) { + switch ((short)(code->code[i] & (short)ROBOT_CMD_MASK)) { case ROBOT_CMD_MOVE_TO_ZONE_code: printf(" move to zone %d (with barrel: %d)\n", cmd_arg & (~ROBOT_WITH_BARREL), (cmd_arg & ROBOT_WITH_BARREL) != 0); break; @@ -398,7 +392,7 @@ void debug_print_robot1_code() { break; default: - printf(" UNKNOWN: 0x%04X\n", robot1_code.code[i] & 0xFFFF); + printf(" UNKNOWN: 0x%04X\n", code->code[i] & 0xFFFF); } } } @@ -592,7 +586,7 @@ void schedule_robot_1() { create_operation(target_task, tasks, &robot1_code, robot1.dx.current_zone); #ifdef EMULATOR - debug_print_robot1_code(); + debug_print_robot1_code(&robot1_code, 1); #endif } } else { @@ -659,6 +653,8 @@ char scheduler_remove_barrel_from_zone(short zone) { void scheduler_main() #endif { + _scheduler_one_robot_mode = (char)(hla_robot1_en ^ hla_robot2_en); + if (_scheduler_en) { // тут возможна только вставка барабанов if (button_load) { diff --git a/utils.h b/utils.h index 6c3ee0b..41630cd 100644 --- a/utils.h +++ b/utils.h @@ -169,11 +169,6 @@ extern struct robot_code robot2_code; #define robot2_code (*((struct robot_code*)_robot2_code_struct)) #endif -// почему-то компилер говорит что размер структуру сраный -//extern struct robot robot1; -//extern struct robot robot2; - -// появилась идея сделать пачку short-команд, то есть вставлять не полный код операции, а код 0x7000 | код операции 0x0X00 #define ROBOT_CMD_MASK (short)0xF000 #define ROBOT_CMD_END_code (short)0x0000