Jump to content

DCS-BIOS Discussion Thread


FSFIan

Recommended Posts

2 hours ago, Vinc_Vega said:

As far as I know, you may use normal code like

DcsBios::LED masterCaution(0x1012, 0x0800, A0);

Regards, Vinc

Awesome, cheers 🙂 

Two more questions.. 😁

Is it possible to Code a panel to work with more than one module? So you can code pin 2 to work for gear up on f18 & then add another line that says pin 2 is also gear up on another plane? 

 

And I can't seem to find a reference in the DCS bios reference lookup codes for throttle fingerlifts. I wanted to have a 2 way toggle for left and right to switch from cut to idle. 


Edited by MarkBLN
Link to comment
Share on other sites

2 hours ago, MarkBLN said:

Awesome, cheers 🙂 

Two more questions.. 😁

Is it possible to Code a panel to work with more than one module? So you can code pin 2 to work for gear up on f18 & then add another line that says pin 2 is also gear up on another plane? 

On the first question: Yes - This would work:

DcsBios::Switch2Pos ufcMasterCaution("UFC_MASTER_CAUTION", 2);  // A-10C / A-10CII Master Caution Reset

DcsBios::Switch2Pos masterCaution("MASTER_CAUTION", 2);  // F-16 Master Caution Reset

DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 2);  // FA-18 Master Caution Reset

You have to be careful, though - The arduino would send all three commands (in quotes) in sequence, so you need to make sure there's no conflicts that would cause problems.  If two aircraft use the same command, you only need the line once. e.g.

DcsBios::Switch2Pos gearLever("GEAR_LEVER", 3);  // A-10C, A-10CII

DcsBios::Switch2Pos gearHandle("GEAR_HANDLE", 3); // F-16

DcsBios::Switch2Pos gearLever("GEAR_LEVER", 3);  // FA-18 - NOT REQUIRED AS SAME AS A-10C

In this case, the third line isn't required because it's the same as the first.  It would actually give a compile error if it's left in there.

Reading LED, etc. statuses could be tricky.  That uses addresses, so you'd need to test each case individually to make sure there are no conflicts.

  • Thanks 1
Link to comment
Share on other sites

3 hours ago, MarkBLN said:

Awesome, cheers 🙂 

Two more questions.. 😁

<snip>

And I can't seem to find a reference in the DCS bios reference lookup codes for throttle fingerlifts. I wanted to have a 2 way toggle for left and right to switch from cut to idle. 

 

On the second question (Throttle lifts):
DCS-BIOS doesn't handle some of the controls, so you'd need some form of HID device, e.g. the "right kind of Arduino" if you want to automate some of that.
An arduino Pro Micro or Leonardo can be made to act as a HID as they have the 32u4 processor, NOT the 328 "normal" arduinos have.

In this case, you could manually read the switch and send joystick button signals.
You CAN do this in the same device as DCS-BIOS.
Look here for an example:

 

  • Thanks 1
Link to comment
Share on other sites

Thank you for the help. I'm using a mega though so that workaround sadly won't work. I hoped there might be a way to trigger keypresses via dcs bios as a workaround with the Mega, but sadly not it would seem. 


Edited by MarkBLN
  • Like 1
Link to comment
Share on other sites

Hello aviators!

I'm brand new to the forum and I hope you can help me. I bought the F18 Hornet IFEI Jettison Display Controller from TekCreation.

Now it is the first panel with DCS Bios. I downloaded and installed the DCS Bios Hub. Unfortunately, there is no clear statement where to install it or whether more needs to be installed. But according to the dashboard, he is in contact with the virtual cockpit. Only the IFEI and the LEDs show nothing. I'm a complete newbie when it comes to bios. Maybe someone can help me there.

Thanks in advance.

 

Link to comment
Share on other sites

Did you get the HUB version, or Flightpanels version of the panel?

They often use different addresses, so might not be compatible. 

