0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00
This commit is contained in:
2025-03-22 17:52:00 +01:00
parent 2b4dedba73
commit 739c320895
4 changed files with 54 additions and 16 deletions

View File

@@ -74,6 +74,12 @@ static void handle_rt1(char *arg, RDSModulator* mod, char* output) {
strcpy(output, "+\0"); strcpy(output, "+\0");
} }
static void handle_rt2(char *arg, RDSModulator* mod, char* output) {
arg[RT_LENGTH * 2] = 0;
set_rds_rt2(mod->enc, xlat(arg));
strcpy(output, "+\0");
}
static void handle_dps1(char *arg, RDSModulator* mod, char* output) { static void handle_dps1(char *arg, RDSModulator* mod, char* output) {
arg[DPS_LENGTH * 2] = 0; arg[DPS_LENGTH * 2] = 0;
set_rds_dps1(mod->enc, xlat(arg)); set_rds_dps1(mod->enc, xlat(arg));
@@ -239,6 +245,17 @@ static void handle_rt1en(char *arg, RDSModulator* mod, char* output) {
strcpy(output, "+\0"); strcpy(output, "+\0");
} }
static void handle_rt2en(char *arg, RDSModulator* mod, char* output) {
mod->enc->data[mod->enc->program].rt2_enabled = atoi(arg);
strcpy(output, "+\0");
}
static void handle_rtper(char *arg, RDSModulator* mod, char* output) {
mod->enc->data[mod->enc->program].rt_switching_period = atoi(arg);
mod->enc->data[mod->enc->program].orignal_rt_switching_period = atoi(arg);
strcpy(output, "+\0");
}
static void handle_dps1en(char *arg, RDSModulator* mod, char* output) { static void handle_dps1en(char *arg, RDSModulator* mod, char* output) {
mod->enc->data[mod->enc->program].dps1_enabled = atoi(arg); mod->enc->data[mod->enc->program].dps1_enabled = atoi(arg);
mod->enc->state[mod->enc->program].ps_update = 1; mod->enc->state[mod->enc->program].ps_update = 1;
@@ -389,6 +406,11 @@ static void handle_udg2(char *arg, RDSModulator* mod, char* output) {
else strcpy(output, "/\0"); else strcpy(output, "/\0");
} }
static void handle_rttype(char *arg, RDSModulator* mod, char* output) {
mod->enc->data[mod->enc->program].rt_type = atoi(arg);
strcpy(output, "+\0");
}
static void handle_init(char *arg, RDSModulator* mod, char* output) { static void handle_init(char *arg, RDSModulator* mod, char* output) {
(void)arg; (void)arg;
set_rds_defaults(mod->enc, mod->enc->program); set_rds_defaults(mod->enc, mod->enc->program);
@@ -556,6 +578,7 @@ static const command_handler_t commands_eq3[] = {
static const command_handler_t commands_eq4[] = { static const command_handler_t commands_eq4[] = {
{"TPS", handle_tps, 3}, {"TPS", handle_tps, 3},
{"RT1", handle_rt1, 3}, {"RT1", handle_rt1, 3},
{"RT2", handle_rt2, 3},
{"PTY", handle_pty, 3}, {"PTY", handle_pty, 3},
{"ECC", handle_ecc, 3}, {"ECC", handle_ecc, 3},
{"LIC", handle_lic, 3}, {"LIC", handle_lic, 3},
@@ -581,6 +604,8 @@ static const command_handler_t commands_eq2[] = {
static const command_handler_t commands_eq6[] = { static const command_handler_t commands_eq6[] = {
{"PINEN", handle_pinen, 5}, {"PINEN", handle_pinen, 5},
{"RT1EN", handle_rt1en, 5}, {"RT1EN", handle_rt1en, 5},
{"RT2EN", handle_rt2en, 5},
{"RTPER", handle_rtper, 5},
{"ECCEN", handle_eccen, 5}, {"ECCEN", handle_eccen, 5},
{"LEVEL", handle_level, 5}, {"LEVEL", handle_level, 5},
{"RESET", handle_reset, 5}, {"RESET", handle_reset, 5},
@@ -594,6 +619,7 @@ static const command_handler_t commands_eq7[] = {
{"DPS1EN", handle_dps1en, 6}, {"DPS1EN", handle_dps1en, 6},
{"LABPER", handle_labper, 6}, {"LABPER", handle_labper, 6},
{"SPSPER", handle_spsper, 6}, {"SPSPER", handle_spsper, 6},
{"RTTYPE", handle_rttype, 6},
}; };
static const command_handler_t commands_eq8[] = { static const command_handler_t commands_eq8[] = {

View File

@@ -308,11 +308,19 @@ encode:
} }
static void get_rds_rt_group(RDSEncoder* enc, uint16_t *blocks) { static void get_rds_rt_group(RDSEncoder* enc, uint16_t *blocks) {
if (enc->state[enc->program].rt_update) { if (enc->state[enc->program].rt_update && enc->data[enc->program].rt1_enabled) {
memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt1, RT_LENGTH); memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt1, RT_LENGTH);
enc->state[enc->program].rt_ab ^= 1; enc->state[enc->program].rt_ab ^= 1;
enc->state[enc->program].rt_update = 0; enc->state[enc->program].rt_update = 0;
enc->state[enc->program].rt_state = 0; enc->state[enc->program].rt_state = 0;
enc->state[enc->program].current_rt = 0;
}
if(enc->state[enc->program].rt2_update && enc->data[enc->program].rt2_enabled && !enc->data[enc->program].rt1_enabled) {
memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt2, RT_LENGTH);
enc->state[enc->program].rt_ab ^= 1;
enc->state[enc->program].rt2_update = 0;
enc->state[enc->program].rt_state = 0;
enc->state[enc->program].current_rt = 1;
} }
uint8_t ab = enc->state[enc->program].rt_ab; uint8_t ab = enc->state[enc->program].rt_ab;
@@ -831,6 +839,8 @@ void set_rds_rt1(RDSEncoder* enc, char *rt1) {
void set_rds_rt2(RDSEncoder* enc, char *rt2) { void set_rds_rt2(RDSEncoder* enc, char *rt2) {
uint8_t i = 0, len = 0; uint8_t i = 0, len = 0;
enc->state[enc->program].rt2_update = 1;
memset(enc->data[enc->program].rt2, ' ', RT_LENGTH); memset(enc->data[enc->program].rt2, ' ', RT_LENGTH);
while (*rt2 != 0 && len < RT_LENGTH) enc->data[enc->program].rt2[len++] = *rt2++; while (*rt2 != 0 && len < RT_LENGTH) enc->data[enc->program].rt2[len++] = *rt2++;

View File

@@ -175,6 +175,7 @@ typedef struct {
char rt_text[RT_LENGTH]; char rt_text[RT_LENGTH];
uint8_t rt_state : 5; uint8_t rt_state : 5;
uint8_t rt_update : 1; uint8_t rt_update : 1;
uint8_t rt2_update : 1;
uint8_t rt_ab : 1; uint8_t rt_ab : 1;
uint8_t rt_segments : 5; uint8_t rt_segments : 5;
uint8_t rt2_segments : 5; uint8_t rt2_segments : 5;
@@ -332,6 +333,7 @@ void set_rds_defaults(RDSEncoder* enc, uint8_t program);
void init_rds_encoder(RDSEncoder* enc); void init_rds_encoder(RDSEncoder* enc);
void get_rds_bits(RDSEncoder* enc, uint8_t *bits); void get_rds_bits(RDSEncoder* enc, uint8_t *bits);
void set_rds_rt1(RDSEncoder* enc, char *rt1); void set_rds_rt1(RDSEncoder* enc, char *rt1);
void set_rds_rt2(RDSEncoder* enc, char *rt2);
void set_rds_dps1(RDSEncoder* enc, char *dps1); void set_rds_dps1(RDSEncoder* enc, char *dps1);
void set_rds_next_dps1(RDSEncoder* enc, char *dps1); void set_rds_next_dps1(RDSEncoder* enc, char *dps1);
void set_rds_ps(RDSEncoder* enc, char *ps); void set_rds_ps(RDSEncoder* enc, char *ps);

View File

@@ -21,10 +21,10 @@ PTYN
PTYNEN PTYNEN
RT1 | TEXT RT1 | TEXT
RT1EN RT1EN
- RT2 RT2
- RT2EN RT2EN
- RTPER RTPER
- RTTYPE RTTYPE
- RSTDPS - RSTDPS
SCRLSPD SCRLSPD
SPSPER SPSPER
@@ -42,21 +42,21 @@ EON*
- SLIST - SLIST
- SEN - SEN
- Sxx* - Sxx*
(COMSPD) (COMSPD) - No COM
CT CT
(DATE) (DATE) - Date is taken from system time
- ECHO - ECHO
(EXTSYNC) (EXTSYNC) - No Sync
LEVEL LEVEL
(LTO) (LTO) - Time is taken from system
(PHASE) (PHASE) - No phase control
(MJD) (MJD) - Data is taken...
(PILOT) (PILOT) - No info
RDSGEN RDSGEN
(RESET) RESET
(SPEED) (SPEED) - No COM
- STATUS, ?? - STATUS, ??
(TIME) (TIME) - Time is taken...
VER VER
- ADR *ADR - ADR *ADR
- CC - CC
@@ -70,7 +70,7 @@ PIN
PINEN PINEN
PROGRAM PROGRAM
PSN* PSN*
(PSW) (PSW) - Could be
RTP RTP
RTPRUN RTPRUN
SHORTRT SHORTRT