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

tcMenu Designer UI » Designer on Mac -- U8G2 issue

Author: ScubaSteve
01/06/2021 23:39:16
Greetings.

Running 2.1.3. I've been trying out different display types, and have consistently had to add the line:

U8G2_SH1106_128X64_NONAME_F_HW_I2C gfx(U8G2_R0, U8X8_PIN_NONE);

... or similar ... to *_menu.cpp. It's missing.

Adding it results in a compilation, although the display doesn't seem to work. The example stuff works fine. I can't even take the UMF file from the example and apply it to an empty sketch ... I'll research that once the _menu issue is resolved... am hoping they're related.

Author: davetcc
02/06/2021 01:52:32
Agree this doesn’t sound right. It sounds like there’s a bad match pattern in the plug-in.

Can you let me know the board and I’ll try generating something similar from scratch myself on that hardware.

Author: ScubaSteve
02/06/2021 02:10:18
 
davetcc wrote:Agree this doesn’t sound right. It sounds like there’s a bad match pattern in the plug-in.

Can you let me know the board and I’ll try generating something similar from scratch myself on that hardware.


Hi Dave.

Yes, totally. It's an ESP32. You may need to move around between different display types in order for it to appear. Or, I can send you my Designer file.

Author: davetcc
02/06/2021 07:11:44
So before even trying to run anything, just looking at the plugin, I noticed a couple of things:

1. The simple case of HW_I2C had been missed completely, I'm adding it in now. After that, I'll test it in a new project and add the zip of it here.

2. the "simple" plugin was trying to handle all the complex cases! It was trying to handle the 2nd interface cases, and special named display cases, these have now been removed. Left are all the standard NONAME cases for every display in basic configurations. Anyone else (mainly advanced users) can use the full u8g2 plugin where they declare the variable themselves.


Author: ScubaSteve
02/06/2021 11:32:12
 
davetcc wrote:So before even trying to run anything, just looking at the plugin, I noticed a couple of things:

1. The simple case of HW_I2C had been missed completely, I'm adding it in now. After that, I'll test it in a new project and add the zip of it here.

2. the "simple" plugin was trying to handle all the complex cases! It was trying to handle the 2nd interface cases, and special named display cases, these have now been removed. Left are all the standard NONAME cases for every display in basic configurations. Anyone else (mainly advanced users) can use the full u8g2 plugin where they declare the variable themselves.



I've been starting with the "simple", getting things working, then coming back into the advanced... I don't think I got to that point with that particular display. Glad to take it for a spin, regardless!

Author: davetcc
02/06/2021 13:51:51
Rather embarrassing to miss one of the basic cases really, and it's not worked for a long time, thanks for reporting it. I'm adding in the HW_I2C case now and I'll do a patch release of the plugins, I don't know how that one got missed!

The thing is that on ESP32 unless we actually define the SDA and SCL pins, it will call Wire.begin() - IE with no parameters. This will end badly because SDA and SCL will be on the wrong pins unless you're actually using the default pins (and not many do on ESP32 because they are mappable). A temporary workaround would be to use the NONAME_F_SW_I2C option until I can fix it. That's well tested on ESP8266 so should be OK on ESP32 as well.

As an aside, if you're interested in the internals - the way it works is that the Mac/Windows/Linux designer all use the same code base now, and they load in the XML plugins, and in particular this U8G2 one that we are using: https://github.com/davetcc/tcMenu/blob/master/xmlPlugins/core-display/u8g2SimpleBuilder.xml, notice in the functions section it has no match for .*HW_I2C, I'll get a fix out this week. I'll also make it so that it takes the SDA and SCL too. This allows in the future for others to extend the designer.

GitHub Issue: https://github.com/davetcc/tcMenu/issues/152

Author: davetcc
04/06/2021 07:14:26
Quick update on this, I've now got the HW_I2C case working on ESP32 locally, mainly by a few small fixes in the plugin (and a very small change in the plugin C++ code too). It will take a day or two to finish it, as I'm trying to test more cases if I'm honest.

Testing - Quickstart plugin:

* Software on most boards already known to work
* Hardware (or using Wire basically) to be tested on ESP32, ESP8266, and BLE. This will be tested both with the wire-friendly yield on and off.


Testing - Custom U8G2 plugin:

* We'll test this on a couple of arrangements and make sure it's working.

Author: davetcc
05/06/2021 19:34:34
I’ve now tested the HW_I2C and also the custom generator on a wide range of boards. It’s committed to master, and soon I’ll be making a patch - 2.1.4.

Author: davetcc
06/06/2021 07:47:14
I've just made 2.1.4 of the plugins available as beta, to try them you can

1. Go to Edit -> General Settings
2. Select the Libraries tab.
3. Change the stream from Stable to BETA
4. Refresh the libraries using the refresh button
5. Click the update button to go from 2.1.3 to 2.1.4

You can easily go back to 2.1.3 by reversing the procedure and going back to Stable if there are any problems. We've tested the changes on ESP32, ESP8266 and Nano BLE.

