0
1
mirror of https://github.com/radio95-rnt/rds95.git synced 2026-02-26 20:33:53 +01:00
This commit is contained in:
2025-12-29 00:37:07 +01:00
parent 22e04e17d1
commit d4d8282acd

View File

@@ -7,6 +7,7 @@ _Rft_toggle = false
_Rft_last_id = -1 _Rft_last_id = -1
_Rft_version = 0 _Rft_version = 0
_Rft_crc = false _Rft_crc = false
_Rft_crc_full_file = 0
_Rft_crc_mode = 0 _Rft_crc_mode = 0
_Rft_crc_sent = false _Rft_crc_sent = false
_Rft_aid = 0xFF7F _Rft_aid = 0xFF7F
@@ -26,15 +27,20 @@ local function start_rft()
local chunk_address = math.floor((_Rft_crc_segment - 1) / 2) local chunk_address = math.floor((_Rft_crc_segment - 1) / 2)
local c = (1 << 12) | (_Rft_crc_mode & 7) << 9 | (chunk_address & 0x1ff) local c = (1 << 12) | (_Rft_crc_mode & 7) << 9 | (chunk_address & 0x1ff)
local high_byte = string.byte(_Rft_crc_data, _Rft_crc_segment) or 0 local high_byte = 0
local low_byte = string.byte(_Rft_crc_data, _Rft_crc_segment + 1) or 0 local low_byte = 0
if _Rft_crc_mode ~= 0 then
local crc_word = (high_byte << 8) | low_byte high_byte = string.byte(_Rft_crc_data, _Rft_crc_segment) or 0
low_byte = string.byte(_Rft_crc_data, _Rft_crc_segment + 1) or 0
else
high_byte = _Rft_crc_full_file >> 8
low_byte = _Rft_crc_full_file & 0xff
end
_Rft_crc_segment = _Rft_crc_segment + 2 _Rft_crc_segment = _Rft_crc_segment + 2
if _Rft_crc_segment > #_Rft_crc_data then _Rft_crc_segment = 1 end if _Rft_crc_segment > #_Rft_crc_data then _Rft_crc_segment = 1 end
return true, (2 << 14), _Rft_aid, c, crc_word return true, (2 << 14), _Rft_aid, c, (high_byte << 8) | low_byte
else else
_Rft_crc_sent = false _Rft_crc_sent = false
end end
@@ -79,8 +85,7 @@ function load_station_logo(path, id, crc)
if crc and (crc == 0 or crc == true) then if crc and (crc == 0 or crc == true) then
_Rft_crc_mode = 0 _Rft_crc_mode = 0
local crc_val = crc16(_Rft_file) _Rft_crc_full_file = crc16(_Rft_file)
_Rft_crc_data = string.char(math.floor(crc_val / 256), crc_val % 256)
elseif crc and crc == 1 then elseif crc and crc == 1 then
_Rft_crc_mode = 1 _Rft_crc_mode = 1
local chunk_size = 5 * 16 -- 80 bytes local chunk_size = 5 * 16 -- 80 bytes