Jump to content

Recommended Posts

Posted (edited)

Hi,

 

I've nearly finished my cockpit controls, and I'm debugging some issues. I have an problem with controlling the A10-C ILS volume with a rotary encoder.... I've found pots to be noisy on my earlier panels, so opted for rotary's for later panels. The TACAN volume works fine on a rotary, and using the DCS Bios Debug tool, I can see the code being output, but the ILS volume isn't actually changing in-game...

 

y4mR7yXsfW0lpT9iW30j3XWonL0Mu2V9l5aowX-bRF2iu6pNN6pgYR6Q_-8xK2Hw-j6Qo0qPQ48gV2THrdS0-oSddzyS4SOU2BHelFP7otmfpjtypNtyCWfB8qxCUEDjpj6ohqgJVOm17iGc8Khyb4OhMbh4lzgvksXbGCSOYrqqNLNSTKz1m4mDuL8EEw4-77ZM0edOrJprTLIZIVzxKiCcQ?width=1060&height=748&cropmode=none

 

It's probably something really simple I've overlooked, but I'm hoping a second (or third, or fourth) will see what I can't! Here's my code, ILS volume is on line 78. Thanks in advance.

 

/*
 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_IRQ_SERIAL

#include <DcsBios.h>
#include <SPI.h>
#include <Wire.h>
#include <grove_alphanumeric_display.h>

/*Alpha Numeric Display Setup*/
Seeed_Digital_Tube tube;

/* TACAN */
DcsBios::RotaryEncoder tacan10("TACAN_10", "DEC", "INC", A2, A3);
DcsBios::RotaryEncoder tacan1("TACAN_1", "DEC", "INC", A5, A6);
DcsBios::RotaryEncoder tacanMode("TACAN_MODE", "DEC", "INC", A0, A1);
DcsBios::RotaryEncoder tacanVol("TACAN_VOL", "-6500", "+6500", A7, A8);
DcsBios::ActionButton tacanXyToggle("TACAN_XY", "TOGGLE", A4);
/*Tacan Display*/
void onTacanModeChange(unsigned int newValue) {
 if (newValue==0) {
   digitalWrite(15, HIGH);
   digitalWrite(16, LOW);
   digitalWrite(17, LOW);
   digitalWrite(18, LOW);
   digitalWrite(19, LOW);
}
 if (newValue==1) {
   digitalWrite(15, LOW);
   digitalWrite(16, HIGH);
   digitalWrite(17, LOW);
   digitalWrite(18, LOW);
   digitalWrite(19, LOW);
}
 if (newValue==2) {
   digitalWrite(15, LOW);
   digitalWrite(16, LOW);
   digitalWrite(17, HIGH);
   digitalWrite(18, LOW);
   digitalWrite(19, LOW);
}
 if (newValue==3) {
   digitalWrite(15, LOW);
   digitalWrite(16, LOW);
   digitalWrite(17, LOW);
   digitalWrite(18, HIGH);
   digitalWrite(19, LOW);
}
 if (newValue==4) {
   digitalWrite(15, LOW);
   digitalWrite(16, LOW);
   digitalWrite(17, LOW);
   digitalWrite(18, LOW);
   digitalWrite(19, HIGH);
}
}
DcsBios::IntegerBuffer tacanModeBuffer(0x1168, 0x000e, 1, onTacanModeChange);

void onTacanChannelChange(char* newValue) {
 tube.clearBuf();
 tube.displayString(newValue,0);
 tube.display();
}
DcsBios::StringBuffer<4> tacanChannelBuffer(0x1162, onTacanChannelChange);


/* ILS */
DcsBios::RotaryEncoder ilsMhz("ILS_MHZ", "DEC", "INC", A10, A9);
DcsBios::RotaryEncoder ilsKhz("ILS_KHZ", "DEC", "INC", A12, A11);
DcsBios::ActionButton ilsPwrToggle("ILS_PWR", "TOGGLE", A15);
DcsBios::RotaryEncoder ilsVol("ILS_VOL", "-6500", "+6500", A14, A13);
DcsBios::LED ilsPwr1(0x1168, 0x0010, 36);


