0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00

faster clock

This commit is contained in:
2025-12-24 13:44:11 +01:00
parent 586a23a6a1
commit e4d158a52a
3 changed files with 8 additions and 2 deletions

View File

@@ -24,7 +24,7 @@ function on_init() end
---It should be defined by the user in the script.
---@return nil
function on_start() end
---This function is called every minute
---This function is called every second
---It should be defined by the user in the script.
---@return nil
function tick() end

View File

@@ -157,8 +157,12 @@ static void get_rds_group(RDSEncoder* enc, RDSGroup *group, uint8_t stream) {
time(&now);
utc = gmtime(&now);
if (utc->tm_min != enc->state[enc->program].last_minute) {
if(utc->tm_sec != enc->state[enc->program].last_second) {
enc->state[enc->program].last_second = utc->tm_sec;
lua_call_function("tick");
}
if (utc->tm_min != enc->state[enc->program].last_minute) {
enc->state[enc->program].last_minute = utc->tm_min;
uint8_t eon_has_ta = 0;
@@ -355,6 +359,7 @@ void reset_rds_state(RDSEncoder* enc, uint8_t program) {
time(&now);
utc = gmtime(&now);
tempCoder.state[program].last_minute = utc->tm_min;
tempCoder.state[program].last_second = utc->tm_min;
for(int i = 0; i < EONs; i++) tempCoder.data[program].eon[i].ta = 0;

View File

@@ -159,6 +159,7 @@ typedef struct {
uint8_t fasttuning_state : 3;
uint8_t last_minute : 6;
uint8_t last_second : 6;
uint8_t ta_timeout : 7;
uint8_t ta_timeout_state : 7;