Подготовка к переписыванию планировщика: добавлены переменные на ПЛК, добавлена система команд для роботов

This commit is contained in:
2022-12-02 22:29:36 +03:00
parent aa8d949323
commit 8f19d1b277
8 changed files with 461 additions and 120 deletions

View File

@@ -8,13 +8,8 @@
#include "emulator.h"
#include "robot.h"
struct barrel barrels[BARRELS_COUNT];
struct robot_cmd robot1_cmd;
struct robot_cmd robot2_cmd;
struct robot robot1;
struct robot robot2;
struct robot_regs robot1;
struct robot_regs robot2;
char schedulerSoftwareTimer = 0;
char schedulerUnloadButton = 0;
@@ -27,6 +22,13 @@ static const int COLS = 23 * 5 + 1;
static char buffer[ROWS][COLS];
static int current_tic = 0;
robot_code robot1_code{0, -1};
robot_code robot2_code{0, -1};
short robot1_lock_zone = 0;
short robot2_lock_zone = 0;
static int sock_fd;
static void send_str(const char* str) {
write(sock_fd, str, strlen(str));
@@ -135,7 +137,9 @@ static void showAll() {
// рисуем роботов
sprintf(tmp, "R1");
// image_insert_sprite(2 + (robot1.mz.is_up ? 0 : 2), (robot1.curr_zone * 5) + 2, tmp);
image_insert_sprite(2 + (robot1.mz.is_up ? 0 : 2), (robot1.curr_zone * 5) + 2, tmp);
image_insert_sprite(2 + (robot1.mz.is_up ? 0 : 2),
(robot1.dx.current_zone * 5) + 2 + (robot1_offset_pos * 2),
tmp);
// sprintf(tmp, "R2");
// image_insert_sprite(3 + (robot2.mz.is_up ? 0 : 2), (robot2.curr_zone * 5) + 2, tmp);
@@ -176,7 +180,7 @@ int main() {
open_socket();
// for (auto & b : barrels) {
// b.flags.is_exist = 1;
// b.barrel_flags.is_exist = 1;
// b.software_timer = (short)(random() % 50);
// b.zone = (short) abs(random() % 20);
// }