Update II: Making the CMD button work has been an interesting endeavour. More details at the end of the article.
This series was supposed to be a “day-by-day journey” but I finished the work on the second day (actually the fourth, but on the second and the third I spent less than half an hour top, so they don’t count). It has been surprisingly simple and enjoyable! 🙂
Day II and III, just a bit of cleaning:
This is the Mode selector; it uses 3 pins to determine which mode has been selected rather than two. As per the Channel Selector, Ali sorted the pinout.
This is one of the potential final results:
I swapped the BIT button for a micro 2-way latched switch, it controls X/Y. The two bulbs are replaced by buttons, one for toggle the TACAN in use (PLT/NFO) the other is available for other functions. Lastly, I plan to remove the light and the “shade” from the STATUS indicator and replace them with a 3V LED. I can, for instance, turn it on if the NFO has control, blink if the NFO has control and leave it off if DCS-BIOS is not working/available.
Day IV, and end of the journey. I completed the coding in one hour ish, it’s simplest I could write (so yep, pretty rubbish, you can find it in the Download page). Some features are still not implemented, such as the PLT/NFO control indicator or the HID-only mode. The first lacks a proper DCS-BIOS call (or I missed it entirely), the latter is simply not necessary for me at this stage.
I also changed plans, switching the STATUS indicator for the 2-way switch dedicated to control X/Y and restored the BIT button.
The NFO/PLT indicator (or its temporary placeholder) is now placed in the left bulb casing, and removed its gasket.
Then I moved on with the coding to write the LED logic. At moment the LED is turned on if there is communication between DCS-BIOS and the board. The timeout flag is reset by the onboard clock (it works even when the aircraft is powered down) and every time any other command is received. It is not a resilient mechanism but for now it works and prevents the board from spamming HID commands due to discrepancies between the statuses of the physical TACAN and the ones read from DCS-BIOS (or the values such variables are initiated at, in case there is no communication at all).
This is how it looks like:
The reason why I removed the gasket is having the LED projecting light towards the sides, since I planned to mount the TACAN on my right. Unfortunately I haven’t found a way to put together a support yet, so I may end up mounting it on the top-left corner of my current setup. From such angle, the LED is poorly visible, so I decided to drill a 2mm hole in the bulb casing. Please welcome the spooky laser TACAN:
The LED was way too bright though, so I covered the hole internally with a piece of red electrical tape.
This is how it looks like now, finally finished:
As I mentioned already, the temporary firmware I’m using now is available in the Download section (at some point I’ll improve it, if I find the spare time).
Later on I’ll try to record a video of the usage and post another article containing the wiring diagram, so you know what goes where, in case you decide to adapt a real life TACAN to DCS as well.
Overall, it has been a very short work, less than a dozen hours, especially thanks to Ali that worked the pinouts (thanks mate!) but I’m really happy about the result.
As you may know, the CMD button in the RIO seat is bugged if controlled by means of a joystick button. I decided therefore to circumvent the problem by means of DCS-BIOS (I left the HID functionality active, so the button ‘BT1’ should be unassigned in the DCS Control Settings). I used the following line:
DcsBios::Switch2Pos rioTacanCmdButton("RIO_TACAN_CMD_BUTTON", PIN_BT1);
The verification failed though with this error:
F-14_TACAN_v03c:107:10: error: 'Switch2Pos' in namespace 'DcsBios' does not name a type DcsBios::Switch2Pos rioTacanCmdButton("RIO_TACAN_CMD_BUTTON", PIN_BT1);
I thought it was a Servo-like problem, so I looked around and into the library folder. I found that line #109 of dcsbios.h, “#include “internal/Switches.h” was commented. A quick look at such library confirmed that it was what I needed. I removed the comments and I got a different error:
compilation terminated. exit status 1 Error compiling for board Arduino Leonardo.
Remembering that when I tested it months ago it was working, before moving to DCS-BIOS Hub, I simply solved the problem by looking for a previous version of the library and it compiled and worked flawlessly.
But I wanted to go a little deeper into the problem. A following look at the previous error message clarified the issue (gone unnoticed initially because I was in a hurry, as usual):
E:\Docs\Arduino\libraries\dcs-bios-arduino-library-0.2.18\src/internal/Switches.h:6:10: fatal error: SwitchMatrix.h: No such file or directory #include "SwitchMatrix.h"
Simple solution here, google the library name and download it. Then:
And it worked perfectly (remember to uncomment the #include in dcsbios.h!).