mirror of
https://github.com/technix/ham_radio.git
synced 2024-08-19 12:44:12 +02:00
allow empty frequency (turn off)
This commit is contained in:
parent
aaabf34595
commit
63b9e98b07
@ -1,4 +1,7 @@
|
|||||||
function ham_radio.validate_frequency(frequency)
|
function ham_radio.validate_frequency(frequency)
|
||||||
|
if frequency == "" then
|
||||||
|
return true -- empty frequency is allowed to disable transmitter/receiver
|
||||||
|
end
|
||||||
local transmission_is_allowed = true
|
local transmission_is_allowed = true
|
||||||
local num_freq = tonumber(frequency)
|
local num_freq = tonumber(frequency)
|
||||||
local freq = tostring(num_freq)
|
local freq = tostring(num_freq)
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
|
|
||||||
ham_radio.transmitter_update_infotext = function(meta)
|
ham_radio.transmitter_update_infotext = function(meta)
|
||||||
local infotext = {'Frequency: ', meta:get_string("frequency")}
|
local frequency = meta:get_string("frequency")
|
||||||
local broadcast_message = meta:get_string("broadcast_message")
|
local broadcast_message = meta:get_string("broadcast_message")
|
||||||
|
if frequency == "" then
|
||||||
|
frequency = "--"
|
||||||
|
broadcast_message = ""
|
||||||
|
end
|
||||||
|
local infotext = {'Frequency: ', frequency}
|
||||||
if broadcast_message ~= "" then
|
if broadcast_message ~= "" then
|
||||||
table.insert(infotext, '\nBroadcast: "')
|
table.insert(infotext, '\nBroadcast: "')
|
||||||
table.insert(infotext, broadcast_message)
|
table.insert(infotext, broadcast_message)
|
||||||
|
Loading…
Reference in New Issue
Block a user