add default rt setter + rt timeout and switching period now can be in seconds

This commit is contained in:
2025-12-26 09:18:51 +01:00
parent 4310a847d9
commit 9c4321d9e4
6 changed files with 62 additions and 35 deletions
+20 -19
View File
@@ -170,6 +170,26 @@ static void get_rds_group(RDSEncoder* enc, RDSGroup *group, uint8_t stream) {
if(utc->tm_sec != enc->state[enc->program].last_second) {
enc->state[enc->program].last_second = utc->tm_sec;
if(enc->data[enc->program].rt1_enabled && enc->data[enc->program].current_rt == 0 && enc->state[enc->program].rt_text_timeout_state) {
enc->state[enc->program].rt_text_timeout_state--;
if(enc->state[enc->program].rt_text_timeout_state == 0) {
enc->state[enc->program].rt_update = 1;
memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].default_rt, RT_LENGTH);
enc->state[enc->program].rt_segments = enc->state[enc->program].default_rt_segments;
}
}
if(enc->data[enc->program].rt1_enabled && enc->data[enc->program].rt2_enabled && enc->state[enc->program].rt_switching_period_state) {
enc->state[enc->program].rt_switching_period_state--;
if(enc->state[enc->program].rt_switching_period_state == 0) {
TOGGLE(enc->data[enc->program].current_rt);
if (enc->data[enc->program].current_rt == 1) memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt2, RT_LENGTH);
else memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt1, RT_LENGTH);
enc->state[enc->program].rt_state = 0;
enc->state[enc->program].rt_switching_period_state = enc->data[enc->program].rt_switching_period;
}
}
lua_call_function("tick");
}
@@ -191,25 +211,6 @@ static void get_rds_group(RDSEncoder* enc, RDSGroup *group, uint8_t stream) {
};
}
if(enc->data[enc->program].rt1_enabled && enc->data[enc->program].rt2_enabled && enc->state[enc->program].rt_switching_period_state) {
enc->state[enc->program].rt_switching_period_state--;
if(enc->state[enc->program].rt_switching_period_state == 0) {
TOGGLE(enc->data[enc->program].current_rt);
if (enc->data[enc->program].current_rt == 1) memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt2, RT_LENGTH);
else memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].rt1, RT_LENGTH);
enc->state[enc->program].rt_state = 0;
enc->state[enc->program].rt_switching_period_state = enc->data[enc->program].rt_switching_period;
}
}
if(enc->data[enc->program].rt1_enabled && enc->data[enc->program].current_rt == 0 && enc->state[enc->program].rt_text_timeout_state) {
enc->state[enc->program].rt_text_timeout_state--;
if(enc->state[enc->program].rt_text_timeout_state == 0) {
enc->state[enc->program].rt_update = 1;
memcpy(enc->state[enc->program].rt_text, enc->data[enc->program].default_rt, RT_LENGTH);
}
}
if(enc->data[enc->program].ct && stream == 0) {
get_rdsp_ct_group(group, now);
goto group_coded;