mirror of
https://github.com/technix/ham_radio.git
synced 2024-11-19 21:53:48 +01:00
Digiline receiver: load new RDS immediately
This commit is contained in:
parent
007614adce
commit
6d19c5c302
@ -78,8 +78,10 @@ ham_radio.digiline_effector_receiver = function(pos, _, channel, msg)
|
|||||||
local validate = ham_radio.validate_frequency(new_frequency, true)
|
local validate = ham_radio.validate_frequency(new_frequency, true)
|
||||||
if validate.result then
|
if validate.result then
|
||||||
meta:set_string("frequency", new_frequency)
|
meta:set_string("frequency", new_frequency)
|
||||||
ham_radio.reset_receiver(pos)
|
-- load new RDS messages
|
||||||
ham_radio.receiver_update_infotext(meta)
|
local poshash = minetest.pos_to_string(pos, 0)
|
||||||
|
ham_radio.receiver_rds[poshash] = ham_radio.get_rds_messages(new_frequency, true)
|
||||||
|
ham_radio.get_next_rds_message(poshash, meta)
|
||||||
end
|
end
|
||||||
digilines.receptor_send(pos, digilines.rules.default, command_channel, {
|
digilines.receptor_send(pos, digilines.rules.default, command_channel, {
|
||||||
update = 'frequency',
|
update = 'frequency',
|
||||||
|
@ -105,17 +105,19 @@ minetest.register_abm(
|
|||||||
end
|
end
|
||||||
|
|
||||||
local poshash = minetest.pos_to_string(pos, 0)
|
local poshash = minetest.pos_to_string(pos, 0)
|
||||||
|
|
||||||
if ham_radio.receiver_rds[poshash] == nil or not next(ham_radio.receiver_rds[poshash]) then
|
if ham_radio.receiver_rds[poshash] == nil or not next(ham_radio.receiver_rds[poshash]) then
|
||||||
-- when all RDS messages are shown, reload them again
|
-- when all RDS messages are shown, reload them again
|
||||||
ham_radio.receiver_rds[poshash] = ham_radio.get_rds_messages(frequency, true)
|
ham_radio.receiver_rds[poshash] = ham_radio.get_rds_messages(frequency, true)
|
||||||
end
|
end
|
||||||
|
ham_radio.get_next_rds_message(poshash, meta)
|
||||||
local message = table.remove(ham_radio.receiver_rds[poshash])
|
|
||||||
if message ~= nil then
|
|
||||||
meta:set_string('rds_message', message)
|
|
||||||
ham_radio.receiver_update_infotext(meta)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ham_radio.get_next_rds_message = function (poshash, meta)
|
||||||
|
local message = table.remove(ham_radio.receiver_rds[poshash])
|
||||||
|
if message ~= nil then
|
||||||
|
meta:set_string('rds_message', message)
|
||||||
|
ham_radio.receiver_update_infotext(meta)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user