diff --git a/src/ascii_cmd.c b/src/ascii_cmd.c index de5982a..086340d 100644 --- a/src/ascii_cmd.c +++ b/src/ascii_cmd.c @@ -220,6 +220,10 @@ static void handle_level(unsigned char *arg) { set_rds_level(strtoul((char *)arg, NULL, 10)/255.0f); } +static void handle_rdsgen(unsigned char *arg) { + set_rds_gen(strtoul((char *)arg, NULL, 10)); +} + static void handle_udg1(unsigned char *arg) { uint16_t blocks[8][3]; int sets = 0; @@ -323,7 +327,8 @@ static const command_handler_t commands_eq6[] = { static const command_handler_t commands_eq7[] = { {"PTYNEN", handle_ptynen, 6}, {"RTPRUN", handle_rtprun, 6}, - {"GRPSEQ", handle_grpseq, 6} + {"GRPSEQ", handle_grpseq, 6}, + {"RDSGEN", handle_rdsgen, 6} }; static const command_handler_t commands_eq8[] = { diff --git a/src/modulator.c b/src/modulator.c index abb0b1f..5dd6e8c 100644 --- a/src/modulator.c +++ b/src/modulator.c @@ -7,6 +7,7 @@ static struct rds_t rds; static float waveform[2][FILTER_SIZE]; static float level; +static uint8_t rdsgen; void init_rds_objects() { level = 1.0f; @@ -25,6 +26,9 @@ void init_rds_objects() { void set_rds_level(float _level) { level = fminf(1.0f, fmaxf(0.0f, _level)); } +void set_rds_gen(uint8_t rdsgen) { + rdsgen = min(1, max(0, rdsgen)); // No RDS2 +} /* Get an RDS sample. This generates the envelope of the waveform using * pre-generated elementary waveform samples. @@ -67,5 +71,6 @@ float get_rds_sample() { rds.sample_buffer[rds.out_sample_index++] = 0; if (rds.out_sample_index == SAMPLE_BUFFER_SIZE) rds.out_sample_index = 0; + if(rdsgen == 0) sample = 0.0f; return sample*level; } diff --git a/src/modulator.h b/src/modulator.h index ebc877e..38073cd 100644 --- a/src/modulator.h +++ b/src/modulator.h @@ -13,3 +13,4 @@ typedef struct rds_t { extern void init_rds_objects(); extern void set_rds_level(float _level); +extern void set_rds_gen(uint8_t rdsgen); \ No newline at end of file