16 April 2016

Coding fun

I've managed to spend some time on the software side of the project recently. With the rig away, I am somewhat limited in what I can do but there is a whole class of data processing and display management that is not related to the radio interface at all.

So I've been working on the display logic for the encoders and switches. I integrated the switch multiplexer software that I'd developed separately into the main control program and that is working just fine. I've also written most of the code to do with managing the encoder functions display. That is turn is linked into the switch multiplexer so that a switch pushed on the mux shows up as a change in encoder function and that change is properly reflected on the display.

All this is completely soft, of course. The key to how it all connects together is the profile file, of which there can be as many as one might ever want. Here's my current default profile file:



* G3WGVFlex controller default profile
* Note: files must follow 8.3 naming convention
* See FlexFunctions.h for list of control function names

********** ENCODERS
* Encoder Shift0 & Shift1 values are the associated 
* Control number

Encoder 0
Shift0 1
Shift1 2
/Encoder

Encoder 1
Shift0 0
Shift1 3
/Encoder

Encoder 2
Shift0
Shift1
/Encoder

Encoder 3
Shift0
Shift1
/Encoder

Encoder 4
Shift0 8
Shift1 8
/Encoder

Encoder 5
Shift0
Shift1
/Encoder

Encoder 6
Shift0 4
Shift1 5
/Encoder

Encoder 7
Shift0 6
Shift1 7
/Encoder

********** CONTROLS

Control 0
Enabled Yes
Name Volume-A
Function setAudioGain
Slice 0
Shift 0
MaxValue 100
MinValue 0
StepValue 1
/Control

Control 1
Enabled Yes
Name Width-A
Function setRxFiltWidth
Slice 0
MaxValue 10000
MinValue 100
StepValue 10
/Control

Control 2
Enabled Yes
Name Shift-A
Function setRxFiltShift
Slice 0
MaxValue 2000
MinValue -2000
StepValue 10
/Control

Control 3
Enabled Yes
Name Pan-A
Function setAudioPan
Slice 0
MaxValue 100
MinValue 0
StepValue 1
/Control

Control 4
Enabled Yes
Name Volume-B
Function setAudioGain
Slice 1
MaxValue 100
MinValue 0
StepValue 1
/Control

Control 5
Enabled Yes
Name Pan-B
Function setAudioPan
Slice 1
MaxValue 100
MinValue 0
StepValue 1
/Control

Control 6
Enabled Yes
Name Width-B
Function setRxFiltWidth
Slice 1
MaxValue 10000
MinValue 100
StepValue 10
/Control

Control 7
Enabled Yes
Name Shift-B
Function setRxFiltShift
Slice 1
MaxValue 2000
MinValue -2000
StepValue 10
/Control

Control 8
Enabled Yes
Name CW-speed
Function setCwSpeed
Slice 0
MaxValue 5
MinValue 40
StepValue 1
/Control

Control 9
Enabled No
/Control

Control 10
Enabled No
/Control

Control 11
Enabled No
/Control

Control 12
Enabled No
/Control

Control 13
Enabled No
/Control

Control 14
Enabled No
/Control

Control 15
Enabled No
/Control

********** SLICES

Slice 0
Name VFO-A
/Slice

Slice 1
Name VFO-B
/Slice

Slice 2
Name Slice-3
/Slice

Slice 3
Name Slice-4
/Slice

********** VFOs

VFO 0
Enabled Yes
Name VFO-A
Slice 0
Step 5
/VFO

VFO 1
Enabled Yes
Name VFO-B
Slice 1
Step 5
/VFO

********** SWITCHES

Switch 0
Enabled No
/Switch

Switch 1
Enabled No
/Switch

Switch 2
Enabled No
/Switch

Switch 3
Enabled No
/Switch

Switch 4
Enabled Yes
Name Menu
Function swMenu
/Switch

Switch 5
Enabled No
/Switch

Switch 6
Enabled No
/Switch

Switch 7
Enabled No
/Switch

Switch 8
Enabled No
/Switch

Switch 9
Enabled No
/Switch

Switch 10
Enabled No
/Switch

Switch 11
Enabled No
/Switch

Switch 12
Enabled No
/Switch

Switch 13
Enabled No
/Switch

Switch 14
Enabled No
/Switch

Switch 15
Enabled No
/Switch

Switch 16
Enabled Yes
Name VFO-Rx
Function swVFOAReceive
/Switch

Switch 17
Enabled Yes
Name VFOA-Tx
Function swVFOATransmit
/Switch

Switch 18
Enabled Yes
Name VFOB-Rx
Function swVFOBReceive
/Switch

Switch 19
Enabled Yes
Name VFOB-Tx
Function swVFOBTransmit
/Switch

Switch 20
Enabled Yes
Name Encoder-0
Function swEncoder0
/Switch

Switch 21
Enabled Yes
Name Encoder-1
Function swEncoder1
/Switch

Switch 22
Enabled Yes
Name Encoder-2
Function swEncoder2
/Switch

Switch 23
Enabled Yes
Name Encoder-3
Function swEncoder3
/Switch

Switch 24
Enabled Yes
Name Encoder-4
Function swEncoder4
/Switch

Switch 25
Enabled Yes
Name Encoder-5
Function swEncoder5
/Switch

Switch 26
Enabled Yes
Name Encoder-6
Function swEncoder6
/Switch

Switch 27
Enabled Yes
Name Encoder-7
Function swEncoder7
/Switch




Because of the flexibility that this approach offers, we can more or less make any control perform any function. So, for example, it is logical that the push switch on the encoder should change that encoder's function but there is nothing to say that it has to be so. Any of the 28 push buttons (16 ordinary buttons, eight encoder push buttons and four Tx/Rx control buttons) can be configured to perform that, or indeed any other operation.

This approach makes the code much more complex and some parts of it have been a complete sod to debug. My excuse is that the Arduino development environment is rather poor on debugging tools, in fact nearly non existent. That's mainly because the development is done on the PC but the program is then uploaded to the Arduino for running, where there is no diagnostic function other than a serial monitor.

The idea of being able to have a completely different physical panel configuration for, say a contest and another one, perhaps, for DXpeditioning and yet another for every day DXing is an intriguing one and it will be very interesting to see how that all works out. Another cool idea is that you could have different layouts for, say left-handed and right-handed operators. I pioneered this user configuration concept many years ago in my DXpedition logging software, StarLog, so it's interesting to now be doing the same thing with hardware configuration. All the fundamentals are there now and it is encouraging to see how it is all coming together.

I think the next coding area to start on is the touch screen. I did some very early work on this, really just to demonstrate that I could see touch transactions. The idea of having a touch screen on an amateur radio transceiver is a completely new one for me. I suspect it will take some time to find the sort of things it might be useful for.

One thing I already thought about is that by touching the VFO-B area it could bring that VFO into use, or switch it back off again. Another neat trick would be to change the frequency indication to instead show the split value - useful in DXpedition pileups. I'll build a software test harness for this over the next few days and see where it gets me to.

No comments:

Post a Comment