Register / Login  |  Desktop view  |  Jump to bottom of page

tcMenu Arduinio library » Compilation Error

Author: Andrews Branco
25/10/2020 21:21:12
Hi, first, thank you very much for the development of the project that facilitates our project.


when I compile this error, does anyone know why?


simpleU8g2_menu.h:31:105: error: 'gfx' does not name a type
extern U8G2_SSD1306_128X64_U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE); gfx;
^
exit status 1
'U8G2_SSD1306_128X64_U8G2_SH1106_128X64_NONAME_F_HW_I2C' does not name a type

Author: davetcc
25/10/2020 23:44:46
Is this the stock u8g2 example shipped with the library?

Please could you let me know the library version you have and the designer version too.

Author: Andrews Branco
26/10/2020 13:59:13
Hello, this is the example of Tcmenu (simple u8g2)

my board is ESP32 and my sh1106 oled monitor.

image


tanks


Author: Andrews Branco
26/10/2020 13:59:57
my version is: 1.5.1

https://imgur.com/2q2xcb1

Author: davetcc
26/10/2020 21:35:03
I'm at a bit of a loss as to where the error is coming from, even though we've normally compiled that example for ESP8266, there's nothing that should prevent it working with ESP32 (other than pin / device differences).

Have you tried regenerating the example, loading it into tcMenu Designer and then running the generate code option?

Everything looks good in terms of versions, on the code generator page, which display option does it show? I suspect something from 1.7 branch got into a 1.6 example somehow. I'll need to double check again tomorrow.

Author: Andrews Branco
26/10/2020 22:00:03
 
davetcc wrote:I'm at a bit of a loss as to where the error is coming from, even though we've normally compiled that example for ESP8266, there's nothing that should prevent it working with ESP32 (other than pin / device differences).

Have you tried regenerating the example, loading it into tcMenu Designer and then running the generate code option?

Everything looks good in terms of versions, on the code generator page, which display option does it show? I suspect something from 1.7 branch got into a 1.6 example somehow. I'll need to double check again tomorrow.


Hi, tanks for the answer.

so, I did one more test. this time with a simple one-item menu.

[/img]https://imgur.com/LKmu2VL[img]

https://imgur.com/LKmu2VL

what always gives the problem is the '' gfx '' from the: display variable name.




Author: davetcc
27/10/2020 06:57:02
I see, could you zip up the test sketch that you have please and attach it here. I'll take a look over it and work out what went wrong.

Apologies for this, taking quite a while to track down what has gone wrong.

Dave

Author: Andrews Branco
27/10/2020 12:22:35
davetcc I should thank you for your help.


here is the rar file with the sketch, remembering that I'm using esp32.
thank you.



I'm sorry for the bad English, I use the Google translator

Filename testetcmenu.rar
Description No description given
Filesize 9 Kbytes
Downloaded 69999 time(s)
[Disk] Download


Author: davetcc
29/10/2020 11:19:54
I'm really sorry for the delay in responding, it's been a busy week one way and another.

I was right that some artefacts of 1.7 have been accidentally merged into the release you are using. Sorry you've hit this, we are normally careful that all examples work with the same version but this one was somehow missed, if you replace the INO file with the code below it should work for you:

As 1.7 is less than a week away, it's probably not worth patching the current release.

Again sorry for the inconvenience and we'll make sure it's working in 1.7

EDIT: code adjusted slightly

===== 8< start code =======

/**
 * ESP8266 example of the *simplest* possible menu on u8g2.
 * 
 * This example shows about the most basic example possible and should be useful for anyone
 * trying to get started with either adafruit graphics or u8g2. It is missing title widgets,
 * remote capabilities, EEPROM storage and many other things but makes for the simplest
 * possible starting point for a graphical build.
 * 
 * The circuit uses a PCF8574 for the input using a rotary encoder, a common configuration.
 */

#include "simpleU8g2_menu.h"
#include 
#include 

// the width and height of the attached OLED display.
#define OLED_WIDTH 128
#define OLED_HEIGHT 64

// Here we declare the variable using exactly the name that we used in the 
// designers code generator panel for the graphics variable. The name and
// type must match exactly
U8G2_SSD1306_128X64_NONAME_F_SW_I2C gfx(U8G2_R0, 5, 4);

// this is the interrupt pin connection from the PCF8574 back to the ESP8266 board.
#define IO_INTERRUPT_PIN 12

// as we've attached the rotary encoder to an I2C PCF8574 device we need to
// declare it here. We've told the designer that we would when we set the
// switch IO device.
IoAbstractionRef io8574 = ioFrom8574(0x20, IO_INTERRUPT_PIN);

//
// In a tcMenu application, before calling setupMenu it's your responsibility to ensure
// that the display you're going to use is ready for drawing. You also need to start
// wire if you have any I2C devices. Here I start serial for some printing in the callback.
//
void setup() {
    // If you use i2c devices, be sure to start wire.
    Wire.begin();

    Serial.begin(115200);

    // start up the display. Important, the rendering expects this has been done.
    gfx.begin();

    // This is added by tcMenu Designer automatically during the first setup.
    setupMenu();

    // Note:
    // during setup in a full menu application you'd probably load values
    // back from EEPROM and maybe initialise your remote code (see other examples)
}

//
// In any IoAbstraction based application you'll normally use tasks via taskManager
// instead of writing code in loop. You are free to write code here as long as it
// does not delay or block execution. Otherwise task manager will be blocked.
//
void loop() {
    taskManager.runLoop();
}

//
// this is the callback function that we declared in the designer for action
// "Start Toasting". This will be called when the action is performed. Notice
// instead of using callbacks for every toaster setting, we just get the value
// associated with the menu item directly.
//
void CALLBACK_FUNCTION onStartToasting(int id) {
    Serial.println("Let's start toasting");
    Serial.print("Power:  "); Serial.println(menuToasterPower.getCurrentValue());
    Serial.print("Type:   "); Serial.println(menuType.getCurrentValue());
    Serial.print("Frozen: "); Serial.println(menuFrozen.getCurrentValue());
}





Register / Login  |  Desktop view  |  Jump to top of page