From 3afb045fbd258cab5d03f90ced62cfbc5d709891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Frohm=C3=BCller?= Date: Thu, 23 Jul 2026 13:02:33 +0200 Subject: [PATCH] Minor code cleanup --- src/opensuperclone/asclepius.c | 5 +---- src/opensuperclone/asclepius.h | 21 ++++++++++++++------- src/opensuperclone/clone_gui.c | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/opensuperclone/asclepius.c b/src/opensuperclone/asclepius.c index d7ab82a..d6e0939 100644 --- a/src/opensuperclone/asclepius.c +++ b/src/opensuperclone/asclepius.c @@ -154,6 +154,7 @@ static int asclepius_setup_tty(void) } tcflush(asclepius_serial_port, TCIOFLUSH); + return 0; } @@ -330,10 +331,6 @@ int asclepius_get_status(void) return 0; } -// ----------------------------------------------------------------------- -// Ext UART (secondary serial port) -// ----------------------------------------------------------------------- - static int asclepius_ext_baud_to_constant(int baud) { switch (baud) diff --git a/src/opensuperclone/asclepius.h b/src/opensuperclone/asclepius.h index caac7a1..4398a45 100644 --- a/src/opensuperclone/asclepius.h +++ b/src/opensuperclone/asclepius.h @@ -13,11 +13,6 @@ #include #include -extern char asclepius_tty_device_ccc[256]; -extern char asclepius_ext_tty_device_ccc[256]; -extern int asclepius_ext_baud_rate_ccc; -extern bool asclepius_ext_connected; -extern int asclepius_ext_serial_port; #define ASCLEPIUS_BAUDRATE B115200 #define ASCLEPIUS_STATUS_IOCMD 1 @@ -30,14 +25,22 @@ extern int asclepius_ext_serial_port; #define ASCLEPIUS_MOLEX 4 #define ASCLEPIUS_ALL 5 +#define ASCLEPIUS_STATUS_PACKET_SIZE 28 + +#define ASCLEPIUS_UI_UPDATE_TIMER 500 + +extern char asclepius_tty_device_ccc[256]; +extern char asclepius_ext_tty_device_ccc[256]; +extern int asclepius_ext_baud_rate_ccc; +extern bool asclepius_ext_connected; +extern int asclepius_ext_serial_port; + struct { uint8_t command; uint8_t channel; } asclepius_command; -#define ASCLEPIUS_STATUS_PACKET_SIZE 28 - struct { bool main12v_ocp; @@ -66,9 +69,13 @@ int asclepius_disable_channel(uint8_t channel); int asclepius_get_status(void); int asclepius_ext_open(void); + void asclepius_ext_close(void); + int asclepius_ext_send(const char *data, size_t len); + int asclepius_ext_read(char *buffer, size_t max_len); + int asclepius_parse_escapes(const char *input, char *output, size_t max); // Function pointer set by GUI to capture serial output to the terminal textview diff --git a/src/opensuperclone/clone_gui.c b/src/opensuperclone/clone_gui.c index e02b4b7..dce1b52 100644 --- a/src/opensuperclone/clone_gui.c +++ b/src/opensuperclone/clone_gui.c @@ -555,7 +555,7 @@ int start_gtk_ccc(int argc, char **argv, char *title, char *version) write_config_file_with_name_ccc(filename); } - gdk_threads_add_timeout(500, display_status_update_asclepius_action, NULL); + gdk_threads_add_timeout(ASCLEPIUS_UI_UPDATE_TIMER, display_status_update_asclepius_action, NULL); asclepius_connect(); if(asclepius_get_connection_status())