From 57a2dda16e82cfa10689b4ba4b437713898bd2d6 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Sat, 15 Mar 2025 09:27:34 +0100 Subject: [PATCH] try to fix --- src/ascii_cmd.c | 49 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index d5d5ca0..b126874 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -366,10 +366,20 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { unsigned char *cmd, *arg; uint16_t cmd_len = _strnlen((const char*)str, CTL_BUFFER_SIZE); uint8_t to_save = 0, cmd_reached = 0; + unsigned char *original_str = str; // Store the original string pointer if (str[0] == '*') { to_save = 1; - str++; + str++; // Skip the asterisk for command processing + } + + // Special case for save commands without '=' (like *ALL) + if (to_save && !strchr((const char*)str, '=')) { + // Save without further processing + char option[32] = {0}; + snprintf(option, sizeof(option), "%s", (const char*)str); + saveToFile(enc->enc, option); + return; } if (cmd_len > 1 && str[1] == '=') { @@ -381,6 +391,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq2, sizeof(commands_eq2) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -394,6 +407,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq3, sizeof(commands_eq3) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -407,6 +423,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq4, sizeof(commands_eq4) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -420,6 +439,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq5, sizeof(commands_eq5) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -433,6 +455,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq6, sizeof(commands_eq6) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -445,6 +470,9 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { if (process_command_table(commands_eq7, sizeof(commands_eq7) / sizeof(command_handler_t), cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } @@ -455,20 +483,11 @@ void process_ascii_cmd(RDSModulator* enc, unsigned char *str) { cmd_reached = 1; if (process_command_table(commands_eq8, - sizeof(commands_eq8) / sizeof(command_handler_t), - cmd, arg, enc)) { - } - } - - if (to_save) { - if (strncmp((const char*)&str, "ALL", 3) == 0) { - saveToFile(enc->enc, "ALL"); - return; - } else { - char option[32] = {0}; - snprintf(option, sizeof(option), "%s", (const char*)&str); - saveToFile(enc->enc, option); - return; + sizeof(commands_eq8) / sizeof(command_handler_t), + cmd, arg, enc)) { + if (to_save) { + saveToFile(enc->enc, (const char*)cmd); + } } } } \ No newline at end of file