Encoder rotatif avec DCS BIOS et Arduino
Publié : dim. avr. 03, 2022 7:49 pm
Salut
J'ai besoin d'un petit coup de main je viens de faire des modif de ma console droite et centrale de mon pit en ajoutant une arduino dans chaque.
Tout fonctionne correctement sauf les encoders rotatifs du Select Comm1 et Select Comm2. quand je tourne cela fonctionne pas régulièrement voir des fois plus du tout c'est complétement aléatoire. Je vous mets mon code ci dessous en espérant que quelqu'un à la solution
J'utilise la dernière version de DCS Bios
/*
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"
/* 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);
/* 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::Switch2Pos spinRecoverySw("SPIN_RECOVERY_SW", 24);
/* STBY INSTRUMENTS */
DcsBios::RotaryEncoder stbyPressAlt("STBY_PRESS_ALT", "-3200", "+3200", 26, 27);
DcsBios::RotaryEncoder saiSet("SAI_SET", "-3200", "+3200", 28, 29);
DcsBios::Switch2Pos saiCage("SAI_CAGE", 30);
/* UFC EFD */
DcsBios::PotentiometerEWMA<5, 128, 5> ufcBrt("UFC_BRT", A4);
DcsBios::RotaryEncoder ufcComm1ChannelSelect("UFC_COMM1_CHANNEL_SELECT", "DEC", "INC", 31, 22);
DcsBios::Switch2Pos ufcComm1Pull("UFC_COMM1_PULL", 32);
DcsBios::PotentiometerEWMA<5, 128, 5> ufcComm1Vol("UFC_COMM1_VOL", A6);
DcsBios::RotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", 36, 34);
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::RotaryEncoder ifeiUpBtn("IFEI_UP_BTN", "DEC", "INC", 41, 42);
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();
}
J'ai besoin d'un petit coup de main je viens de faire des modif de ma console droite et centrale de mon pit en ajoutant une arduino dans chaque.
Tout fonctionne correctement sauf les encoders rotatifs du Select Comm1 et Select Comm2. quand je tourne cela fonctionne pas régulièrement voir des fois plus du tout c'est complétement aléatoire. Je vous mets mon code ci dessous en espérant que quelqu'un à la solution
J'utilise la dernière version de DCS Bios
/*
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"
/* 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);
/* 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::Switch2Pos spinRecoverySw("SPIN_RECOVERY_SW", 24);
/* STBY INSTRUMENTS */
DcsBios::RotaryEncoder stbyPressAlt("STBY_PRESS_ALT", "-3200", "+3200", 26, 27);
DcsBios::RotaryEncoder saiSet("SAI_SET", "-3200", "+3200", 28, 29);
DcsBios::Switch2Pos saiCage("SAI_CAGE", 30);
/* UFC EFD */
DcsBios::PotentiometerEWMA<5, 128, 5> ufcBrt("UFC_BRT", A4);
DcsBios::RotaryEncoder ufcComm1ChannelSelect("UFC_COMM1_CHANNEL_SELECT", "DEC", "INC", 31, 22);
DcsBios::Switch2Pos ufcComm1Pull("UFC_COMM1_PULL", 32);
DcsBios::PotentiometerEWMA<5, 128, 5> ufcComm1Vol("UFC_COMM1_VOL", A6);
DcsBios::RotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", 36, 34);
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::RotaryEncoder ifeiUpBtn("IFEI_UP_BTN", "DEC", "INC", 41, 42);
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();
}