mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-27 04:43:52 +01:00
add rds2 custom cmd
This commit is contained in:
@@ -223,13 +223,20 @@ static void handle_af(char *arg, RDSModulator* mod, char* output) {
|
|||||||
|
|
||||||
static void handle_g(char *arg, RDSModulator* mod, char* output) {
|
static void handle_g(char *arg, RDSModulator* mod, char* output) {
|
||||||
uint16_t blocks[3];
|
uint16_t blocks[3];
|
||||||
int count = sscanf((char *)arg, "%4hx%4hx%4hx", &blocks[0], &blocks[1], &blocks[2]);
|
int count = sscanf((char *)arg, "%4hx%4hx%4hx%4hx", &blocks[0], &blocks[1], &blocks[2], &blocks[3]);
|
||||||
if (count == 3) {
|
if (count == 3) {
|
||||||
mod->enc->state[mod->enc->program].custom_group[0] = 1;
|
mod->enc->state[mod->enc->program].custom_group[0] = 1;
|
||||||
mod->enc->state[mod->enc->program].custom_group[1] = blocks[0];
|
mod->enc->state[mod->enc->program].custom_group[1] = blocks[0];
|
||||||
mod->enc->state[mod->enc->program].custom_group[2] = blocks[1];
|
mod->enc->state[mod->enc->program].custom_group[2] = blocks[1];
|
||||||
mod->enc->state[mod->enc->program].custom_group[3] = blocks[2];
|
mod->enc->state[mod->enc->program].custom_group[3] = blocks[2];
|
||||||
strcpy(output, "+\0");
|
strcpy(output, "+\0");
|
||||||
|
} else if(count == 4) {
|
||||||
|
mod->enc->state[mod->enc->program].custom_group2[0] = 1;
|
||||||
|
mod->enc->state[mod->enc->program].custom_group2[1] = blocks[0];
|
||||||
|
mod->enc->state[mod->enc->program].custom_group2[2] = blocks[1];
|
||||||
|
mod->enc->state[mod->enc->program].custom_group2[3] = blocks[2];
|
||||||
|
mod->enc->state[mod->enc->program].custom_group2[4] = blocks[3];
|
||||||
|
strcpy(output, "+\0");
|
||||||
} else {
|
} else {
|
||||||
strcpy(output, "-\0");
|
strcpy(output, "-\0");
|
||||||
}
|
}
|
||||||
|
|||||||
19
src/rds.c
19
src/rds.c
@@ -545,10 +545,27 @@ static uint8_t get_rds_custom_groups(RDSEncoder* enc, uint16_t *blocks) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static uint8_t get_rds_custom_groups2(RDSEncoder* enc, uint16_t *blocks) {
|
||||||
|
if(enc->state[enc->program].custom_group2[0] == 1) {
|
||||||
|
enc->state[enc->program].custom_group2[0] = 0;
|
||||||
|
blocks[0] = enc->state[enc->program].custom_group[1];
|
||||||
|
blocks[1] = enc->state[enc->program].custom_group[2];
|
||||||
|
blocks[2] = enc->state[enc->program].custom_group[3];
|
||||||
|
blocks[3] = enc->state[enc->program].custom_group[4];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void get_rds_group(RDSEncoder* enc, uint16_t *blocks, uint8_t stream) {
|
static void get_rds_group(RDSEncoder* enc, uint16_t *blocks, uint8_t stream) {
|
||||||
blocks[0] = enc->data[enc->program].pi;
|
blocks[0] = enc->data[enc->program].pi;
|
||||||
if(stream != 0) blocks[0] = 0;
|
if(stream != 0) {
|
||||||
|
blocks[0] = 0;
|
||||||
|
if(get_rds_custom_groups2(enc, blocks)) {
|
||||||
|
goto group_coded;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
blocks[1] = 0;
|
blocks[1] = 0;
|
||||||
blocks[2] = 0;
|
blocks[2] = 0;
|
||||||
blocks[3] = 0;
|
blocks[3] = 0;
|
||||||
|
|||||||
@@ -189,6 +189,7 @@ typedef struct {
|
|||||||
uint8_t lps_segments : 5;
|
uint8_t lps_segments : 5;
|
||||||
|
|
||||||
uint16_t custom_group[GROUP_LENGTH];
|
uint16_t custom_group[GROUP_LENGTH];
|
||||||
|
uint16_t custom_group2[GROUP_LENGTH + 1];
|
||||||
|
|
||||||
uint8_t rtp_oda : 1;
|
uint8_t rtp_oda : 1;
|
||||||
uint8_t grp_seq_idx[3];
|
uint8_t grp_seq_idx[3];
|
||||||
|
|||||||
Reference in New Issue
Block a user