Additionally, you need the scripts/DCS-BIOS folder and export.lua (don't remember the exact names) in the saved games folder for DCS.

Link to comment
Share on other sites

Hello No1sonuk!

I got the USB ready panel: https://tekcreations.space/product/f18-hornet-ifei-jettison-display-controller-preorder/

The DCs Bios: https://github.com/dcs-bios/dcs-bios/releases/tag/v0.10.0

The problem is that I don't understand what needs to be installed WHERE?

According to tekcreation I only need DCS BIOS. https://tekcreations.space/f18-ifei-v2-instructions/ WHERE is my mistake?

Thanks

Link to comment
Share on other sites

When you run the Hub installer, it does it for you.
On the Tek Creations link, there's another to the DCS-BIOS Hub installation instructions.

I don't remember exactly what happens with the install, and I don't use Hub any more as it's woefully out of date.
It looks like they created their own Hub plug-in too.

Link to comment
Share on other sites

So I finally got my panel built and wired up and just doing the code now with DCS bios and the mega. I went to upload but I am getting some errors. If I post the code here can someone have a look and see what the errors are? I am totally clueless so would appreciate any help with this.

 

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

/* paste code snippets from the reference documentation here */

/* PIN 2 */
DcsBios::ActionButton selJettBtn("SEL_JETT_BTN", "1", 2);

/* PIN 3, 4, 5, 6, 7 */
const byte selJettKnobPins[5] = {3, 4, 5, 6, 7};
DcsBios::SwitchMultiPos selJettKnob("SEL_JETT_KNOB", selJettKnobPins, 5);

/* PIN 8 */
DcsBios::Switch2Pos ldgTaxiSw("LDG_TAXI_SW", 8);

/* PIN 9, 10 */
DcsBios::Switch3Pos flapSw("FLAP_SW", 9, 10);

/* PIN 11 */
DcsBios::Switch2Pos gearLever("GEAR_LEVER", 11);

/* PIN 12 */
DcsBios::Switch2Pos launchBarSw("LAUNCH_BAR_SW", 12);

/* PIN 13 */
DcsBios::Switch2Pos antiSkidSw("ANTI_SKID_SW", 13);

/* PIN 14 */
DcsBios::Switch2Pos hookBypassSw("HOOK_BYPASS_SW", 14);

/* PIN 15 */
DcsBios::LED selJettBtn(0x7480, 0x0100, 15);

/* PIN 16 */
DcsBios::LED flpLgRightGearLt(0x7430, 0x2000, 16);

/* PIN 17 */
DcsBios::Switch2Pos pitotHeatSw("PITOT_HEAT_SW", 17);

/* PIN 18, 19 */
DcsBios::Switch3Pos engAntiiceSw("ENG_ANTIICE_SW", 18, 19);

/* PIN 20, 21 */
DcsBios::Switch3Pos wshieldAntiIceSw("WSHIELD_ANTI_ICE_SW", 20, 21);

/* PIN 22 */
DcsBios::Switch2Pos hookLever("HOOK_LEVER", 22);

/* PIN 23, 24 */
DcsBios::Switch3Pos cockkpitLightModeSw("COCKKPIT_LIGHT_MODE_SW", 23, 24);

/* PIN 25, 26 */
DcsBios::Switch3Pos probeSw("PROBE_SW", 25, 26);

/* PIN 27, 28 */
DcsBios::Switch3Pos extWngTankSw("EXT_WNG_TANK_SW", 27, 28);

/* PIN 29, 30 */
DcsBios::Switch3Pos extCntTankSw("EXT_CNT_TANK_SW", 29, 30);

/* PIN 31 */
DcsBios::ActionButton fuelDumpSw("FUEL_DUMP_SW", "1", 31);

/* PIN 32, 33 */
DcsBios::Switch3Pos flirSw("FLIR_SW", 32, 33);

/* PIN 34 */
DcsBios::ActionButton ltdRSw("LTD_R_SW", "1", 34);

/* PIN 35 */
DcsBios::Switch2Pos lstNflrSw("LST_NFLR_SW", 35);

/* PIN 36, 37 */
DcsBios::Switch3Pos strobeSw("STROBE_SW", 36, 37);

/* PIN 38, 39, 40 */
const byte radarSwPins[4] = {38, 39, 40};
DcsBios::SwitchMultiPos radarSw("RADAR_SW", radarSwPins, 3);

/* PIN 41, 42, 43, 44 */
const byte insSwPins[8] = {41, 42, 43, 44};
DcsBios::SwitchMultiPos insSw("INS_SW", insSwPins, 4);

/* PIN 45 */
DcsBios::Switch2Pos gainSwitch("GAIN_SWITCH", 45);

/* PIN 46 */
DcsBios::ActionButton fcsResetBtn("FCS_RESET_BTN", "1", 46);

/* PIN 47, 48 */
DcsBios::Switch3Pos batterySw("BATTERY_SW", 47, 48);

/* PIN 49 */
DcsBios::ActionButton apuControlSw("APU_CONTROL_SW", "1", 49);

/* PIN 50, 51 */
DcsBios::Switch3Pos engineCrankSw("ENGINE_CRANK_SW", 51, 50);

/* PIN 52 */
DcsBios::Switch2Pos obogsSw("OBOGS_SW", 52);

/* PIN A0 */
DcsBios::Potentiometer hmdOffBrt("HMD_OFF_BRT", A0);

/* PIN A1 */
DcsBios::Potentiometer floodDimmer("FLOOD_DIMMER", A1);

/* PIN A2 */
DcsBios::Potentiometer instPnlDimmer("INST_PNL_DIMMER", A2);

/* PIN A3 */
DcsBios::Potentiometer consolesDimmer("CONSOLES_DIMMER", A3);

/* PIN A4 */
DcsBios::Potentiometer formationDimmer("FORMATION_DIMMER", A4);

/* PIN A5 */
DcsBios::Potentiometer positionDimmer("POSITION_DIMMER", A5);

/* PIN A6 */
DcsBios::LED fuelDumpSw(0x74b4, 0x0100, A6);

/* PIN A7 */
DcsBios::LED batterySw(0x74c4, 0x1800, A7);

/* PIN A8 */
DcsBios::LED apuControlSw(0x74c2, 0x0100, A8);

/* PIN A9 */
DcsBios::ActionButton fuelDumpSw("FUEL_DUMP_SW", "0", A9);

/* PIN A10 */
DcsBios::ActionButton ltdRSw("LTD_R_SW", "0", A10);

/* PIN A11 */
DcsBios::LED ltdRSw(0x74c8, 0x4000, A11);

/* PIN A12 */
DcsBios::ActionButton apuControlSw("APU_CONTROL_SW", "0", A12);

/* PIN A13 */
void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A13);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);

