mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-27 04:43:52 +01:00
add cmds
This commit is contained in:
@@ -72,6 +72,11 @@ static void handle_dps1(char *arg, RDSModulator* mod, char* output) {
|
||||
set_rds_dps1(mod->enc, xlat(arg));
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
static void handle_dps1mod(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[1] = 0;
|
||||
mod->enc->data[mod->enc->program].dps1_mode = strtoul((char *)arg, NULL, 10);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_pty(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[2] = 0;
|
||||
@@ -233,6 +238,16 @@ static void handle_dps1en(char *arg, RDSModulator* mod, char* output) {
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_labper(char *arg, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].dps_label_period = strtoul((char *)arg, NULL, 10);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_spsper(char *arg, RDSModulator* mod, char* output) {
|
||||
mod->enc->data[mod->enc->program].static_ps_period = strtoul((char *)arg, NULL, 10);
|
||||
strcpy(output, "+\0");
|
||||
}
|
||||
|
||||
static void handle_ptynen(char *arg, RDSModulator* mod, char* output) {
|
||||
arg[1] = 0;
|
||||
mod->enc->data[mod->enc->program].ptyn_enabled = strtoul((char *)arg, NULL, 10);
|
||||
@@ -417,11 +432,14 @@ static const command_handler_t commands_eq7[] = {
|
||||
{"GRPSEQ", handle_grpseq, 6},
|
||||
{"RDSGEN", handle_rdsgen, 6},
|
||||
{"DPS1EN", handle_dps1en, 6},
|
||||
{"LABPER", handle_labper, 6},
|
||||
{"SPSPER", handle_spsper, 6},
|
||||
};
|
||||
|
||||
static const command_handler_t commands_eq8[] = {
|
||||
{"SHORTRT", handle_shortrt, 7},
|
||||
{"PROGRAM", handle_program, 7}
|
||||
{"PROGRAM", handle_program, 7},
|
||||
{"DPS1MOD", handle_dps1mod, 7},
|
||||
};
|
||||
|
||||
static const command_handler_t commands_exact[] = {
|
||||
|
||||
13
src/rds.c
13
src/rds.c
@@ -58,6 +58,12 @@ void saveToFile(RDSEncoder *emp, const char *option) {
|
||||
tempEncoder.data[emp->program].dps1_numberofrepeats_clear = emp->data[emp->program].dps1_numberofrepeats_clear;
|
||||
} else if (strcmp(option, "DPS1EN") == 0) {
|
||||
tempEncoder.data[emp->program].dps1_enabled = emp->data[emp->program].dps1_enabled;
|
||||
} else if (strcmp(option, "DPS1MOD") == 0) {
|
||||
tempEncoder.data[emp->program].dps1_mode = emp->data[emp->program].dps1_mode;
|
||||
} else if (strcmp(option, "LABPER") == 0) {
|
||||
tempEncoder.data[emp->program].dps_label_period = emp->data[emp->program].dps_label_period
|
||||
} else if (strcmp(option, "SPSPER") == 0) {
|
||||
tempEncoder.data[emp->program].static_ps_period = emp->data[emp->program].static_ps_period
|
||||
} else if (strcmp(option, "LPS") == 0) {
|
||||
memcpy(tempEncoder.data[emp->program].lps, emp->data[emp->program].lps, LPS_LENGTH);
|
||||
} else if (strcmp(option, "SHORTRT") == 0) {
|
||||
@@ -177,8 +183,9 @@ static uint16_t get_next_af(RDSEncoder* enc) {
|
||||
|
||||
// #region Group encoding
|
||||
static void get_rds_ps_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
uint8_t dps1_on = (enc->data[enc->program].dps1_enabled && enc->data[enc->program].dps1_len != 0)
|
||||
if(enc->state[enc->program].ps_csegment == 0) {
|
||||
if(enc->state[enc->program].ps_update && !enc->data[enc->program].dps1_enabled) {
|
||||
if(enc->state[enc->program].ps_update && !dps1_on) {
|
||||
memcpy(enc->state[enc->program].ps_text, enc->data[enc->program].ps, PS_LENGTH);
|
||||
enc->state[enc->program].ps_update = 0;
|
||||
}
|
||||
@@ -188,12 +195,12 @@ static void get_rds_ps_group(RDSEncoder* enc, uint16_t *blocks) {
|
||||
enc->state[enc->program].tps_update = 0;
|
||||
}
|
||||
|
||||
if(enc->state[enc->program].dps1_update && enc->data[enc->program].dps1_enabled) {
|
||||
if(enc->state[enc->program].dps1_update && dps1_on) {
|
||||
memcpy(enc->state[enc->program].dps1_text, enc->data[enc->program].dps1, PS_LENGTH);
|
||||
enc->state[enc->program].dps1_update = 0;
|
||||
}
|
||||
|
||||
if(enc->data[enc->program].dps1_enabled) {
|
||||
if(dps1_on) {
|
||||
if(enc->state[enc->program].dynamic_ps_state == 0) {
|
||||
memcpy(enc->state[enc->program].ps_text, enc->data[enc->program].ps, PS_LENGTH);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user