ref: e8dcfa27755a9c4322f0b6940896fa59e7e1722a
parent: 8d03da9b86beac6175cf139b4270c5b711f49e90
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Sun Apr 18 17:38:41 EDT 2021
remove leftovers of old command queuing system
--- a/command.c
+++ b/command.c
@@ -31,8 +31,7 @@
fprintf(stderr, "\n");
}
-void process_command(uint8_t *data, uint32_t size,
- struct command_queues *command_queues) {+void process_command(uint8_t *data, uint32_t size) {uint8_t recv_buf[size + 1];
--- a/command.h
+++ b/command.h
@@ -48,6 +48,6 @@
};
-void process_command(uint8_t *data, uint32_t size, struct command_queues *command_queues);
+void process_command(uint8_t *data, uint32_t size);
#endif
\ No newline at end of file
--- a/main.c
+++ b/main.c
@@ -27,10 +27,6 @@
// allocate memory for serial buffer
uint8_t serial_buf[serial_read_size];
- // allocate memory for draw command queues
- struct command_queues *queues;
- queues = (struct command_queues *)malloc(sizeof(struct command_queues));
-
static uint8_t slip_buffer[1024]; // SLIP command buffer
// settings for the slip packet handler
@@ -81,7 +77,7 @@
for (int i = 0; i < bytes_read; i++) {uint8_t rx = serial_buf[i];
// process the incoming bytes into commands and draw them
- int n = slip_read_byte(&slip, rx, queues);
+ int n = slip_read_byte(&slip, rx);
if (n != SLIP_NO_ERROR) {fprintf(stderr, "SLIP error %d\n", n);
}
@@ -114,7 +110,6 @@
close_renderer();
disconnect(port);
close(port);
- free(queues);
return 0;
}
\ No newline at end of file
--- a/render.c
+++ b/render.c
@@ -24,8 +24,8 @@
ticks = SDL_GetTicks();
- const int windowWidth = 640; // SDL window width
- const int windowHeight = 480; // SDL window height
+ const int window_width = 640; // SDL window width
+ const int window_height = 480; // SDL window height
// retutns zero on success else non-zero
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {@@ -39,7 +39,7 @@
}
win = SDL_CreateWindow("m8c", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,- windowWidth, windowHeight,
+ window_width, window_height,
SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL |
SDL_WINDOW_RESIZABLE);
--- a/slip.c
+++ b/slip.c
@@ -44,8 +44,7 @@
return error;
}
-slip_error_t slip_read_byte(slip_handler_s *slip, uint8_t byte,
- struct command_queues *command_queues) {+slip_error_t slip_read_byte(slip_handler_s *slip, uint8_t byte) {slip_error_t error = SLIP_NO_ERROR;
assert(slip != NULL);
@@ -54,8 +53,7 @@
case SLIP_STATE_NORMAL:
switch (byte) {case SLIP_SPECIAL_BYTE_END:
- slip->descriptor->recv_message(slip->descriptor->buf, slip->size,
- command_queues);
+ slip->descriptor->recv_message(slip->descriptor->buf, slip->size);
reset_rx(slip);
break;
case SLIP_SPECIAL_BYTE_ESC:
--- a/slip.h
+++ b/slip.h
@@ -19,7 +19,7 @@
uint8_t *buf;
uint32_t buf_size;
//struct command_queues *command_queues;
- void (*recv_message)(uint8_t *data, uint32_t size, struct command_queues *command_queues);
+ void (*recv_message)(uint8_t *data, uint32_t size);
} slip_descriptor_s;
typedef struct {@@ -36,6 +36,6 @@
} slip_error_t;
slip_error_t slip_init(slip_handler_s *slip, const slip_descriptor_s *descriptor);
-slip_error_t slip_read_byte(slip_handler_s *slip, uint8_t byte, struct command_queues *command_queues);
+slip_error_t slip_read_byte(slip_handler_s *slip, uint8_t byte);
#endif
\ No newline at end of file
--
⑨