lesthegrngo Posted September 11, 2023 Posted September 11, 2023 (edited) All, I notice that in game, when I have been checking out the warning panel, there are a couple of mismatches. I have set the lights to function using BoboBears debugger, and they are set correctly according to that. However in game, when the APU GEN light should be flashing (and is on screen), on the actual panel the STALL SYS light is flashing. I can correct that, it looks like the last two lines are inverted on my sketch. However, when the L-OIL PRESS and R-OIL PRESS should be illuminating, on the screen the L-ENG HOT and R-ENG HOT lights are flashing, and the correct lights are flashing on the actual panel! So in game it looks like lines 5 and 6 are inverted, and my sketch has it correct. ****EDIT**** Pitch Sys and Yaw Sys lights are also correct in game but reversed on the output Does anyone else see that? Les Edited September 11, 2023 by lesthegrngo
No1sonuk Posted September 11, 2023 Posted September 11, 2023 I'm using a 3.5" TFT for my mini-CWP, and mine seems to be correct. Have you checked the addresses and masks are correct?
lesthegrngo Posted September 12, 2023 Author Posted September 12, 2023 I use a MAX7219 chip with a matrix using this sketch, which was derived from one that was posted on here some years ago //#define DCSBIOS_IRQ_SERIAL //#define DCSBIOS_DEFAULT_SERIAL #define DCSBIOS_RS485_SLAVE 60 #define TXENABLE_PIN 2 #include <DcsBios.h> #include <LedControl.h> LedControl lc=LedControl(11,13,10,1);//DIN,CLK,LOAD,# OF IC's unsigned char cl_row_map[48] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 5, 5, 5, 5, //4, 4, 4, 4, 4, //5 }; #define SEG_DP (1<<7) #define SEG_A (1<<6) #define SEG_B (1<<5) #define SEG_C (1<<4) #define SEG_D (1<<3) #define SEG_E (1<<2) #define SEG_F (1<<1) #define SEG_G (1<<0) unsigned char cl_mask_map[48]= { SEG_C, SEG_D, SEG_F, SEG_A, SEG_C, SEG_D, SEG_F, SEG_A, SEG_C, SEG_D, SEG_F, SEG_A, SEG_C, SEG_D, SEG_F, SEG_A, SEG_C, SEG_D, SEG_F, SEG_A, SEG_C, SEG_D, SEG_F, SEG_A, SEG_B, SEG_E, SEG_G, SEG_DP, SEG_B, SEG_E, SEG_G, SEG_DP, SEG_B, SEG_E, SEG_G, SEG_DP, SEG_B, SEG_E, SEG_G, SEG_DP, SEG_B, SEG_E, SEG_G, SEG_DP, SEG_B, SEG_E, SEG_G, SEG_DP, }; unsigned char max7219_rows[8]; void setup() { DcsBios::setup(); memset(max7219_rows, 0xff, sizeof(max7219_rows)); lc.shutdown(0,false); //turn on the display lc.setIntensity(0,15);//set the brightness lc.clearDisplay(0); //clear rthe display and get ready for new data } void updateCautionLights(unsigned int address, unsigned int data) { unsigned char clp_row = (address - 0x10d4) * 2; unsigned char start_index = clp_row * 4; unsigned char column = 0; unsigned char i; bool is_on; for (i=0; i<16; i++) { is_on = data & 0x01; // set caution light state (clp_row, column, is_on) if (is_on) { max7219_rows[cl_row_map[start_index+i]] |= cl_mask_map[start_index+i]; } else { max7219_rows[cl_row_map[start_index+i]] &= ~(cl_mask_map[start_index+i]); } data >>= 1; column++; if (column == 4) { clp_row++; column = 0; } } } void onClpData1Change(unsigned int newValue) { updateCautionLights(0x10d4, newValue); } DcsBios::IntegerBuffer clpData1(0x10d4, 0xffff, 0, onClpData1Change); void onClpData2Change(unsigned int newValue) { updateCautionLights(0x10d6, newValue); } DcsBios::IntegerBuffer clpData2(0x10d6, 0xffff, 0, onClpData2Change); void onClpData3Change(unsigned int newValue) { updateCautionLights(0x10d8, newValue); } DcsBios::IntegerBuffer clpData3(0x10d8, 0xffff, 0, onClpData3Change); void loop() { DcsBios::loop(); // update MAX7219 unsigned char i; for (i=0; i<8; i++) { lc.setRow(0, i, max7219_rows[i]); } } Now, where the following parts came from I don't know, they don't show up on that Bort thing void onClpData1Change(unsigned int newValue) { updateCautionLights(0x10d4, newValue); } DcsBios::IntegerBuffer clpData1(0x10d4, 0xffff, 0, onClpData1Change); void onClpData2Change(unsigned int newValue) { updateCautionLights(0x10d6, newValue); } DcsBios::IntegerBuffer clpData2(0x10d6, 0xffff, 0, onClpData2Change); void onClpData3Change(unsigned int newValue) { updateCautionLights(0x10d8, newValue); } DcsBios::IntegerBuffer clpData3(0x10d8, 0xffff, 0, onClpData3Change); By changing the individual callouts I can manage the sketch to make my panel show the same as the game, however the one that confuses me is that when oil pressure drops to zero in-game, instead of the on screen cockpit L-OIL PRESS and R-OIL PRESS lights illuminating, you get the L-ENG HOT and R-ENG HOT lights on the in-game display. That's just incorrect, the in game CWP should have the oil pressure lights flashing. It's an OCD thing! Les
No1sonuk Posted September 12, 2023 Posted September 12, 2023 Oh. So it's a bug with DCS itself? Report it for bug fixing.
Vinc_Vega Posted September 12, 2023 Posted September 12, 2023 (edited) Hi Les, although I changed the cl_mask_map to my matrix design, the code is still working for me and I can't confirm the flipped cautious. Checked with the latest open beta of the A-10C II. Spoiler #define DCSBIOS_IRQ_SERIAL #include <DcsBios.h> #include <LedControl.h> //pin 10 is connected to the DataIn //pin 11 is connected to the CLK //pin 12 is connected to LOAD LedControl lc=LedControl(10,11,12,1);//DIN,CLK,LOAD,# OF IC's // variables to dimm by the LCP "SIGNAL LTS" switch (BRT / DIM) byte BRT = 11; // normal brightnes byte DIM = 3; // dimmed byte BOOT = 15; // LED brightnes after panel booting unsigned long boottime = 125; unsigned char cl_row_map[48] = { 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, }; #define SEG_DP (1<<7) #define SEG_A (1<<6) #define SEG_B (1<<5) #define SEG_C (1<<4) #define SEG_D (1<<3) #define SEG_E (1<<2) #define SEG_F (1<<1) #define SEG_G (1<<0) unsigned char cl_mask_map[48]= { SEG_DP, SEG_B, SEG_D, SEG_F, SEG_DP, SEG_B, SEG_D, SEG_F, SEG_DP, SEG_B, SEG_D, SEG_F, SEG_DP, SEG_B, SEG_D, SEG_F, SEG_DP, SEG_B, SEG_D, SEG_F, SEG_DP, SEG_B, SEG_D, SEG_F, SEG_A, SEG_C, SEG_E, SEG_G, SEG_A, SEG_C, SEG_E, SEG_G, SEG_A, SEG_C, SEG_E, SEG_G, SEG_A, SEG_C, SEG_E, SEG_G, SEG_A, SEG_C, SEG_E, SEG_G, SEG_A, SEG_C, SEG_E, SEG_G }; unsigned char max7219_rows[8]; void setup() { DcsBios::setup(); memset(max7219_rows, 0xff, sizeof(max7219_rows)); lc.shutdown(0,false); //turn on the display lc.setIntensity(0,BOOT);//set the brightness bootsequence(); // let's light up some LEDs :-) lc.shutdown(0,true); //turn off the display } void updateCautionLights(unsigned int address, unsigned int data) { lc.shutdown(0,false); //turn on the display unsigned char clp_row = (address - 0x10d4) * 2; unsigned char start_index = clp_row * 4; unsigned char column = 0; unsigned char i; bool is_on; for (i=0; i<16; i++) { is_on = data & 0x01; // set caution light state (clp_row, column, is_on) if (is_on) { max7219_rows[cl_row_map[start_index+i]] |= cl_mask_map[start_index+i]; } else { max7219_rows[cl_row_map[start_index+i]] &= ~(cl_mask_map[start_index+i]); } data >>= 1; column++; if (column == 4) { clp_row++; column = 0; } } } void onClpData1Change(unsigned int newValue) { updateCautionLights(0x10d4, newValue); } DcsBios::IntegerBuffer clpData1(0x10d4, 0xffff, 0, onClpData1Change); void onClpData2Change(unsigned int newValue) { updateCautionLights(0x10d6, newValue); } DcsBios::IntegerBuffer clpData2(0x10d6, 0xffff, 0, onClpData2Change); void onClpData3Change(unsigned int newValue) { updateCautionLights(0x10d8, newValue); } DcsBios::IntegerBuffer clpData3(0x10d8, 0xffff, 0, onClpData3Change); // dimm the whole CLP matrix by the LCP "SIGNAL LTS" switch void onLcpSignalLightsChange(unsigned int newValue) { if (newValue == 1) lc.setIntensity(0,BRT); else lc.setIntensity(0,DIM); } DcsBios::IntegerBuffer lcpSignalLightsBuffer(0x1144, 0x0200, 9, onLcpSignalLightsChange); void loop() { DcsBios::loop(); // update MAX7219 unsigned char i; for (i=0; i<8; i++) { lc.setRow(0, i, max7219_rows[i]); } } void bootsequence() //---------Boot sequence of the display ---------- { delay(boottime); lc.setLed(0,0,0,true); delay(2000); lc.setLed(0,1,1,true); delay(5000); lc.setLed(0,0,0,false); delay(1000); lc.setLed(0,1,1,false); lc.clearDisplay(0); } // -------End of display Boot sequence Regards, Vinc Edited September 12, 2023 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Recommended Posts