Jump to content

Recommended Posts

Posted

Is the address right?
The one in my control reference says :

DcsBios::LED landingGearHandleLt(0x747e, 0x0800, PIN);

Miught be a different version of DCS-BIOS, though, but worth a check.

Posted (edited)

As the Mega pins 50 to 52 may be "reserved" for ICSP connections, try another pin for output.

 

Regards, Vinc

Edited by Vinc_Vega

Regards, Vinc

real life: Royal Bavarian Airforce

online: VJS-GermanKnights.de

[sIGPIC][/sIGPIC]

  • 2 months later...
  • 2 weeks later...
Posted

good evening everyone, if I put in the arduino sketch with dcs bios, both the commands for 18 together with those of 16 work the same or do I have to upload a new sketch divided by the two modules?

thank you very much for helping

Posted
2 hours ago, amido said:

good evening everyone, if I put in the arduino sketch with dcs bios, both the commands for 18 together with those of 16 work the same or do I have to upload a new sketch divided by the two modules?

thank you very much for helping

You CAN combine modules in the same Arduino, if that's what you're asking.
I've done some experiments with using the same switches and LEDs with different aircraft.

For LEDs, you can call the same "onChange" function from different aircraft lines, like this:

#define DCSBIOS_IRQ_SERIAL
#include "DcsBios.h"

#define mcLEDpin 13

// Common light function
void onMasterCautionChange(unsigned int newValue) {
  if (newValue > 0) {
    digitalWrite (mcLEDpin, HIGH); // Turn on LED
    }
  else {
    digitalWrite (mcLEDpin, LOW);  // Turn off LED
    }
}

// A-10 call
DcsBios::IntegerBuffer masterCautionBuffer(0x1012, 0x0800, 11, onMasterCautionChange);

// F-16 call

DcsBios::IntegerBuffer lightMasterCautionBuffer(0x4476, 0x0080, 7, onMasterCautionChange);

// P-51 landing gear red light
DcsBios::IntegerBuffer landingGearRedBuffer(0x500e, 0x4000, 14, onMasterCautionChange);

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

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

I tested that code in a Nano.
On the P-51, pressing the Unsafe Landing Gear Light Test on the clickable cockpit turned on the LED.
In the same DCS session, with no reset of the Arduino, the LED responded to the A-10 Master Caution light.
I don't have the F-16 or F-18, so can't test those, but having the code in there didn't affect anything.

You'd obviously need to check for address conflicts, and I may be missing some other issues, but that works for LEDs.

After that worked, wondered if it works for switches as well, so I added this to the code above:

#define mcSWpin 2  // Added at top of code

DcsBios::Switch2Pos ufcMasterCaution("UFC_MASTER_CAUTION", mcSWpin); // A-10 Master Caution Switch
DcsBios::Switch2Pos unsafeLndGearLtTest("UNSAFE_LND_GEAR_LT_TEST", mcSWpin); // P-51 landing gear red light test switch

And now, a single switch on the Nano either activates the P-51 unsafe gear light test or the A-10 Master Caution reset depending on which aircraft you're using.

Again, same caveat that there's no conflicts in these functions, but there might be in others.

  • 1 month later...
  • 2 weeks later...
  • 2 weeks later...
  • 2 weeks later...
  • 4 weeks later...
Posted

Hi, I can't get the 0.91 inch screen to work for the F18 ufc.
this is the sketch :

#define DCSBIOS_DEFAULT_SERIAL
#include <DcsBios.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
 
#define SCREEN_WIDTH 128 // OLED display ancho en pixels
#define SCREEN_HEIGHT 32 // OLED display altura en pixels

#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

int count;
///////////////////////// SETUP //////////////////////////////////////////////////////////////

void setup() {
 count = 0;
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
 display.clearDisplay();
 display.setTextSize(1,2);
 display.setTextColor(WHITE);
 display.setCursor(0,0);
 display.cp437(true);
 display.print("N-A-12");
 display.display();

display.setTextSize(1,2);

 DcsBios::setup();
}

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

////////////////////////////Config Display ///////////////////////////////////////////////////////

String comDisplay[2];

void updateComDisplay(int changed,char* newValue) {
 comDisplay[changed] = cleanUpCom(newValue);
 display.clearDisplay();
 display.setCursor(0,0);
 display.print(comDisplay[0]);
 display.setCursor(35,0);
 display.print(comDisplay[1]);
 display.display();
}  

char* cleanUpCom(char* newValue) {
 switch (newValue[0]) {
   case '`':
     newValue[0]='1';
     break;
   case '~':
     newValue[0]='2';
     break;
 }
 return newValue;  
}

//////////////////////////////////// DISPLAY UFC F18 /////////////////////////////////////////////////////
void onUfcOptionDisplay1Change(char* newValue) {
 updateComDisplay(0, newValue);
}
DcsBios::StringBuffer<4> ufcOptionDisplay1Buffer(0x7432, onUfcOptionDisplay1Change);

 

I put the SDA and SCK contacts on the arduino mega 2560 in A5 and A4
there is something I can't understand, it doesn't give me any kind of error

Posted (edited)

ufc finished at 90%, now I'm trying to insert 0.91 inch screens.
on the left side I have the master arm with the AA and AG modes, while on the right side I have the HOOK and HMD.

20221004_140619.jpg

Edited by amido
  • 1 year later...
  • Recently Browsing   0 members

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