/* PIN A14 */
void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A14);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);

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

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

 

These are the errors I am getting...

 

C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:41:24: error: conflicting declaration 'DcsBios::LED selJettBtn'
 DcsBios::LED selJettBtn(0x7480, 0x0100, 15);
                        ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:16:23: note: previous declaration as 'DcsBios::ActionButton selJettBtn'
 DcsBios::ActionButton selJettBtn("SEL_JETT_BTN", "1", 2);
                       ^~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:130:24: error: conflicting declaration 'DcsBios::LED fuelDumpSw'
 DcsBios::LED fuelDumpSw(0x74b4, 0x0100, A6);
                        ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:71:23: note: previous declaration as 'DcsBios::ActionButton fuelDumpSw'
 DcsBios::ActionButton fuelDumpSw("FUEL_DUMP_SW", "1", 31);
                       ^~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:133:23: error: conflicting declaration 'DcsBios::LED batterySw'
 DcsBios::LED batterySw(0x74c4, 0x1800, A7);
                       ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:100:21: note: previous declaration as 'DcsBios::Switch3Pos batterySw'
 DcsBios::Switch3Pos batterySw("BATTERY_SW", 47, 48);
                     ^~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:136:26: error: conflicting declaration 'DcsBios::LED apuControlSw'
 DcsBios::LED apuControlSw(0x74c2, 0x0100, A8);
                          ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:103:23: note: previous declaration as 'DcsBios::ActionButton apuControlSw'
 DcsBios::ActionButton apuControlSw("APU_CONTROL_SW", "1", 49);
                       ^~~~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:139:33: error: redefinition of 'DcsBios::ActionButton fuelDumpSw'
 DcsBios::ActionButton fuelDumpSw("FUEL_DUMP_SW", "0", A9);
                                 ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:71:23: note: 'DcsBios::ActionButton fuelDumpSw' previously declared here
 DcsBios::ActionButton fuelDumpSw("FUEL_DUMP_SW", "1", 31);
                       ^~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:142:29: error: redefinition of 'DcsBios::ActionButton ltdRSw'
 DcsBios::ActionButton ltdRSw("LTD_R_SW", "0", A10);
                             ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:77:23: note: 'DcsBios::ActionButton ltdRSw' previously declared here
 DcsBios::ActionButton ltdRSw("LTD_R_SW", "1", 34);
                       ^~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:145:20: error: conflicting declaration 'DcsBios::LED ltdRSw'
 DcsBios::LED ltdRSw(0x74c8, 0x4000, A11);
                    ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:77:23: note: previous declaration as 'DcsBios::ActionButton ltdRSw'
 DcsBios::ActionButton ltdRSw("LTD_R_SW", "1", 34);
                       ^~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:148:35: error: redefinition of 'DcsBios::ActionButton apuControlSw'
 DcsBios::ActionButton apuControlSw("APU_CONTROL_SW", "0", A12);
                                   ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:103:23: note: 'DcsBios::ActionButton apuControlSw' previously declared here
 DcsBios::ActionButton apuControlSw("APU_CONTROL_SW", "1", 49);
                       ^~~~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino: In function 'void onEngineCrankSwChange(unsigned int)':
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:154:6: error: redefinition of 'void onEngineCrankSwChange(unsigned int)'
 void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A14);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);
      ^~~~~~~~~~~~~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:151:6: note: 'void onEngineCrankSwChange(unsigned int)' previously defined here
 void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A13);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);
      ^~~~~~~~~~~~~~~~~~~~~
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino: At global scope:
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:154:149: error: redefinition of 'DcsBios::IntegerBuffer engineCrankSwBuffer'
 void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A14);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);
                                                                                                                                                     ^
