mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
more support for that
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user