[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.

Designer on Mac -- U8G2 issue RSS feed
Forum Index » tcMenu Designer UI
Author Message
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Hi Dave. Yeah, as soon as I made that post .... I realized there were two sets of generated files. Cleaned it up and unchecked the "src" box.

I'm presently compiling with Wire.begin() and the pins specified in the UMF file. I'll try it your way.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Maybe we need a new option in 2.2 to move all (or at least some of the variables in the menu.cpp/h definition file into a namespace. With a warning that this is an advanced feature requiring an understanding of namespaces.

Then even if you had a variable/function called display elsewhere you could access the generated one through a namespace:

myapp::display
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
I have to say that after looking at the U8G2 code and conditional blocks for ESP32, I would have expected everything to work by passing in SDA and SCL to the U8G2 constructor.

However, that did not seem as reliable as calling Wire.begin(....) upfront, and if I'm honest, I'm not really sure why.
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
So frustrating!

The toaster example compiles and works perfectly with the display. It's got 5/4 listed for the pins in Designer, and Software I2C. Calls Wire.begin() with no options.

Interestingly, my display appears to be on 26/29 (SDA to D22, SDA to D21). Replacing that in Designer and/or Wire.begin() ... still no display with your test code.

What could I possibly be doing wrong?
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Agreed, there's nothing worse than trying to get something like this working.

Let me try and mirror your situation later, connecting the display on the standard SDA and SCL pins. I'll feedback once I've done that.

Another option:

What you can also do, is you can also use the custom U8G2 plugin, where you define the U8G2 variable yourself as a global variable, and initialise the display before setupMenu() is called, and then just provide the name of the variable during code generation. It works well for cases when the quick start doesn't work.
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
I've just wired to the standard SDA and SCL pins (21/22). I've got a fairly standard I2C SH1106 64 line hardware display from AZ delivery.

My setup was a follows:

void setup() {
    Serial.begin(115200);
    Wire.begin();
    setupMenu();
}


My properties are as the attached image. Don't forget that when using software I2C the latency reduction option should not be ticked (we added a warning that it's for hardware I2C only).

Something to bear in mind, once you call Wire.begin() it is no longer possible to adjust the pins in future, for that reason I recommend calling Wire.begin as soon as possible in setup(). See https://github.com/espressif/arduino-esp32/blob/a618fc1361b08aa968407dd81b7b065cca207f46/libraries/Wire/src/Wire.cpp#L72

EDIT: also note that in the original example I had picked 21 as my switch pin, I have moved that now to 37 in the latest example to avoid a clash.
[Thumb - rename-display-variable2.jpg]
 Filename rename-display-variable2.jpg [Disk] Download
 Description shows the settings that work for me with default I2C pins
 Filesize 72 Kbytes
 Downloaded:  50753 time(s)

ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
I'm using the Advanced version. I'm pretty sure I've been at this point, ran into a problem and then tried the Simple...

I've got the global:

U8G2_SH1106_128X64_NONAME_F_HW_I2C gfx(U8G2_R0, U8X8_PIN_NONE, U8X8_PIN_NONE, U8X8_PIN_NONE);

And in setup():
Wire.begin();
gfx.begin();
setupMenu();

renderer.setResetCallback(onMenuBeingReset);
renderer.setResetIntervalTimeSeconds(MENU_TIMEOUT);
renderer.takeOverDisplay(welcome);

The welcome() function worked on all other display types. For some reason, I'm getting nothing on the LCD screen until I press the OK button on the encoder, then I'm presented with a menu. After the timeout, the display goes blank again.

I've confirmed the takeover function is getting invoked via serial logging.

The welcome() function is pretty simple -- stuff like this.

gfx.clearDisplay();
display_struct.updateTop = false;
display_struct.updateBottom = false;
gfx.setCursor(0, 0);
gfx.print("Welcome");
gfx.display();
delay(5000);
gfx.clearDisplay();

I don't think this is a bug. I'm just on the struggle bus with this particular display..
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
Can you try

gfx.sendBuffer();


Instead of

gfx.display()


As you are using full-frame I think this is needed. Worth a try at any rate as it's a quick change.
ScubaSteve


Joined: May 14, 2021
Messages: 30
Offline
Ah ha! That was it. Thank you, Dave!!!

I still think there's something awry with the Simple stuff, I just don't know what or where.

=)
davetcc


Joined: Jan 19, 2019
Messages: 686
Offline
No problem.

On the U8G2 quick start option, I've tried every option that I can on ESP32, NanoBLE, and also on ESP8266.

* ESP32: I've tried HW_I2C on both regular and non-standard pins. I've tried with the yield flag enabled and disabled.
* ESP8266: I've tried both HW (yield in both states) and SW modes (yield off)
* Nano: I've tried HW mode (yield in both states)
 
Forum Index » tcMenu Designer UI
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.