0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-27 04:43:52 +01:00

disallow pis starting with 0

This commit is contained in:
2025-03-24 21:57:35 +01:00
parent 1dc74fbd36
commit fff53e9b74
2 changed files with 7 additions and 2 deletions

View File

@@ -94,7 +94,12 @@ static void handle_ta(char *arg, RDSModulator* mod, char* output) {
}
static void handle_pi(char *arg, RDSModulator* mod, char* output) {
mod->enc->data[mod->enc->program].pi = strtoul(arg, NULL, 16);
uint16_t pi_value = strtoul(arg, NULL, 16);
if ((pi_value & 0xF000) == 0) {
strcpy(output, "-\0");
return;
}
mod->enc->data[mod->enc->program].pi = pi_value;
strcpy(output, "+\0");
}

View File

@@ -28,7 +28,7 @@ void add_checkwords(uint16_t *blocks, uint8_t *bits, uint8_t stream)
{
uint16_t offset_word;
bool group_type_b = IS_TYPE_B(blocks);
bool rds2_tunneling = (((bool)(blocks[0] & 0xFE00))^1 && (stream != 0));
bool rds2_tunneling = ((blocks[0] == 0) && (stream != 0));
for (uint8_t i = 0; i < GROUP_LENGTH; i++) {
offset_word = offset_words[i];