5.9 YAESU FT920 - Rx clarifier - on/off switching
You need to first look at the documentation on ASCII command masks.
The outgoing commands for all YAESU5 radios are five bytes:
- four bytes of optional bcd (binary coded decimal) data
- following by a hexadecimal opcode byte.
- The readbytes and setbytes fields are always set to 10 (ie: 10 chars generating 5 bytes)
The following examples illustrate on/off switching and use of a slider for clarifier tuning.
Note that piWebCAT is repeatedly reading different small amounts of data that are held in the common
large data blocks. eg: mode, frequency, clarifier offset, flag (clar on/off) are all within the same 28 byte
block. piWebCAT's design means that the web client has to read these separately for each task.
This is very inefficient and a waste of Rpi <> rig data bandwidth (at 4800 baud !)
I have therefore provided a caching system by which a single read store the data blocks in server
SESSION variables. That the data is then available on the Rpi server without unnecessary extra
reads of the same data. So for repetitive tasks, one of the read tasks does the read and the others
use the cache. This is in an FT920 'rigfix'.
My example on the SD card uses button 18 and slider 18 (top right)
This has no reset-to default button.
If a reset button is required then this could easily be moved to the centre column.
Clarifier on/off button - FT920 example
The manual specifies clarifier setting in four bytes: P4 P3 P2 P1 followed by opcode = 09
Setting clarifier on/off status.
The clarifier setting commands are illustrated above and in note 4 on the right.
If P1 = FF, then P2, P3 and P4 control the slider.
The buttons and catcodes table entries are:
The code = CLON field links the buttons entry (client) to the catcodes entry. Button action = T (toggling).
seton = 1 and setoff = 0 ( from P1 = 01 for ON and P1 = 00 for OFF )
In the catcodes table, setmask = 000000tu09 ( 00 00 00 tu 09 = ** ** ** P1 09 )
t = tens u = units .
For the ON command, the server substitutes 01 for tu and sends 0000000109 .
For the OFF command, the server substitutes 00 for tu and sends 0000000009 .
Reading clarifier on/off status
The Flag data bytes is byte 8 of the 14 byte block.
Bit 1 is Rx clarifier on/off.
To extract the bit we perform a logical AND with 02 hex.
This then returns 02 for ON and 00 for OFF.
The answer mask is set to: #28:08:01:02:xx.
We have to receive all 28 bytes. We extract 01 byte at position 01
and mask it with 02 hex.
The result is returned as a two character number 00 or 02.
So in the buttons table, we set anson = 02 and ansoff = 00.