Back slaving over a fast computer this evening, I've been cogitating about how the panel will be configured. Ideally, every control on the panel can be software configured to perform any function (within reason - it wouldn't make much sense configuring a push button switch as the main VFO!). To do this needs various interconnected data structures and would make a neat database application if the controller were running on a PC. In this case there is no database, so it has to be done from first principles.
There are eight Encoders, each of which can have two control states by use of its built in push-button. There are thus up to 16 "things" that we can control. Each encoder is mapped to the required control via a lookup table, which is where the ability to reconfigure the panel is implemented.
There are thus 16 controls, each of which will have a number of attributes:
- Name (so it can be referenced on screen, etc.)
- Enabled/disabled
- Current value
- Maximum value
- Minimum value
- Step up/down per "click"
- Update flags
- Owner slice (a slice is effectively a complete Rx/Tx. The Flex 6500 has four)
- Flex control function (what we actually want to do to the Flex radio)
With this general layout in mind I could turn my mind to devising a profile file layout. Purists will say that this ought to be in XML or JSON or some such but this is not going anywhere else, so a simple text file will suffice. At the moment I am editing the file manually but in the fullness of time I would expect to be able to construct profiles from the controller in some way. Maybe. The file is held on a micro SD card that plugs into the Arduino system. Slight overkill: the SD card is 16GB and the profile files will be about 4kB each. I will probably find some other stuff to stick on there...
Next, I devised the data structures that will be required by the Arduino to do its thing. The profile file is used to set these structures, effectively mapping physical controls to a Flex control function. This bit has taken a few iterations and I am not certain that it is optimised yet. Whilst the Adruino Due has a reasonable amount of program/data space (512kB) I do not have the luxury of being able to have inefficient data structures.
This evening I've written the code to read in the profile file and set the data structures accordingly. Yet to do, is to join all these bits up in code, so this particular encoder commands that specific Flex function. A job for tomorrow.
For now I have only dealt with the eight encoders. I'll let this settle down and get the bugs (of which I suspect there will be many!) fixed before tackling the push-button logic. My intention is that the buttons should similarly be a "soft" as possible.
Getting this part of the design right is an important step towards achieving a truly configurable panel.
No comments:
Post a Comment