0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-27 12:53:53 +01:00

try to fix

This commit is contained in:
2025-03-15 09:27:34 +01:00
parent acc15985ce
commit 57a2dda16e

View File

@@ -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);
}
}
}
}