[Logo] TCC discussion forum
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Top Downloads] Top Downloads   [Groups] Back to home page 
[Register] Register /  [Login] Login 


This forum is read only and new users cannot register, please ask all new questions either using GitHub discussions, or in Arduino forum tagging @davetcc.

Compilation Error RSS feed
Forum Index » tcMenu Arduinio library
Author Message
Andrews Branco


Joined: Oct 25, 2020
Messages: 5
Offline
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
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
Andrews Branco


Joined: Oct 25, 2020
Messages: 5
Offline
Hello, this is the example of Tcmenu (simple u8g2)

my board is ESP32 and my sh1106 oled monitor.

image


tanks

Andrews Branco


Joined: Oct 25, 2020
Messages: 5
Offline
my version is: 1.5.1

https://imgur.com/2q2xcb1
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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.
Andrews Branco


Joined: Oct 25, 2020
Messages: 5
Offline
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.



davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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
Andrews Branco


Joined: Oct 25, 2020
Messages: 5
Offline
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 [Disk] Download
 Description No description given
 Filesize 9 Kbytes
 Downloaded:  69999 time(s)

davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
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());
}

 
Forum Index » tcMenu Arduinio library
Go to:   
Mobile view
Powered by JForum 2.7.0 © 2020 JForum Team • Maintained by Andowson Chang and Ulf Dittmer

This site uses cookies to analyse traffic, serve ads by Google AdSense (non-personalized in EEA/UK), and to record consent. We also embed Twitter, Youtube and Disqus content on some pages, these companies have their own privacy policies.

Our privacy policy applies to all pages on our site

Should you need further guidance on how to proceed: External link for information about cookie management.