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

all the functions

This commit is contained in:
2026-01-20 21:43:16 +01:00
parent 53c9169330
commit 48bad4ea9e
5 changed files with 32 additions and 27 deletions

View File

@@ -92,8 +92,8 @@ local function get_data()
local oda = _RDS_ODAs[_RDS_ODA_pointer]
if oda ~= false and type(oda.handler) == "function" then
local generated, b, c, d = oda.handler()
if generated then
local ok, generated, b, c, d = pcall(oda.handler())
if ok and generated then
_RDS_ODA_pointer = (_RDS_ODA_pointer % #_RDS_ODAs) + 1
b = b | oda.group << 12
b = b | (oda.group_version and 1 or 0) << 11

View File

@@ -100,8 +100,8 @@ function rds2_group(stream)
local generated = false
checked = 0
while generated == false and checked < #_RDS2_ODAs do
local generated, a, b, c, d = oda.handler(stream)
if not generated then
local ok, generated, a, b, c, d = pcall(oda.handler(stream))
if not (generated and ok) then
_RDS2_ODA_pointer = _RDS2_ODA_pointer + 1
if _RDS2_ODA_pointer > #_RDS2_ODAs then _RDS2_ODA_pointer = 1 end
oda = _RDS2_ODAs[_RDS2_ODA_pointer]

View File

@@ -40,7 +40,7 @@ function data_handle(data)
data = data:lower()
if data == "ver" then return string.format("rds95 core v. %s - (C) 2025 radio95 - lua parser\r\n", core_version)
elseif data == "init" then
dp.set_rds_program_defaults()
dp.set_program_defaults()
return "+\r\n"
elseif data == "reset" then
dp.reset_rds()
@@ -58,8 +58,8 @@ function data_handle(data)
elseif data == "ptynen" then return string.format("PTYNEN=%s\r\n", string.format("%d", (rds.get_ptyn_enabled() and 1 or 0)))
elseif data == "rttype" then return string.format("RTTYPE=%s\r\n", string.format("%d", rds.get_rt_type()))
elseif data == "rds2mod" then return string.format("RDS2MOD=%s\r\n", string.format("%d", rds.get_rds2_mode()))
elseif data == "rdsgen" then return string.format("RDSGEN=%s\r\n", string.format("%d", get_rds_streams()))
elseif data == "level" then return string.format("LEVEL=%s\r\n", string.format("%d", get_rds_level() * 255))
elseif data == "rdsgen" then return string.format("RDSGEN=%s\r\n", string.format("%d", rds.get_streams()))
elseif data == "level" then return string.format("LEVEL=%s\r\n", string.format("%d", rds.get_level() * 255))
elseif data == "link" then return string.format("LINK=%s\r\n", string.format("%d", (rds.get_link() and 1 or 0)))
elseif data == "rtp" then
local t1, s1, l1, t2, s2, l2 = rds.ext.get_rtplus_tags(false)
@@ -266,7 +266,7 @@ function data_handle(data)
elseif cmd == "rdsgen" then
local type = tonumber(value)
if not type then return "-\r\n" end
set_rds_streams(type)
rds.set_streams(type)
return "+\r\n"
elseif cmd == "ptyn" then
rds.set_ptyn(value)
@@ -303,13 +303,13 @@ function data_handle(data)
local program = tonumber(value)
if not program then return "-\r\n" end
if program < 1 or program > dp.max_programs then return "-\r\n" end
dp.set_rds_program(program-1)
dp.set_program(program-1)
rds.set_ta(false)
return "+\r\n"
elseif cmd == "level" then
local level = tonumber(value)
if not level then return "-\r\n" end
set_rds_level(level/255)
rds.set_level(level/255)
return "+\r\n"
elseif cmd == "dttmout" then
local timeout = tonumber(value)