diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index d843d12..9dd8b5e 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -278,7 +278,13 @@ static void handle_ptynen(char *arg, RDSModulator* mod, char* output) { } static void handle_rtprun(char *arg, RDSModulator* mod, char* output) { - set_rds_rtplus_flags(mod->enc, atoi(arg)); + int flag1, flag2; + if (sscanf(arg, "%d,%d", &flag1, &flag2) == 2) { + set_rds_rtplus_flags(mod->enc, flag1); + if(flag2) mod->enc->rtpState[mod->enc->program].toggle ^= 1; + } else { + set_rds_rtplus_flags(mod->enc, atoi(arg)); + } strcpy(output, "+\0"); } diff --git a/src/control_pipe.c b/src/control_pipe.c index afb1ecc..d0d9ad2 100644 --- a/src/control_pipe.c +++ b/src/control_pipe.c @@ -31,7 +31,7 @@ void poll_control_pipe(RDSModulator* mod) { if (bytes_read <= 0) return; token = strtok((char *)pipe_buf, "\r\n"); - if(token == NULL) token = strtok((char *)pipe_buf, "\x1A"); + if(token == NULL) token = strtok((char *)pipe_buf, "\r"); while (token != NULL) { size_t cmd_len = strlen(token); if (cmd_len > 0 && cmd_len < CMD_BUFFER_SIZE) { @@ -40,7 +40,7 @@ void poll_control_pipe(RDSModulator* mod) { process_ascii_cmd(mod, cmd_buf); } token = strtok(NULL, "\r\n"); - if(token == NULL) token = strtok(NULL, "\x1A"); + if(token == NULL) token = strtok(NULL, "\r"); } } diff --git a/src/rds.c b/src/rds.c index df2c118..57bb1e8 100644 --- a/src/rds.c +++ b/src/rds.c @@ -367,6 +367,14 @@ static void get_rds_oda_group(RDSEncoder* enc, uint16_t *blocks) { if (enc->oda_state[enc->program].current >= enc->oda_state[enc->program].count) enc->oda_state[enc->program].current = 0; } +static void get_rds_rtp_oda_group(RDSEncoder* enc, uint16_t *blocks) { + blocks[1] |= 3 << 12; + + blocks[1] |= GET_GROUP_TYPE(enc->rtpData[enc->program].group) << 1; + blocks[1] |= GET_GROUP_VER(enc->rtpData[enc->program].group); + blocks[3] = ODA_AID_RTPLUS; +} + static void get_rds_ct_group(RDSEncoder* enc, uint16_t *blocks) { (void)enc; struct tm *utc, *local_time; @@ -696,7 +704,7 @@ static void get_rds_group(RDSEncoder* enc, uint16_t *blocks) { if(enc->state[enc->program].rtp_oda == 0) { get_rds_rtplus_group(enc, blocks); } else { - get_rds_oda_group(enc, blocks); + get_rds_rtp_oda_group(enc, blocks); } enc->state[enc->program].rtp_oda ^= 1; goto group_coded; @@ -725,7 +733,6 @@ void get_rds_bits(RDSEncoder* enc, uint8_t *bits) { } static void init_rtplus(RDSEncoder* enc, uint8_t group, uint8_t program) { - register_oda(enc, group, ODA_AID_RTPLUS, 0); enc->rtpData[program].group = group; enc->rtpData[program].enabled = 0; } diff --git a/src/rds.h b/src/rds.h index 4cbcb72..bc95ecd 100644 --- a/src/rds.h +++ b/src/rds.h @@ -142,9 +142,6 @@ typedef struct { uint16_t udg2[8][3]; RDSEON eon[EONS]; - - RDSMessages messages; - RDSScheduler schedule; } RDSData; typedef struct { uint8_t ecc_or_lic : 1; @@ -194,7 +191,7 @@ typedef struct { uint16_t custom_group[GROUP_LENGTH]; uint8_t rtp_oda : 1; - uint8_t grp_seq_idx[2]; + uint8_t grp_seq_idx[3]; uint8_t udg_idxs[2]; uint8_t last_minute : 6; @@ -241,6 +238,10 @@ typedef struct { uint16_t site_addr[2]; RDSEncoderASCIIData ascii_data; RDSEncoderUECPData uecp_data; + uint16_t special_features; + RDSScheduler schedule; + RDSMessages messages; + // uint8_t rds2_buffer[16384]; } RDSEncoderData; typedef struct { RDSEncoderData encoder_data[PROGRAMS]; diff --git a/supported_cmds.txt b/supported_cmds.txt index 787649f..1771531 100644 --- a/supported_cmds.txt +++ b/supported_cmds.txt @@ -13,6 +13,7 @@ DPS1MOD (partial) - DTTMOUT - EQTEXT1 LABPER +LPS - P232 Only MS PI PS @@ -52,8 +53,11 @@ LEVEL (PHASE) - No phase control (MJD) - Data is taken... (PILOT) - No info -RDSGEN + - PSNMAIN + - RDS2MOD +RDSGEN - Partial RESET +- SETFEAT (SPEED) - No COM - STATUS, ?? (TIME) - Time is taken... @@ -62,7 +66,7 @@ VER - CC DSN* ECCEN -G +G - Partial GRPSEQ LIC - NOHDR @@ -73,9 +77,12 @@ PSN* (PSW) - Could be RTP RTPRUN +- SETSPY SHORTRT - SEL - SITE *SITE +- STORE UDG1 UDG2 -- UECP \ No newline at end of file +- UECP +- XCMD \ No newline at end of file