amido Posted January 2, 2023 Share Posted January 2, 2023 (edited) I've been trying to get the ufc displays for the hornet to work for a month, but I can't, as soon as I enter the code for DCS Bios it gives me an error. how should i setup the sketch? [code] #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_Address 0x3C Adafruit_SSD1306 oled(1); #include "Wire.h" #define TCAADDR 0x70 void tcaselect(uint8_t i) { if (i > 7) return; Wire.beginTransmission(TCAADDR); Wire.write(1 << i); Wire.endTransmission(); } void setup() { oled.begin(SSD1306_SWITCHCAPVCC, OLED_Address); Wire.begin(); //Clear all the display's tcaselect(0); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(1); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(2); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(3); oled.begin(); oled.clearDisplay(); oled.display(); } void loop() { tcaselect(0); // Text to Oled display 0 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido1"); oled.setTextSize(3); oled.display(); tcaselect(1);//Text to Oled display 1 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido2"); oled.setTextSize(3); oled.display(); oled.display(); tcaselect(2);//Text to Oled display 2 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido3"); oled.setTextSize(3); oled.display(); tcaselect(3);//Text to Oled display 3 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido4"); oled.setTextSize(3); oled.display(); delay(10000); // Wait 10 sec. } [/code] Edited January 2, 2023 by amido Link to comment Share on other sites More sharing options...
Vinc_Vega Posted January 2, 2023 Share Posted January 2, 2023 (edited) Have you got a "Hello World" sample running and see if your display is working with the setup? As you only have one display in your sketch, I would change the object Adafruit_SSD1306 oled(1); into Adafruit_SSD1306 oled; Regards, Vinc Edited January 2, 2023 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
amido Posted January 3, 2023 Author Share Posted January 3, 2023 this is the one with dcs bios [code] #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_Address 0x3C Adafruit_SSD1306 oled(6); #include "Wire.h" #define TCAADDR 0x70 #include <DcsBios.h> #include <Wire.h> #define DCSBIOS_IRQ_SERIAL // imposta lcd void tcaselect(uint8_t i) { if (i > 7) return; Wire.beginTransmission(TCAADDR); Wire.write(1 << i); Wire.endTransmission(); } void setup() { oled.begin(SSD1306_SWITCHCAPVCC, OLED_Address); Wire.begin(); //Clear all the display's tcaselect(0); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(1); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(2); oled.begin(); oled.clearDisplay(); oled.display(); tcaselect(3); oled.begin(); oled.clearDisplay(); oled.display(); } void loop() { tcaselect(0); // Text to Oled display 0 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido1"); oled.setTextSize(3); oled.display(); tcaselect(1);//Text to Oled display 1 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido2"); oled.setTextSize(3); oled.display(); oled.display(); tcaselect(2);//Text to Oled display 2 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido3"); oled.setTextSize(3); oled.display(); tcaselect(3);//Text to Oled display 3 oled.begin(); oled.clearDisplay(); oled.setTextColor(WHITE); oled.setCursor(10,5); oled.println("Amido4"); oled.setTextSize(3); oled.display(); delay(10000); // Wait 10 sec. } /* paste code snippets from the reference documentation here */ DcsBios::Switch2Pos ufc1("UFC_1", 52); DcsBios::Switch2Pos ufc2("UFC_2", 53); DcsBios::Switch2Pos ufc3("UFC_3", 50); DcsBios::Switch2Pos ufc4("UFC_4", 51); DcsBios::Switch2Pos ufc5("UFC_5", 48); DcsBios::Switch2Pos ufc6("UFC_6", 49); DcsBios::Switch2Pos ufc7("UFC_7", 46); DcsBios::Switch2Pos ufc8("UFC_8", 47); DcsBios::Switch2Pos ufc9("UFC_9", 44); DcsBios::Switch2Pos ufc0("UFC_0", 45); DcsBios::Switch2Pos ufcEnt("UFC_ENT", 42); DcsBios::Switch2Pos ufcClr("UFC_CLR", 43); DcsBios::Switch2Pos ufcOs1("UFC_OS1", 41); DcsBios::Switch2Pos ufcOs2("UFC_OS2", 40); DcsBios::Switch2Pos ufcOs3("UFC_OS3", 39); DcsBios::Switch2Pos ufcOs4("UFC_OS4", 38); DcsBios::Switch2Pos ufcOs5("UFC_OS5", 37); DcsBios::Switch2Pos masterCautionResetSw("MASTER_CAUTION_RESET_SW", 36); DcsBios::LED masterCautionLt(0x7408, 0x0200, 2); DcsBios::Switch2Pos ufcAp("UFC_AP", 35); DcsBios::Switch2Pos ufcIff("UFC_IFF", 34); DcsBios::Switch2Pos ufcTcn("UFC_TCN", 33); DcsBios::Switch2Pos ufcIls("UFC_ILS", 32); DcsBios::Switch2Pos ufcDl("UFC_DL", 31); DcsBios::Switch2Pos ufcBcn("UFC_BCN", 30); DcsBios::Switch2Pos ufcOnoff("UFC_ONOFF", 29); DcsBios::Switch2Pos hudAltSw("HUD_ALT_SW", 28); DcsBios::RotaryEncoder ufcComm1ChannelSelect("UFC_COMM1_CHANNEL_SELECT", "DEC", "INC", 26, 27); DcsBios::RotaryEncoder ufcComm2ChannelSelect("UFC_COMM2_CHANNEL_SELECT", "DEC", "INC", 25, 24); DcsBios::Switch2Pos ufcComm1Pull("UFC_COMM1_PULL", 23); DcsBios::Switch2Pos ufcComm2Pull("UFC_COMM2_PULL", 22); DcsBios::Switch3Pos leftDdiCrsSw("LEFT_DDI_CRS_SW", 21, 20); DcsBios::Switch3Pos leftDdiHdgSw("LEFT_DDI_HDG_SW", 19, 18); DcsBios::LED masterModeAaLt(0x740c, 0x0200, 3); DcsBios::LED masterModeAgLt(0x740c, 0x0400, 4); DcsBios::Switch2Pos masterArmSw("MASTER_ARM_SW", 17); DcsBios::Switch2Pos masterModeAa("MASTER_MODE_AA", 16); DcsBios::Switch2Pos masterModeAg("MASTER_MODE_AG", 15); DcsBios::Switch2Pos hookLever("HOOK_LEVER", 14); DcsBios::Switch2Pos hudSymBrtSelect("HUD_SYM_BRT_SELECT", 13); DcsBios::PotentiometerEWMA<5, 128, 5> hudSymBrt("HUD_SYM_BRT", A0); DcsBios::PotentiometerEWMA<5, 128, 5> hmdOffBrt("HMD_OFF_BRT", A1); void setup() { DcsBios::setup(); } void loop() { DcsBios::loop(); } [/code] and it gives me these errors, i'm just at the beginning of the programming i'm still learning, i can't get out of it In file included from C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:7:0: C:\Users\nicola\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h: In function 'bool sendDcsBiosMessage(const char*, const char*)': C:\Users\nicola\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:160:18: error: 'tryToSendDcsBiosMessage' is not a member of 'DcsBios' while(!DcsBios::tryToSendDcsBiosMessage(msg, arg)); ^~~~~~~~~~~~~~~~~~~~~~~ C:\Users\nicola\Documents\Arduino\libraries\dcs-bios-arduino-library-master\src/DcsBios.h:160:18: note: suggested alternative: 'sendDcsBiosMessage' while(!DcsBios::tryToSendDcsBiosMessage(msg, arg)); ^~~~~~~~~~~~~~~~~~~~~~~ sendDcsBiosMessage C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino: In function 'void setup()': DCS_F18_amido_lcd:131:6: error: redefinition of 'void setup()' void setup() { ^~~~~ C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:20:6: note: 'void setup()' previously defined here void setup() ^~~~~ DCS_F18_amido_lcd:132:12: error: 'setup' is not a member of 'DcsBios' DcsBios::setup(); ^~~~~ C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:132:12: note: suggested alternative: C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:20:6: note: 'setup' void setup() ^~~~~ C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino: In function 'void loop()': DCS_F18_amido_lcd:135:6: error: redefinition of 'void loop()' void loop() { ^~~~ C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:43:6: note: 'void loop()' previously defined here void loop() ^~~~ DCS_F18_amido_lcd:136:12: error: 'loop' is not a member of 'DcsBios' DcsBios::loop(); ^~~~ C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:136:12: note: suggested alternative: C:\Users\nicola\Documents\Arduino\DCS_F18_amido_lcd\DCS_F18_amido_lcd.ino:43:6: note: 'loop' void loop() ^~~~ exit status 1 redefinition of 'void setup()' Link to comment Share on other sites More sharing options...
Vinc_Vega Posted January 3, 2023 Share Posted January 3, 2023 (edited) Edited: Okay, so you want to run four displays by multiplexing the I2C bus. That's king size programming! Failure description says that you have two SETUP and two LOOP definitions. That's what I also see within your code. Furthermore, you include the "wire" library twice. Remove the last definitions for SETUP and LOOP, remove #include <Wire.h>, put the DcsBios::setup() and DcsBios::loop() statements into the top SETUP and LOOP and try to compile. But again: Have you tried out some simpler examples? Are the displays showing anything? Have you done the tutorial for the multiplexer board to learn how to talk to your hardware? -> https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/arduino-wiring-and-test Regards, Vinc Edited January 3, 2023 by Vinc_Vega 1 Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
lesthegrngo Posted January 3, 2023 Share Posted January 3, 2023 Hi all, this is the sketch I ended up with to show the six TISL numerals for my A-10 pit, maybe it will help you with the structure #define DCSBIOS_DEFAULT_SERIAL #include <DcsBios.h> #include <Arduino.h> #include <U8g2lib.h> #include <Wire.h> #include "XBM1.h" //64x32 XBM format #define TCAADDR 0x70 void tcaselect (uint8_t i) { if (i > 7) return; Wire.beginTransmission(TCAADDR); Wire.write(1 << i); Wire.endTransmission(); } U8G2_SSD1306_64X32_1F_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); void setup() { /* void DisplayInit() { for (int i = 0; i < 7; i++) tcaselect(i);*/ DcsBios::setup(); for (int i = 0; i <= 7; i++) { tcaselect(i); u8g2.begin(); } } const unsigned char* aBitmaps[] = { //array of pointers to PROGMEM c24_0, c24_1, c24_2, c24_3, c24_4, c24_5, c24_6, c24_7, c24_8, c24_9, c24_10, c24_11, c24_12, c24_13, c24_14, c24_15, c24_16, c24_17, c24_18, c24_19 }; const unsigned char* bBitmaps[] = { //array of pointers to PROGMEM c24_0, c24_2, c24_4, c24_6, c24_8, c24_10, c24_12, c24_14, c24_16, c24_18, }; void onTislAlt1000Change(unsigned int newValue) //simpler with array index { tcaselect(2); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, bBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislAlt1000Buffer(0x1114, 0x0f00, 8, onTislAlt1000Change); void onTislAlt10000Change(unsigned int newValue) //simpler with array index { tcaselect(3); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, bBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislAlt10000Buffer(0x1112, 0xf000, 12, onTislAlt10000Change); void onTislCode1Change(unsigned int newValue) //simpler with array index { tcaselect(4); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislCode1Buffer(0x1116, 0x1f00, 8, onTislCode1Change); void onTislCode2Change(unsigned int newValue) //simpler with array index { tcaselect(5); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislCode2Buffer(0x111a, 0x1f00, 8, onTislCode2Change); void onTislCode3Change(unsigned int newValue) //simpler with array index { tcaselect(6); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislCode3Buffer(0x111e, 0x1f00, 8, onTislCode3Change); void onTislCode4Change(unsigned int newValue) //simpler with array index { tcaselect(7); //multiplex the required OLED u8g2.clearBuffer(); u8g2.drawXBMP( 0, 0, 64, 32, aBitmaps[newValue]); //direct from PROGMEM u8g2.sendBuffer(); } DcsBios::IntegerBuffer tislCode4Buffer(0x1122, 0x1f00, 8, onTislCode4Change); void loop() { DcsBios::loop(); } Cheers Les Link to comment Share on other sites More sharing options...
amido Posted January 3, 2023 Author Share Posted January 3, 2023 thanks lesthegrngo I will try by modifying your code, I hope to succeed Link to comment Share on other sites More sharing options...
amido Posted January 5, 2023 Author Share Posted January 5, 2023 ok, I'm almost there, I just have to figure out how to insert the central display of the comms. Link to comment Share on other sites More sharing options...
amido Posted March 4, 2023 Author Share Posted March 4, 2023 hello everyone, after a month of testing I managed to fix the UFC screens, but the only one I can't get to work is the screen where the radio frequency is indicated (central top) I am attaching the sketch to understand what is wrong #include <Adafruit_SSD1306.h> #include <splash.h> #define MUX_Address 0x70 // TCA9548A Encoders address #define DCSBIOS_IRQ_SERIAL #include "Wire.h" #include <U8glib.h> #include "DcsBios.h" Adafruit_SSD1306 oled(6); char* OpQue[5]; // Create Option Quing Global Array char* Dval[5]; // Create Option Display Global Array char* ScPad[3]; // Create Scratchpad Display Global Array char tmp_string[8]; // Temp string to convert numeric values to string before print to OLED display U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_FAST); // Fast I2C / TWI // Initialize I2C buses using TCA9548A I2C Multiplexer void tcaselect(uint8_t i2c_bus) { if (i2c_bus > return; Wire.beginTransmission(MUX_Address); Wire.write(1 << i2c_bus); Wire.endTransmission(); } /* paste code snippets from the reference documentation here */ /*------------------------------------ scratchpad number display --------------------------------------------*/ void onUfcScratchpadNumberDisplayChange(char* newValue) { /* your code here */ ScPad[2] = newValue; // Copy numbers into the scratchpad array at 3rd position in array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<8> ufcScratchpadNumberDisplayBuffer(0x7446, onUfcScratchpadNumberDisplayChange); /*----------------------------------- scratchpad 1st string display -----------------------------------------*/ void onUfcScratchpadString1DisplayChange(char* newValue) { /* your code here */ ScPad[0] = newValue; // Copy 1st chr into the scratchpad array at 1st position in array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<2> ufcScratchpadString1DisplayBuffer(0x744e, onUfcScratchpadString1DisplayChange); /*----------------------------------- scratchpad 2nd string display -----------------------------------------*/ void onUfcScratchpadString2DisplayChange(char* newValue) { /* your code here */ ScPad[1] = newValue; // Copy 2nd chr into scratchpad array at 2nd position in array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<2> ufcScratchpadString2DisplayBuffer(0x7450, onUfcScratchpadString2DisplayChange); /*---------------------------- Option Screen Displays ------------------------------*/ void onUfcOptionDisplay1Change(char* newValue) { /* your code here */ Dval[0] = newValue; // Copy the option screen 1 data into screen array DisplayScrn(); // Call the Display Screen function. Only needed a single // DisplayScrn() call as not all option screens will display // something when changed but option screen 1 ALWAYS changes } DcsBios::StringBuffer<4> ufcOptionDisplay1Buffer(0x7432, onUfcOptionDisplay1Change); /*---------------------------------------------------------------------------------*/ void onUfcOptionDisplay2Change(char* newValue) { /* your code here */ Dval[1] = newValue; // Copy the option screen 2 data into screen array } DcsBios::StringBuffer<4> ufcOptionDisplay2Buffer(0x7436, onUfcOptionDisplay2Change); /*--------------------------------------------------------------------------------*/ void onUfcOptionDisplay3Change(char* newValue) { /* your code here */ Dval[2] = newValue; // Copy the option screen 3 data into screen array } DcsBios::StringBuffer<4> ufcOptionDisplay3Buffer(0x743a, onUfcOptionDisplay3Change); /*-------------------------------------------------------------------------------*/ void onUfcOptionDisplay4Change(char* newValue) { /* your code here */ Dval[3] = newValue; // Copy the option screen 4 data into screen array } DcsBios::StringBuffer<4> ufcOptionDisplay4Buffer(0x743e, onUfcOptionDisplay4Change); /*-------------------------------------------------------------------------------*/ void onUfcOptionDisplay5Change(char* newValue) { /* your code here */ Dval[4] = newValue; // Copy the option screen 5 data into screen array } DcsBios::StringBuffer<4> ufcOptionDisplay5Buffer(0x7442, onUfcOptionDisplay5Change); /*--------------------------- Option Queing 1 -----------------------------------*/ void onUfcOptionCueing1Change(char* newValue) { /* your code here */ OpQue[0] = newValue; // Copy option 1 select value to option que array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<1> ufcOptionCueing1Buffer(0x7428, onUfcOptionCueing1Change); /*--------------------------- Option Queing 2 -----------------------------------*/ void onUfcOptionCueing2Change(char* newValue) { /* your code here */ OpQue[1] = newValue; // Copy option 2 select value to option que array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<1> ufcOptionCueing2Buffer(0x742a, onUfcOptionCueing2Change); /*--------------------------- Option Queing 3 -----------------------------------*/ void onUfcOptionCueing3Change(char* newValue) { /* your code here */ OpQue[2] = newValue; // Copy option 3 select value to option que array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<1> ufcOptionCueing3Buffer(0x742c, onUfcOptionCueing3Change); /*--------------------------- Option Queing 4 -----------------------------------*/ void onUfcOptionCueing4Change(char* newValue) { /* your code here */ OpQue[3] = newValue; // Copy option 4 select value to option que array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<1> ufcOptionCueing4Buffer(0x742e, onUfcOptionCueing4Change); /*--------------------------- Option Queing 5 -----------------------------------*/ void onUfcOptionCueing5Change(char* newValue) { /* your code here */ OpQue[4] = newValue; // Copy option 5 select value to option que array DisplayScrn(); // Call the Display Screen function } DcsBios::StringBuffer<1> ufcOptionCueing5Buffer(0x7430, onUfcOptionCueing5Change); /*------------------------------------------------------------------------------- The option queing changes are the " : " chr on the displays. The DisplayScrn() function needs to be called for each queing change as you are updating a Oled with data from 2 sources. You need to write the option queing value & the Display value together, if you just write the option queing value then that is all that will show on the Oled. ------------------------------ Setup Displays etc -----------------------------*/ void setup() { // Setup Starts DisplayInit(); // Initialize the displays function for the first time DcsBios::setup(); // Setup DCS specific functions } // Setup ends /*--------------------- Initialize the Displays Function ---------------------------------*/ void DisplayInit(){ // start of function for (int i = 0; i < 8; i++) { // Start of for loop to option & scratchpad screens // 0 is scratchpad 1-5 are option screens 6 and 7 is comm1 and comm2 tcaselect(i); // selects the multiplexer output for a screen starting // at 0 indexing to next screen each time through loop do { } while( u8g.nextPage() ); } // end of for loop } // end of function /* -------------------------- Main Program Loop From Here --------------------------------*/ void loop() { // Start Main Program Loop DcsBios::loop(); // run DCS Bios } // End Main Program Loop /*---------------------------------------------------------------------------------------------*/ void DisplayScrn(void) { // start of main display function for (int i = 0; i < 5; i++) { // Start of for loop to display option screens tcaselect(i+1); // Select each connected Option display on the I2C buses // " 0 " is scratchpad display hence " i+1 " to index onto the // correct bus for each Option Display screen u8g.firstPage(); do { u8g.setFont(u8g_font_helvB18); // standard nice size font for displays u8g.drawStr( 0,25,OpQue[i]); // Option selection value displayed u8g.drawStr( 15,25,Dval[i]); // Option choices displayed } while( u8g.nextPage() ); } // End of for loop to display option screens } // end of main display function u8g.begin();// Initialize displays u8g.setFont(u8g_font_helvB18); // standard nice size font for displays Link to comment Share on other sites More sharing options...
amido Posted March 9, 2023 Author Share Posted March 9, 2023 as you can see all but one work. Can anyone help me fix the arduino sketch? Link to comment Share on other sites More sharing options...
Vinc_Vega Posted March 10, 2023 Share Posted March 10, 2023 (edited) Is there a special reason not to put the last two lines within any loop? u8g.begin();// Initialize displays u8g.setFont(u8g_font_helvB18); // standard nice size font for displays I recommend to do your initializations (and the standard font) within the SETUP loop. May you point us to the top left display within your code please? Regards, Vinc Edited March 10, 2023 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
amido Posted March 10, 2023 Author Share Posted March 10, 2023 it should be one of these or all three, I attach the image. I think it's the former but I'm not sure /*------------------------------------ Visualizzazione del numero dello scratchpad --------- ------------------------------------*/ void onUfcScratchpadNumberDisplayChange(char* newValue) { /* il tuo codice qui */ ScPad[2] = newValue; // Copia i numeri nell'array dello scratchpad nella terza posizione dell'array DisplayScrn(); // Chiama la funzione Display Screen } DcsBios::StringBuffer<8> ufcScratchpadNumberDisplayBuffer(0x7446, onUfcScratchpadNumberDisplayChange); /*----------------------------------- scratchpad visualizzazione della prima stringa --------- ---------------------------------*/ void onUfcScratchpadString1DisplayChange(char* newValue) { /* qui il tuo codice */ ScPad[0] = newValue; // Copia 1st chr nell'array dello scratchpad alla 1a posizione nell'array DisplayScrn(); // Chiama la funzione Display Screen } DcsBios::StringBuffer<2> ufcScratchpadString1DisplayBuffer(0x744e, onUfcScratchpadString1DisplayChange); /*----------------------------------- scratchpad visualizzazione seconda stringa --------- ---------------------------------*/ void onUfcScratchpadString2DisplayChange(char* newValue) { /* qui il tuo codice */ ScPad[1] = newValue; // Copia il secondo chr nell'array dello scratchpad alla seconda posizione nell'array DisplayScrn(); // Chiama la funzione Display Screen } DcsBios::StringBuffer<2> ufcScratchpadString2DisplayBuffer(0x7450, onUfcScratchpadString2DisplayChange); Link to comment Share on other sites More sharing options...
amido Posted March 17, 2023 Author Share Posted March 17, 2023 Can anyone help me fix the sketch? Link to comment Share on other sites More sharing options...
No1sonuk Posted March 17, 2023 Share Posted March 17, 2023 I just did a test with a character LCD. ALL THREE of those scratchpad blocks are used. String 1 is the leftmost 2 characters, then String 2 is next to it on the right (2 characters), then the 7-character Number part comes after that. Your ScPad variable is only 3 characters long. Try 12 (2 for string1 +2 for string2 +7 for the number +1 null terminator). So change: char* ScPad[3]; // Create Scratchpad Display Global Array to: char* ScPad[12]; // Create Scratchpad Display Global Array And space the start of the sections out a bit (2 characters required for the strings. Link to comment Share on other sites More sharing options...
tc93 Posted June 25, 2023 Share Posted June 25, 2023 @amido it looks like we're trying to do the same thing. I'm about 3 months behind in progress and currently waiting for my TCA9548A to arrive, but I already managed to display texts in SkyJunky's Hornet font on the 0.92" and 2.33" OLEDs: https://github.com/michaelosthege/display-i2c-example Did you manage to fix your code in the meantime? Could you maybe put it into a GitHub project? I strongly recommend using the PlatformIO extension for VS Code. Link to comment Share on other sites More sharing options...
Recommended Posts