DCS-Skunkworks / dcs-bios

Data export tool for DCS.
https://dcsbios.com/
GNU General Public License v3.0
290 stars 65 forks source link

F/A18C: UFC selector Comm2 out #485

Closed Coolands closed 11 months ago

Coolands commented 1 year ago

Hello, Since the version changes of DCS 2.8 and 2.9 I lost the command Select channel comm2 while my encoder and good and I checked on my arduino everything is well connected . I don’t understand why? here is my arduino code

`/* Tell DCS-BIOS to use a serial connection and use the default Arduino Serial library. This will work on the vast majority of Arduino-compatible boards, but you can get corrupted data if you have too many or too slow outputs (e.g. when you have multiple character displays), because the receive buffer can fill up if the sketch spends too much time updating them.

If you can, use the IRQ Serial connection instead. */

define DCSBIOS_DEFAULT_SERIAL

include "DcsBios.h"

typedef DcsBios::RotaryEncoderT<POLL_EVERY_TIME, DcsBios::FOUR_STEPS_PER_DETENT> FourStepRotaryEncoder; // A custom rotary encoder with four quadrature steps per physical detent.

/ MASTER ARM / DcsBios::LED masterModeAaLt(0x740c, 0x0200, 53); DcsBios::LED masterModeAgLt(0x740c, 0x0400, 52); DcsBios::Switch2Pos masterArmSw("MASTER_ARM_SW", 51, true); DcsBios::Switch2Pos masterModeAa("MASTER_MODE_AA", 48); DcsBios::Switch2Pos masterModeAg("MASTER_MODE_AG", 49);

/ EMERGENCY JETTISON / DcsBios::Switch2Pos emerJettBtn("EMER_JETT_BTN", 50, true);

/ MAP GAIN/SPIN RECOVERY PANEL / DcsBios::PotentiometerEWMA<5, 128, 5> hmdOffBrt("HMD_OFF_BRT", A7); DcsBios::Switch3Pos irCoolSw("IR_COOL_SW", 25, 23); DcsBios::LED spinLt(0x742a, 0x0800, 47); DcsBios::SwitchWithCover2Pos spinRecovery("SPIN_RECOVERY_SW", "SPIN_RECOVERY_COVER", 24);

/ STBY INSTRUMENTS / FourStepRotaryEncoder stbyPressAlt("STBY_PRESS_ALT", "-3200", "+3200", 26, 27); FourStepRotaryEncoder saiSet("SAI_SET", "-3200", "+3200", 28, 29); DcsBios::Switch2Pos saiCage("SAI_CAGE", 30);

/ UFC EFD / FourStepRotaryEncoder ufcComm1ChannelSelect("UFC_COMM1_CHANNEL_SELECT", "DEC", "INC", 31, 22); FourStepRotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", 36, 34); DcsBios::PotentiometerEWMA<5, 128, 5> ufcBrt("UFC_BRT", A4); DcsBios::Switch2Pos ufcComm1Pull("UFC_COMM1_PULL", 32); DcsBios::PotentiometerEWMA<5, 128, 5> ufcComm1Vol("UFC_COMM1_VOL", A6); DcsBios::Switch2Pos ufcComm2Pull("UFC_COMM2_PULL", 33); DcsBios::PotentiometerEWMA<5, 128, 5> ufcComm2Vol("UFC_COMM2_VOL", A5);

/ HUD PANEL / DcsBios::PotentiometerEWMA<5, 128, 5> hudAoaIndexer("HUD_AOA_INDEXER", A2); DcsBios::PotentiometerEWMA<5, 128, 5> hudSymBrt("HUD_SYM_BRT", A3);

/ IFEI EFD / DcsBios::Switch2Pos ifeiModeBtn("IFEI_MODE_BTN", 43); DcsBios::ActionButton ifeiUpBtnToggle("IFEI_UP_BTN", "TOGGLE", 41); DcsBios::Switch2Pos ifeiEtBtn("IFEI_ET_BTN", 44); / EFD GO NOGO + RESET / DcsBios::LED lhAdvGo(0x740a, 0x0010, 40); DcsBios::LED lhAdvNoGo(0x740a, 0x0020, 39); DcsBios::Switch2Pos hudVideoBit("HUD_VIDEO_BIT", 38);

void setup() { DcsBios::setup(); }

void loop() { DcsBios::loop(); }`

charliefoxtwo commented 1 year ago

I just tested with 2.9 and the latest version of BIOS and everything seems to be working for me.

I don't use the Arduino integration at all, but what troubleshooting steps have you tried? Does the comm 1 encoder work? If so, the first thing I'd suggest is swapping the pins for comm1 and comm2 to verify that your other encoder does in fact work, like so:

FourStepRotaryEncoder ufcComm1ChannelSelect("UFC_COMM1_CHANNEL_SELECT", "DEC", "INC", 36, 34);
FourStepRotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", 31, 22);

If you do this and then your comm 2 encoder works (successfully controlling the comm 1 channel select) and your comm 1 encoder doesn't (when attempting to control the comm 2 channel select), we can rule out your hardware as the issue.

The other thing I'm curious about is your FourStepRotaryEncoder. Have you verified that the code suggested by the reference tool doesn't work? Again I'm not super familiar with the Arduino side of things so maybe it's fine, but still worth checking.

DcsBios::RotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", PIN_A, PIN_B);
Coolands commented 1 year ago

Thank you for taking the time to respond. Indeed when I put the rotary encoder on the Comm1 instead of the comm2 I have the same problem so I will look at the material side. For FourStepRotaryEncoder I had found at the time this trick that prevents impulse jumps at the time of rotations and it works great. I can’t remember which forum. Thanks again