Corvidae Posted August 1, 2023 Posted August 1, 2023 (edited) Currently trying to get my rotary encoder to work with the Harrier, specifically the UFC radio channel encoder. It works in the sim, but it jumps four channels every time I turn it going from M to 4 to 8 etc. Wondering if it's an issue with the code or maybe the encoder itself. Here's the code: /* Tell DCS-BIOS to use a serial connection and use interrupt-driven communication. The main program will be interrupted to prioritize processing incoming data. This should work on any Arduino that has an ATMega328 controller (Uno, Pro Mini, many others). */ #define DCSBIOS_IRQ_SERIAL #include "DcsBios.h" DcsBios::RotaryEncoder ufcCom1Sel("UFC_COM1_SEL", "-3200", "+3200", 4, 7); /* paste code snippets from the reference documentation here */ void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } Edited August 1, 2023 by Corvidae
outbaxx Posted August 1, 2023 Posted August 1, 2023 Can’t remember exactly but try to change the 3200 value to something smaller, 1600 and see what happens.
Corvidae Posted August 2, 2023 Author Posted August 2, 2023 10 hours ago, outbaxx said: Can’t remember exactly but try to change the 3200 value to something smaller, 1600 and see what happens. I've tried that, no luck sadly
Vinc_Vega Posted August 2, 2023 Posted August 2, 2023 (edited) Looks like your rotary goes four steps per detent (from M to 4 to 8). Try to set the DcsBios command to one step per detent. Here are references, but I haven't tried it yet: https://github.com/DCSFlightpanels/dcs-bios-arduino-library/wiki/RotaryEncoder Regards, Vinc Edited August 2, 2023 by Vinc_Vega 1 Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Corvidae Posted August 2, 2023 Author Posted August 2, 2023 2 hours ago, Vinc_Vega said: Working perfectly, thank you!
Recommended Posts