Trouble with Loop command

Hi All,

I am trying to send a newValue from the DCsBios library to my Duinoteck 128x64 using the U8G2 Library.

I keep getting a varity of errors with the loop line;
onUfcOptionDisplayChange() as seen in the script below.

Can anyone let me know the correct command?

/*
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"
#include "U8glib.h"
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R3, /* clock=*/ 18, /* data=*/ 16, /* CS=*/ 17, /* reset=*/ 13); // Feather HUZZAH ESP8266, E=clock=14, RW=data=13, RS=CS
/* paste code snippets from the reference documentation here */

void onUfcOptionDisplay1Change(char* newValue) {

u8g2.setFont(u8g_font_5x7);
//u8g2.setFont(u8g_font_5x7);
u8g2.drawStr( 0, 22, "newValue");
}
DcsBios::StringBuffer<4> ufcOptionDisplay1Buffer(0x542a, onUfcOptionDisplay1Change);



void setup() {



DcsBios::setup();

}
void loop(void) {
  u8g2.clearBuffer();         // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  onUfcOptionDisplay1Change(char* newValue)();  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);  
}




// rebuild the picture after some delay
//delay(50);

DcsBios:: loop();
}

Please also note that the following script works fine if I have a constant value;

*/

#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

/*
  U8g2lib Example Overview:
    Frame Buffer Examples: clearBuffer/sendBuffer. Fast, but may not work with all Arduino boards because of RAM consumption
    Page Buffer Examples: firstPage/nextPage. Less RAM usage, should work with all Arduino boards.
    U8x8 Text Only Example: No RAM usage, direct communication with display controller. No graphics, 8x8 Text only.
    
*/
U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R3, /* clock=*/ 18, /* data=*/ 16, /* CS=*/ 17, /* reset=*/ 13); // Feather HUZZAH ESP8266, E=clock=14, RW=data=13, RS=CS
// Please UNCOMMENT one of the contructor lines below
// U8g2 Contructor List (Frame Buffer)
// The complete list is available here: https://github.com/olikraus/u8g2/wiki/u8g2setupcpp
// Please update the pin numbers according to your setup. Use U8X8_PIN_NONE if the reset pin is not connected

//U8G2_KS0108_ERM19264_F u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*dc=*/ 17, /*cs0=*/ 14, /*cs1=*/ 15, /*cs2=*/ 16, /* reset=*/  U8X8_PIN_NONE); 	// Set R/W to low!
//U8G2_ST7920_192X32_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18, /*cs=*/ U8X8_PIN_NONE, /*dc=*/ 17, /*reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_192X32_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_128X64_F_8080 u8g2(U8G2_R0, 8, 9, 10, 11, 4, 5, 6, 7, /*enable=*/ 18 /* A4 */, /*cs=*/ U8X8_PIN_NONE, /*dc/rs=*/ 17 /* A3 */, /*reset=*/ 15 /* A1 */);	// Remember to set R/W to 0 
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 18 /* A4 */ , /* data=*/ 16 /* A2 */, /* CS=*/ 17 /* A3 */, /* reset=*/ U8X8_PIN_NONE);
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7920_128X64_F_SW_SPI u8g2(U8G2_R0, /* clock=*/ 14, /* data=*/ 13, /* CS=*/ 15, /* reset=*/ 16); // Feather HUZZAH ESP8266, E=clock=14, RW=data=13, RS=CS
//U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, /* CS=*/ 10, /* reset=*/ 8);
//U8G2_ST7920_128X64_F_HW_SPI u8g2(U8G2_R0, /* CS=*/ 15, /* reset=*/ 16); // Feather HUZZAH ESP8266, E=clock=14, RW=data=13, RS=CS



// End of constructor list


  
void Draw(void){
  u8g2.setFont(u8g2_font_ncenB08_tr);  // choose a suitable font
  u8g2.drawStr( 0, 22, "TEST");
  u8g2.drawStr( 0, 42, "Try Again");
 
}

void setup(void) {
  u8g2.begin();
  
}

void loop(void) {
  u8g2.clearBuffer();					// clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr);	// choose a suitable font
  Draw();	// write something to the internal memory
  u8g2.sendBuffer();					// transfer internal memory to the display
  delay(1000);  
}

No such function. Do you mean onUfcOptionDisplay1Change?

Please post the complete error messages.

Steve

Yes I do Steve and thanks. The error message is;

too few arguments to function 'void onUfcOptionDisplay1Change(char*)'

What is the meaning of the 2nd paranthesis pair after "newValue) at
onUfcOptionDisplay1Change(char* newValue)(); // write something to the internal memory

The complete error message also lists ths file that contains the error, the line number where the compiler sees the error and other information . There is a button in the IDE that allows you to copy the error message labled “Copy Error Message” at the bottom right of the IDE window.

Hi Rud and Ground,

Thanks.

The () imitate the code that I posted that works. This line in the loop is;

Draw()

I have changed the loop code to

void loop(void) {
  u8g2.clearBuffer();         // clear the internal memory
  u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
  onUfcOptionDisplay1Change();  // write something to the internal memory
  u8g2.sendBuffer();          // transfer internal memory to the display
  delay(1000);  
}

And the error message I get is;

Arduino: 1.8.9 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"


 ^

Using library dcs-bios-arduino-library-0.2.11 at version 0.2.10 in folder: C:\Users\Mark\Documents\Arduino\libraries\dcs-bios-arduino-library-0.2.11 
Using library U8glib at version 1.19.1 in folder: C:\Users\Mark\Documents\Arduino\libraries\U8glib 
Using library arduino_836894 at version 2.26.14 in folder: C:\Users\Mark\Documents\Arduino\libraries\arduino_836894 
Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI 
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire 
exit status 1
too few arguments to function 'void onUfcOptionDisplay1Change(char*)'

Thanks for trying to help me on this.

Hi All,

Worked it all out myself.

Regards