DCS-Skunkworks / dcs-bios

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

AH-64D CMWS display elements possible? #111

Closed virtual812 closed 2 years ago

virtual812 commented 2 years ago

We have a situation where it would be advantageous to have the chaff / flare and graphical elements of the warning display exported.

I can imagine this might be a little unusual, and assumed to be not desired, but I wonder if the data is there in DCS for the getting, or anything we could relate directly to the on screen warning elements.

Our fall-back is to use a display export, but we'd prefer not to.

Bonus question, we previously had the PVI800 LED display able to be delivered by BIOS with strings, but the strings did not include the decimals... for our application i had a friend re-include the decimals dependant on when and where they were needed in the arduino itself, but it punished the hardware a little. Is there a way we can get the string with the decimals already included before it's sent from the PC?

Also, side question, as I'm not familiar around code, i wonder if there is a reference from DCS that shows what can be exported. How do you guys figure that out? Asking so as it might save me asking similar questions in future.

WarLord211 commented 2 years ago

display export is i think the easiest solution.

for the PVI800 LED i can take a look. is this also AH-64D and what do you need exactly? (i dont know the plane very much)

no finding exports ia always digging in the game lua files of the plane. Switches and lights should be all included.

WarLord211 commented 2 years ago

i assume for the PVI you mean the KA-50. and with decimals you mean apostrophe ` (english is not my main)

There readouts for them a example PVI_LINE1_APOSTROPHE1

virtual812 commented 2 years ago

There readouts for them a example PVI_LINE1_APOSTROPHE1

This is it, the Ka-50

The original DCS BIOS we used had the APOSTROPHEs as seperate on / off I think intended for an LED. We are using a HMI (Human Machine Interface) LCD display called a Nextion https://nextion.tech/ With this we can embed the graphics and fonts into the display and make it a touch screen whilst communicating with the display with an Arduino. We have done it already, and found we quite like this way of doing things in some cases. The issue we encountered with the PVI 800 is that BIOS asumes we will use 7 segment LED displays and will light the apostrophes separately. The Nextion however lets us display a string of text directly, but because the apostrophes are not embedded in the string and on Nextion we can't display apostrophes above the existing text without the solid colour background blocking the text behind we ended up with a crazy solution a friend helped put together in the arduino to combine the apostrophe into the text string where necessary.

No problem with your language, happy to work with you, we very much appreciate you taking the time.

I will try to find the the Nextion / Arduino DCS BIOS solution i have put away and see if i can get a video demo up on Youtube.

virtual812 commented 2 years ago

Nextion PVI-800 output Nextion-A-10C_CDU Here are 2 examples of what we have achieved so far. It's working, and the one display auto switches with the Start Meta Data to the appropriate cockpit. Problem is that ultimately we're going to run tight on space and need to streamline as best we can.

I'm not very good with code, have had some help with this. The PVI-800 apostrophe code i was assisted with is as follows if it means anything to you...

//Following code for Ka-50 module
//Code by Borden to deal with apostrophes.... Legend!
void writeText(char* boxname, char *text, bool ap1, bool ap2) {

  //             Vin         
  // 1 2 3 4 5 6 X
  // 
  //                 Vout
  // 1 2 3 ' 4 5 ' 6 X

  char pvifinal[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 };

  char* in = text;
  char* out = pvifinal;
  for(int i = 0; i < 3; i++) {
    if(*in == 0) {
      myNex.writeStr(boxname, pvifinal);
      return;
    }

    *out = *in;    
    in++;
    out++;
  }

  if (ap1) {
    *out = '\'';
    out++;
  }

  for(int i = 0; i < 2; i++) {
    if(*in == 0) {
      myNex.writeStr(boxname, pvifinal);
      return;
    }

    *out = *in;
    in++;
    out++;
  }

  if (ap2) {
    *out = '\'';
    out++;
  }

  if(*in == 0) {
    myNex.writeStr(boxname, pvifinal);
    return;
  }

  *out = *in;
  myNex.writeStr(boxname, pvifinal);
}

void onPviLine1Apostrophe1Change(char* newValue) {
    pvil1a1 = newValue[0] == '\'';
    writeText("pvil1txt.txt", pvil1, pvil1a1, pvil1a2);
}
void onPviLine1Apostrophe2Change(char* newValue) {
    pvil1a2 = newValue[0] == '\'';
    writeText("pvil1txt.txt", pvil1, pvil1a1, pvil1a2);
}
void onPviLine1SignChange(char* newValue) {
    myNex.writeStr("pvisign1.txt", newValue);
}
void onPviLine1TextChange(char* newValue) {
  strcpy(pvil1, newValue); 
  writeText("pvil1txt.txt", pvil1, pvil1a1, pvil1a2);
}
void onPviLine1PointChange(char* newValue) {
    myNex.writeStr("pvil1pt.txt", newValue);
}
void onPviLine2Apostrophe1Change(char* newValue) {
    pvil2a1 = newValue[0] == '\'';
    writeText("pvil2txt.txt", pvil2, pvil2a1, pvil2a2);
}
void onPviLine2Apostrophe2Change(char* newValue) {
    pvil2a2 = newValue[0] == '\'';
    writeText("pvil2txt.txt", pvil2, pvil2a1, pvil2a2);
}
void onPviLine2SignChange(char* newValue) {
    myNex.writeStr("pvisign2.txt", newValue);
}
void onPviLine2TextChange(char* newValue) {
  strcpy(pvil2, newValue);
  writeText("pvil2txt.txt", pvil2, pvil2a1, pvil2a2);
}
void onPviLine2PointChange(char* newValue) {
    myNex.writeStr("pvil2pt.txt", newValue);
}

DcsBios::StringBuffer<1> pviLine1Apostrophe1Buffer(0x1934, onPviLine1Apostrophe1Change);
DcsBios::StringBuffer<1> pviLine1Apostrophe2Buffer(0x1936, onPviLine1Apostrophe2Change);
DcsBios::StringBuffer<1> pviLine1SignBuffer(0x1920, onPviLine1SignChange);
DcsBios::StringBuffer<6> pviLine1TextBuffer(0x1924, onPviLine1TextChange);
DcsBios::StringBuffer<1> pviLine1PointBuffer(0x1930, onPviLine1PointChange);
DcsBios::StringBuffer<1> pviLine2PointBuffer(0x1932, onPviLine2PointChange);
DcsBios::StringBuffer<1> pviLine2Apostrophe1Buffer(0x1938, onPviLine2Apostrophe1Change);
DcsBios::StringBuffer<1> pviLine2Apostrophe2Buffer(0x193a, onPviLine2Apostrophe2Change);
DcsBios::StringBuffer<1> pviLine2SignBuffer(0x1922, onPviLine2SignChange);
DcsBios::StringBuffer<6> pviLine2TextBuffer(0x192a, `onPviLine2TextChange);
charliefoxtwo commented 2 years ago

Jumping in on this, I'll investigate but given that similar things are done with the F-18 IFEI it might be possible to export via dcs-bios.

charliefoxtwo commented 2 years ago

PR up which should add everything you need for the CMWS display #112