diff --git a/scripts/1-rft.lua b/scripts/1-rft.lua index ba31342..348d805 100644 --- a/scripts/1-rft.lua +++ b/scripts/1-rft.lua @@ -68,11 +68,10 @@ function RftInstance:start() local total_segments = math.ceil(#self.file_data / 5) - local send_data = true - if get_available_rds_streams() == 3 and stream == 2 then send_data = false - elseif get_available_rds_streams() == 4 and stream == 3 then send_data = false end + local last_stream = false + if stream == math.min(get_available_rds_streams(), get_rds_streams()) then last_stream = true end - if not self.crc_sent_this_cycle and self.crc_enabled and (self.file_segment % 16 == 0) and send_data then + if not self.crc_sent_this_cycle and self.crc_enabled and (self.file_segment % 16 == 0) and (not last_stream) then self.crc_sent_this_cycle = true local chunk_address = math.floor((self.crc_segment - 1) / 2) local c = (1 << 12) | (self.crc_mode & 7) << 9 | (chunk_address & 0x1ff)