From e579d3a2f1583027b85eea941fd8b7f58b5cbbd1 Mon Sep 17 00:00:00 2001 From: KubaPro010 Date: Fri, 26 Dec 2025 21:42:18 +0100 Subject: [PATCH] more support for that --- plugin.lua | 7 ++++++- src/lua_rds.c | 9 +++++++++ src/rds_groups.c | 6 ++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugin.lua b/plugin.lua index 4185d01..d1ee017 100644 --- a/plugin.lua +++ b/plugin.lua @@ -284,13 +284,18 @@ function set_rds_udg(xy, groups) end function set_rds_udg2(xy, groups) end ---Registers an ODA to be used in the O of the group sequence. ODAs are stored as state data, thus running reset_rds will clear it ----Groups 14, 15, 2, 0 cannot be registered either version, groups 10, 4, 3, 1 can be only registered as B, any other is free to take +---Groups 14, 15, 2, 0 cannot be registered either version, groups 10, 4, 1 can be only registered as B, any other is free to take +---Group 3A will mean that there will be no group handler for this ODA, meaning it can only be interacted with via the 3A AID group, handler set is not possible with such groups ---@param group integer ---@param group_version boolean ---@param id integer ---@param id_data integer ---@return integer oda_id function register_oda(group, group_version, id, id_data) end +---Sets the id_data for a existing ODA group +---@param oda_id integer +---@param data integer +function set_oda_id_data(oda_id, data) end ---The callback function for an ODA handler ---@alias ODAHandler fun(): (integer, integer, integer) diff --git a/src/lua_rds.c b/src/lua_rds.c index a34c13e..296d0a2 100644 --- a/src/lua_rds.c +++ b/src/lua_rds.c @@ -429,6 +429,14 @@ int lua_register_oda(lua_State *localL) { return 1; } +int lua_set_oda_id_data(lua_State *localL) { + uint8_t idx = luaL_checkinteger(localL, 1); + if(idx >= 32) return luaL_error(localL, "There can't be more than 32 registered ODAs"); + if(mod->enc->state[mod->enc->program].user_oda.odas[idx].group == 0) return luaL_error(localL, "this oda is not registered"); + mod->enc->state[mod->enc->program].user_oda.odas[idx].id_data = luaL_checkinteger(localL, 2); + return 0; +} + int lua_set_oda_handler(lua_State *localL) { uint8_t idx = luaL_checkinteger(localL, 1); if(idx >= 32) return luaL_error(localL, "There can't be more than 32 registered ODAs"); @@ -557,6 +565,7 @@ void init_lua(RDSModulator* rds_mod) { lua_register(L, "set_rds_udg2", lua_set_rds_udg2); lua_register(L, "register_oda", lua_register_oda); + lua_register(L, "set_oda_id_data", lua_set_oda_id_data); lua_register(L, "set_oda_handler", lua_set_oda_handler); lua_register(L, "set_userdata", lua_set_userdata); diff --git a/src/rds_groups.c b/src/rds_groups.c index c93ab53..1fb99e7 100644 --- a/src/rds_groups.c +++ b/src/rds_groups.c @@ -319,10 +319,8 @@ void get_rds_user_oda_group(RDSEncoder* enc, RDSGroup *group) { RDSODA oda = enc->state[enc->program].user_oda.odas[pointer]; group->b |= 3 << 12; - if(oda.group != 3) { - group->b |= oda.group << 1; - group->b |= oda.group_version; - } + group->b |= oda.group << 1; + group->b |= oda.group_version; group->c = oda.id_data; group->d = oda.id; }