[WT-support] Little help with LUA-stuff
Bob Wilson, N6TV
n6tv at arrl.net
Tue Sep 14 01:08:57 CEST 2010
Ooops, this version will not wait until the last second to obtain the QSY
frequency, as you requested.
QRX for version 2.
73,
Bob, N6TV
On Mon, Sep 13, 2010 at 12:02 PM, Bob Wilson, N6TV <n6tv at arrl.net> wrote:
> On Mon, Sep 13, 2010 at 6:50 AM, Laurent HAAS - F6FVY <f6fvy at free.fr>wrote:
>
>> > 2) How can I set the rounding for the freqs?
>>
>>
>> http://www.lua.org/manual/5.1/manual.html
>>
>>
>>
> Unfortunately Laurent assumes everyone is computer programmer. :-)
>
> Fortunately I can help. The attached script, repeated below, will send a
> PSE QSY message to the nearest half kHz. Please test.
>
> -- FreqS - Send a "PSE QSY" message to the frequency of the secondary radio
> -- rounding to nearest half kHz
> --
> -- Assign to F8, F9, F10, or F12 or user choice
> --
> -- Time-stamp: "13 September 2010 18:56 UTC"
> --
> -- Written by N6TV
>
> local QSYmsg = "PSE QSY"
> local QSYfreq = ""
> -- Get the VFOA frequency of the secondary radio
> local freqS = wtRadioSecondary:GetFreq()
>
> -- If frequency obtained OK
> if freqS ~= nil and freqS ~= 0 then
> -- Split the frequency into the whole kHz and the fractional kHz
> local freqInt, freqFrac = math.modf(freqS)
>
> -- If fractional kHz is below 0.250 kHz
> if freqFrac <= 0.25 then
> -- Round DOWN to nearest kHz
> QSYfreq = math.floor(freqS)
> -- Else if fractional kHz is above 0.750 kHz
> elseif freqFrac >= 0.75 then
> -- Round UP to nearest kHz
> QSYfreq = math.ceil(freqS)
> -- Else round to nearest half kHz
> else
> QSYfreq = math.floor(freqS) .. "R5"
> end
> end
>
> QSYmsg = QSYmsg .. " --" .. QSYfreq .. "++ ?"
>
> -- Play the PSE QSY message
> wtKeyer:Play(QSYmsg)
>
> -- No further keystroke processing
> return -1
>
> Or if you don't want any rounding:
>
> -- FreqSnr - Send a "PSE QSY" message to the frequency of the secondary
> radio,
> -- like the FREQnn messages, with no rounding.
> --
> -- Assign to F8, F9, F10, or F12 or user choice
> --
> -- Time-stamp: "13 September 2010 18:54 UTC"
> --
> -- Written by N6TV
>
> local QSYmsg = "PSE QSY"
> local QSYfreq = ""
> local freqFrac = ""
> -- Get the VFOA frequency of the secondary radio
> local freqS = wtRadioSecondary:GetFreq()
>
> -- If frequency obtained OK
> if freqS ~= nil and freqS ~= 0 then
> -- Split the frequency into the whole kHz and the fractional kHz
> QSYfreq, freqFrac = math.modf(freqS)
>
> -- If fractional kHz is to be sent
> if freqFrac >= 0.1 and freqFrac <= 0.9 then
> -- Play fractional kHz after "R"
> QSYfreq = QSYfreq .. "R" .. math.floor(freqFrac * 10)
> end
> end
>
> QSYmsg = QSYmsg .. " --" .. QSYfreq .. "++ ?"
>
> -- Play the PSE QSY message
> wtKeyer:Play(QSYmsg)
>
> -- No further keystroke processing
> return -1
>
> Unfortunately I cannot enhance either one to work with networked computers
> at a multi-multi until new LUA APIs are provided to obtain the values of the
> $FREQnn variables, or obtain the frequencies of networked radios, by band.
>
> 73,
> Bob, N6TV
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.f5mzn.org/pipermail/support/attachments/20100913/588b41a6/attachment-0001.htm
More information about the Support
mailing list