8.13 Hamlib -- mode and bandwidth
rigctl uses commands \get_mode and \set_mode commands for both the mode and the IF width settings.
This adds a degree of complexity which I have tried to minimise in the configuration system.
The format for \set_mode is: \set_mode Main LSB 2700
\get_mode Main returns LSB\n2700\n (\n is newline, ASCII 10)
Reading mode
Mode reads for Main (or VFOA) and Sub (or VFOB) from the rig each have a dedicated repetitive process.
The repetition intervals for these reads are set in the timing table using fields:
modecur ( currently selected VFO) and modezz (sleeping VFO)
Mode display is thereby continually updated, which means: highlighting the correct mode button, and updating
the mode indicators to the left of the frequency displays.
If your chosen IF width slider has code=IFWD, then the bandwidth returned with mode will update the slider
and its adjacent display (for the currently selected VFO).
The returned mode and bandwidth data also update stored: modeA, modedB, passbandA and passbandB.
Note the mode updates from the rig occur in the background and in Hamlib will update the IF width slider.
There is therefore no need to have the slider configured for sync. (So I use active=Y rather than active=S)
There is no need in fact to configure the readmask field for IF width. I set readmask = xxx which
make the server return a XXX_COMMAND error code. This ensures no further action.
Setting mode is more tricky. We have to send both mode and passband.
On setting passband (ie: on moving the IF width slider), piWebCAT sends the existing mode from stored
modeA or modeB and the new passband value derived from slider position.
We use setmask = \set_mode Main #. This is used as follows:
The slider position derived bandwidth arises on the client. The current mode is held on the client.
The client software combines these into a string of the form: LSB 2800. This is the data sent to the server.
The server reads \get_mode Main # from the database and substitutes the data string for the # character.
This is then sent as the command to rigctld: \get_mode Main LSB 2800
On setting mode (ie: clicking a mode button), piWebCAT sends the new mode and a passband value of -1.
eg: \set_mode Sub CW -1 . CW is from the CW button's nset value in the buttonshl table.
The passband = -1 causes the radio to use the previously used bandwidth from the last time the mode was used.
(I could have sent the current stored passband .... but that would be for the old mode and so not a good idea.)
Sending 0 instead of -1 selects the rig's default passband for the mode. if you prefer that, simply change -1 to 0)
Thus: both mode and IF width commands have to use \get_mode and \set_mode.
These are in catcodeshl for mode (button controlled) and in slidershl for IF width (slider controlled)
This combination of passband and mode into a single command is a Hamlib feature. I can see why it is done.
... but it made my life quite a bit mode complicated .... and yours a little more complicated!
Hamlib rigctld - Bandwidth display
|
In the text box and associated slidershl records above and on the previous page,
the BW Main and BW Sub items use a feature that is only available using Hamlib.
Mode data read events are set up in the buttonshl and catcodeshl tables as described above.
When the bandwidth is returned with mode data, piWebCAT checks for the existence of sliderhl text item records
with active=W and with code=WRXA (for Main/VFOA) or code=WRXB (for Sub/WRXB). (as above example)
The bandwidth data display is then updated.
( Main and Sub are Yaesu FTdx101D terminology. Most rigs use VFOA and VFOB )