/* CMSP */
DcsBios::RotaryEncoder cmspBrt("CMSP_BRT", "-3200", "+3200", 22, 24);
DcsBios::Switch3Pos cmspDisp("CMSP_DISP", 51, 28);
DcsBios::Switch3Pos cmspJmr("CMSP_JMR", 50, 52);
DcsBios::Switch3Pos cmspMws("CMSP_MWS", 46, 48);
DcsBios::Switch3Pos cmspRwr("CMSP_RWR", 47, 49);
DcsBios::Switch2Pos cmspJtsn("CMSP_JTSN", 53);
DcsBios::Switch2Pos cmspRtn("CMSP_RTN", 26);
DcsBios::Switch3Pos cmspUpdn("CMSP_UPDN", 32, 30);

/* CMSC */
DcsBios::Switch2Pos cmscJmr("CMSC_JMR", 35);
DcsBios::Switch2Pos cmscMws("CMSC_MWS", 27);
DcsBios::Switch2Pos cmscPri("CMSC_PRI", 29);
DcsBios::Switch2Pos cmscSep("CMSC_SEP", 31);

/* Electrical Power */
DcsBios::Switch2Pos eppBatteryPwr("EPP_BATTERY_PWR", 37);
DcsBios::Switch3Pos eppInverter("EPP_INVERTER", 41, 39);
DcsBios::Switch2Pos eppApuGenPwr("EPP_APU_GEN_PWR", 43);
DcsBios::Switch2Pos eppAcGenPwrL("EPP_AC_GEN_PWR_L", 44);
DcsBios::Switch2Pos eppAcGenPwrR("EPP_AC_GEN_PWR_R", 45);

/* MISC */
DcsBios::Switch2Pos oxySupply("OXY_SUPPLY", 42);
DcsBios::Switch2Pos aapEgipwr("AAP_EGIPWR", 40);
DcsBios::Switch2Pos aapCdupwr("AAP_CDUPWR", 38);

void setup() {
 DcsBios::setup();
 pinMode(15, OUTPUT);
 pinMode(16, OUTPUT);
 pinMode(17, OUTPUT);
 pinMode(18, OUTPUT);
 pinMode(19, OUTPUT);
 digitalWrite(15, HIGH);
 
 tube.setTubeType(TYPE_4,TYPE_4_DEFAULT_I2C_ADDR);
 tube.setBrightness(6);
 tube.setBlinkRate(BLINK_OFF);
   
 tube.clearBuf();
 tube.setTubeSingleNum(FIRST_TUBE,8);
 tube.setTubeSingleNum(SECOND_TUBE,8);
 tube.setTubeSingleNum(THIRD_TUBE,8);
 tube.setTubeSingleChar(FOURTH_TUBE,'X');
 tube.setPoint(false,false);
 tube.display();
 
 delay(1000);
  
 tube.clearBuf();
 tube.display();
 
}

void loop() {
 DcsBios::loop();
 delay(5);
}

Edited by CorporalCarrot
Posted

I can't see anything wrong with your code.

If you have an excessive delay() in your main loop(), that could cause issues with rotary encoders, but then the message would not be sent in the first place.

 

 

Try installing the latest version of DCS-BIOS (v0.8.2), that comes with a working interactive control reference documentation out of the box.

Go to the ILS_VOL knob on the A-10C, increase the slider value a bit (the volume knob needs larger increments than 3200 to work), and see if the knob turns in your virtual cockpit.

I just tried that on my machine and had no issues.

Posted

Thanks for your reply, Ian.

 

I've tried the latest version of DCS Bios and it seems to be working ok now... I've not figured out the hub yet (I tried using it, after following the setup instructions, but it didn't work). I guess I missed a step of something, but I should probably be able to figure it out!

 

I used the web interface and I could control the ILS volume with it, so rebooted with my panels, using socat and it works...! No other change in my code or anything. It's working and I can live with it being a mystery for now!

 

Thanks, I guess installing the new version of DCS bios sorted it? I ran the installer but didn't copy any script files, and the files for DCS bios in the saved games script folder is still date stamped from when I installed it ages ago (version 0.7 or something).

 

Cheers,

 

Dave.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...