Слияние кода из проекта для ПЛК с этим проектом
This commit is contained in:
16
scheduler.c
16
scheduler.c
@@ -15,7 +15,7 @@ char zone_is_busy(short zone) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static short get_robot_barrel(char robot_id) {
|
||||
short get_robot_barrel(char robot_id) {
|
||||
for (short i = 0; i < BARRELS_COUNT; i++) {
|
||||
if (barrels[i].flags.robot == robot_id) {
|
||||
return i;
|
||||
@@ -43,7 +43,7 @@ short can_move(struct barrel* bar) {
|
||||
}
|
||||
|
||||
#ifdef EMULATOR
|
||||
if (!schedulerOneRobotMode) {
|
||||
if (!_scheduler_one_robot_mode) {
|
||||
printf("WARMING: нет проверки того, что для перемещения барабана не мешает второй робот\n");
|
||||
}
|
||||
#endif
|
||||
@@ -163,7 +163,7 @@ short can_move(struct barrel* bar) {
|
||||
|
||||
case ZONE_UNLOAD:
|
||||
// последняя промывка, нужно разрешение на выгрузку
|
||||
if (schedulerOneRobotMode && button_unload) {
|
||||
if (_scheduler_one_robot_mode && button_unload) {
|
||||
// нужно промывку загрузку 0
|
||||
if (!zone_is_busy(ZONE_LOAD_1)) {
|
||||
return ZONE_LOAD_1;
|
||||
@@ -271,7 +271,7 @@ struct barrel makeBarrel(short flags, short zone, short timer) {
|
||||
}
|
||||
|
||||
|
||||
static short scheduler_find_task(struct scheduler_task* tasks, const short curr_pos) {
|
||||
short scheduler_find_task(struct scheduler_task* tasks, const short curr_pos) {
|
||||
// TODO добавить поддержку ночного режима и режима двух роботов
|
||||
// для начала надо найти максимальный приоритет у операций
|
||||
short max_priority = -1;
|
||||
@@ -601,7 +601,7 @@ void schedule_robot_1() {
|
||||
// TODO добавить вставку lock-point'ов на задачах на несколько роботов
|
||||
|
||||
// найти подходящую задачу
|
||||
if (schedulerOneRobotMode) {
|
||||
if (_scheduler_one_robot_mode) {
|
||||
short target_task = scheduler_find_task(tasks, robot1.dx.current_zone);
|
||||
|
||||
if (target_task >= 0) {
|
||||
@@ -612,7 +612,9 @@ void schedule_robot_1() {
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
#ifdef EMULATOR
|
||||
printf("WARMING: support only one robot mode\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -682,8 +684,8 @@ void scheduler_main() {
|
||||
button_load = create_barrel_in_load();
|
||||
}
|
||||
|
||||
if (schedulerSoftwareTimer) {
|
||||
schedulerSoftwareTimer = 0;
|
||||
if (_scheduler_software_timer) {
|
||||
_scheduler_software_timer = 0;
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (barrels[i].software_timer > -9999) {
|
||||
barrels[i].software_timer--;
|
||||
|
||||
Reference in New Issue
Block a user