C:\Users\marka\Documents\Arduino\F18Panel\F18Panel.ino:151:130: note: 'DcsBios::IntegerBuffer engineCrankSwBuffer' previously declared here
 void onEngineCrankSwChange(unsigned int newValue) {DcsBios::LED engineCrankSwBuffer(0x74c2, 0x0600, A13);}DcsBios::IntegerBuffer engineCrankSwBuffer(0x74c2, 0x0600, 9, onEngineCrankSwChange);
                                                                                                                                  ^~~~~~~~~~~~~~~~~~~

exit status 1

Compilation error: conflicting declaration 'DcsBios::LED selJettBtn'

 

Link to comment
Share on other sites

6 minutes ago, lesthegrngo said:

I don't believe that you can have 'selJettBtn' as both a switch and an LED, you have to have different terms or references for each

Cheers

 

Les

But the first was an input and the second was an output. Does that not work?

Link to comment
Share on other sites

1 hour ago, MarkBLN said:

But the first was an input and the second was an output. Does that not work?

In the places they're used, they're function class name declarations. They have to be unique.
BUT, they're not fixed in the code. You CAN rename them.
e.g.

/* PIN 2 */
DcsBios::ActionButton selJettBtn("SEL_JETT_BTN", "1", 2);

//
//
//

/* PIN 15 */
DcsBios::LED selJettBtnLED(0x7480, 0x0100, 15);

Note "LED" added to the end of the second one.  It could easily be a number, but "LED" is more indicative of its function.

Link to comment
Share on other sites

15 minutes ago, No1sonuk said:

In the places they're used, they're function class name declarations. They have to be unique.
BUT, they're not fixed in the code. You CAN rename them.
e.g.

/* PIN 2 */
DcsBios::ActionButton selJettBtn("SEL_JETT_BTN", "1", 2);

//
//
//

/* PIN 15 */
DcsBios::LED selJettBtnLED(0x7480, 0x0100, 15);

Note "LED" added to the end of the second one.  It could easily be a number, but "LED" is more indicative of its function.

Ah ok. I thought the name had to reference exactly so as it knows which switch I'm referring to. 

Link to comment
Share on other sites

9 minutes ago, MarkBLN said:

Ah ok. I thought the name had to reference exactly so as it knows which switch I'm referring to. 

No.  The part INSIDE the parenthesis ( e.g. "SEL_JETT_BTN" ) is the part that has to be as it is in the control reference.
That's the message that gets sent to DCS with the parameters.

Link to comment
Share on other sites

That seemed to help with getting almost no errors now. The only 2 lines I am still having issues with are the last 2. What I wanted to do was have an LED illuminate when the engine start switch if engaged and held in position in the sim, and then the LED goes out when the engine has started and the switch in the cockpit returns automatically to the middle position.

This was a poor man's solution to magnetic switches. So I am using a 3 way momentary switch instead of a latched switch. So I press the toggle in one direction, the light illuminates to show the engine is starting, then the light goes out when the engine is running and the switch in game returns to the neitral position. 😆

I am struggling to find out what code to put in to get this to work though.

Then the final thing I wanted to do was as follows.. (dunno if it is possible though?)..

I have a backlit momentary push button for the selective jettison button. What I wanted to do was have the led in that button to be lit all the time, EXCEPT when the jett selector switch is set to SAFE. Then the button light goes out. 

Is that possible?

Link to comment
Share on other sites

You can't put the "DcsBios::LED" thing inside the other functions.
The "onEngineCrankSwChange" function returns the position of the crank switch - 0,1, or 2.
You should use that and read the value, then turn on or off the LEDs as appropriate using digitalWrite in a switch / case function.

24 minutes ago, MarkBLN said:

I have a backlit momentary push button for the selective jettison button. What I wanted to do was have the led in that button to be lit all the time, EXCEPT when the jett selector switch is set to SAFE. Then the button light goes out. 

Is that possible?

Yes.  Do the same as with the crank switch, but just turn on the LED for every position except SAFE.

Link to comment
Share on other sites

OR:

void onSelJettKnobChange(unsigned int newValue) {

  if (newValue = 1) { digitalWrite(LEDpin, LOW); } // 1 is the value for SAFE

  else { digitalWrite(LEDpin, HIGH); }

}
DcsBios::IntegerBuffer selJettKnobBuffer(0x7480, 0x0e00, 9, onSelJettKnobChange);

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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