Author: davetcc
07/06/2021 05:51:49
Attached is the example platformIO project that I used, configured for ESP32

Filename testU8g2.zip
Description platformio HW_I2C project file for ESP32
Filesize 9 Kbytes
Downloaded 53393 time(s)
[Disk] Download


Author: ScubaSteve
08/06/2021 06:55:30
Hi Dave.

Thanks for the quick fixes! I'm in the process of getting ready to run some tests... changed the display variable in the Quick Start to "display", ended up getting a compiler error saying it wasn't initialized in _menu.cpp. I removed the .cpp and .h files, re-generated .. same. Changing the display variable go "gfx" seemed to fix it. I didn't take any time to troubleshoot, and this may be PEBKAC, but figured I'd mention it.

I'll get back to you shortly on the last set of fixes!

Steve

Author: davetcc
08/06/2021 10:00:21
I've just tried renaming the display variable to "display" and it appears to work. Could you check if you have any library or other variable that is conflicting with it?

Granted I'm using the 2.2 dev build, but there should not be many differences there, could you try my example project and see if that works for you?

[Thumb - rename-display-variable.jpg]
Filename rename-display-variable.jpg
Description Screenshot of the generator with U8G2 quick start and display variable name
Filesize 71 Kbytes
Downloaded 52577 time(s)
[Disk] Download

Filename testU8g2.zip
Description Project file and source with "display" variable name
Filesize 9 Kbytes
Downloaded 52750 time(s)
[Disk] Download


Author: ScubaSteve
08/06/2021 13:42:33
Disregard this .... was running a local copy of one of the examples that I already broke...

Author: ScubaSteve
08/06/2021 14:20:36
OK. So...

Your test code, unzipped but otherwise untouched compiles clean. But there's nothing on the display. The demo "simpleU8g2" works fine. On a lark, I re-generated in Designer, specifying the same display type (SW I2C) as the working demo, Serial 5, Clock 4... and when I compile, tons of multiple definitions.

Running the latest everything here.

Arduino: 1.8.13 (Mac OS X), Board: "DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"

sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawText(tcgfx::Coord const&, void const*, int, char const*)':
sketch/src/tcMenuU8g2.h:79: multiple definition of `U8g2Drawable::drawText(tcgfx::Coord const&, void const*, int, char const*)'
sketch/tcMenuU8g2.cpp.o:sketch/tcMenuU8g2.cpp:66: first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawXBitmap(tcgfx::Coord const&, tcgfx::Coord const&, unsigned char const*)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11drawXBitmapERKN5tcgfx5CoordES3_PKh+0x0): multiple definition of `U8g2Drawable::drawXBitmap(tcgfx::Coord const&, tcgfx::Coord const&, unsigned char const*)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11drawXBitmapERKN5tcgfx5CoordES3_PKh+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawCircle(tcgfx::Coord const&, int, bool)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable10drawCircleERKN5tcgfx5CoordEib+0x0): multiple definition of `U8g2Drawable::drawCircle(tcgfx::Coord const&, int, bool)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable10drawCircleERKN5tcgfx5CoordEib+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::textExtents(void const*, int, char const*, int*)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11textExtentsEPKviPKcPi+0x0): multiple definition of `U8g2Drawable::textExtents(void const*, int, char const*, int*)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11textExtentsEPKviPKcPi+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawPolygon(tcgfx::Coord const*, int, bool)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11drawPolygonEPKN5tcgfx5CoordEib+0x0): multiple definition of `U8g2Drawable::drawPolygon(tcgfx::Coord const*, int, bool)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11drawPolygonEPKN5tcgfx5CoordEib+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawBox(tcgfx::Coord const&, tcgfx::Coord const&, bool)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable7drawBoxERKN5tcgfx5CoordES3_b+0x0): multiple definition of `U8g2Drawable::drawBox(tcgfx::Coord const&, tcgfx::Coord const&, bool)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable7drawBoxERKN5tcgfx5CoordES3_b+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::transaction(bool, bool)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11transactionEbb+0x0): multiple definition of `U8g2Drawable::transaction(bool, bool)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable11transactionEbb+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::drawBitmap(tcgfx::Coord const&, tcgfx: smilierawableIcon const*, bool)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable10drawBitmapERKN5tcgfx5CoordEPKNS0_12DrawableIconEb+0x0): multiple definition of `U8g2Drawable::drawBitmap(tcgfx::Coord const&, tcgfx: smilierawableIcon const*, bool)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2Drawable10drawBitmapERKN5tcgfx5CoordEPKNS0_12DrawableIconEb+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `safeGetFont(void const*)':
tcMenuU8g2.cpp smilie.text._Z11safeGetFontPKv+0x0): multiple definition of `safeGetFont(void const*)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._Z11safeGetFontPKv+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2DrawableC2EP4U8G2P7TwoWire+0x0): multiple definition of `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2DrawableC2EP4U8G2P7TwoWire+0x0): first defined here
sketch/src/tcMenuU8g2.cpp.o: In function `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)':
tcMenuU8g2.cpp smilie.text._ZN12U8g2DrawableC2EP4U8G2P7TwoWire+0x0): multiple definition of `U8g2Drawable::U8g2Drawable(U8G2*, TwoWire*)'
sketch/tcMenuU8g2.cpp.o:tcMenuU8g2.cpp smilie.text._ZN12U8g2DrawableC2EP4U8G2P7TwoWire+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o: In function `fnLEDColorRtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)':
/Users/steve/Documents/Arduino/libraries/tcMenu/src/graphics/GraphicsDeviceRenderer.h:202: multiple definition of `fnLEDColorRtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)'
sketch/testU8g2_menu.cpp.o:sketch/testU8g2_menu.cpp:22: first defined here
sketch/src/testU8g2_menu.cpp.o: In function `fnSub1RtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)':
testU8g2_menu.cpp smilie.text._Z12fnSub1RtCallP15RuntimeMenuItemh12RenderFnModePci+0x0): multiple definition of `fnSub1RtCall(RuntimeMenuItem*, unsigned char, RenderFnMode, char*, int)'
sketch/testU8g2_menu.cpp.o:testU8g2_menu.cpp smilie.text._Z12fnSub1RtCallP15RuntimeMenuItemh12RenderFnModePci+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.data.defaultItemPaletteMono+0x0): multiple definition of `defaultItemPaletteMono'
sketch/testU8g2_menu.cpp.o smilie.data.defaultItemPaletteMono+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o: In function `installMonoBorderedTheme(tcgfx::GraphicsDeviceRenderer&, tcgfx::MenuFontDef const&, tcgfx::MenuFontDef const&, bool)':
testU8g2_menu.cpp smilie.text._Z24installMonoBorderedThemeRN5tcgfx22GraphicsDeviceRendererERKNS_11MenuFontDefES4_b+0x0): multiple definition of `installMonoBorderedTheme(tcgfx::GraphicsDeviceRenderer&, tcgfx::MenuFontDef const&, tcgfx::MenuFontDef const&, bool)'
sketch/testU8g2_menu.cpp.o:testU8g2_menu.cpp smilie.text._Z24installMonoBorderedThemeRN5tcgfx22GraphicsDeviceRendererERKNS_11MenuFontDefES4_b+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.display+0x0): multiple definition of `display'
sketch/testU8g2_menu.cpp.o smilie.bss.display+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.renderer+0x0): multiple definition of `renderer'
sketch/testU8g2_menu.cpp.o smilie.bss.renderer+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuAnalog1+0x0): multiple definition of `menuAnalog1'
sketch/testU8g2_menu.cpp.o smilie.bss.menuAnalog1+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o: In function `setupMenu()':
testU8g2_menu.cpp smilie.text._Z9setupMenuv+0x0): multiple definition of `setupMenu()'
sketch/testU8g2_menu.cpp.o:testU8g2_menu.cpp smilie.text._Z9setupMenuv+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.displayDrawable+0x0): multiple definition of `displayDrawable'
sketch/testU8g2_menu.cpp.o smilie.bss.displayDrawable+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.rodata.applicationInfo+0x0): multiple definition of `applicationInfo'
sketch/testU8g2_menu.cpp.o smilie.rodata.applicationInfo+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuLEDColor+0x0): multiple definition of `menuLEDColor'
sketch/testU8g2_menu.cpp.o smilie.bss.menuLEDColor+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuAvgTemp+0x0): multiple definition of `menuAvgTemp'
sketch/testU8g2_menu.cpp.o smilie.bss.menuAvgTemp+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuBackSub1+0x0): multiple definition of `menuBackSub1'
sketch/testU8g2_menu.cpp.o smilie.bss.menuBackSub1+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuSub1+0x0): multiple definition of `menuSub1'
sketch/testU8g2_menu.cpp.o smilie.bss.menuSub1+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuACLine+0x0): multiple definition of `menuACLine'
sketch/testU8g2_menu.cpp.o smilie.bss.menuACLine+0x0): first defined here
sketch/src/testU8g2_menu.cpp.o smilie.bss.menuNewEnumItem+0x0): multiple definition of `menuNewEnumItem'
sketch/testU8g2_menu.cpp.o smilie.bss.menuNewEnumItem+0x0): first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board DOIT ESP32 DEVKIT V1.


This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Author: davetcc
08/06/2021 14:40:21
Ah yes, sorry should have mentioned that you wouldn't be able to regenerate that project as is, I just wanted to check if it compiled ok for you, it was using a new feature in 2.2 to work with INO files in the src directory (requested by some people using platform IO); which wasn't previously supported. However, if you moved everything back to the main directory and turned off the "C++ files in src directory" option it should work fine.

The reason the display is probably blank is in the ino setup() it calls

Wire.begin(4, 15);


So unless you have wire on those two pins it would not work. If you want to use hardware I2C on ESP32, I found that the only reliable way was to initialise I2C before U8G2 begin().






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