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

tcMenu Designer UI » tcmenuAdaFruitGfx.cpp code not using all menu lines - possible fix

Author: Rn41
10/10/2019 09:47:00
Hi, I've just started using tcmenu and I must say you've done an amazing job.
I'm using it on an ESP32 with a 128x32 OLED (actually an Adafruit ESP32 Feather and OLED Wing).
I've set up AdaColorGfxMenuConfig with minimal spacing to use all 4 lines ( title + 3 menu lines), so 0 paddings, and titleBottomMargin=0
When I run the sketch, I only get the title and 2 menu lines, and when I scroll past the second line I lose the edit/active icons and things don't seem to work very well.

I've debugged the code generated by the designer UI, in tcMenuAdaFruitGfx.cpp, and I think I've found the issue. In render(), the following code :
// and then we start drawing items until we run out of screen or items
        int ypos = titleHeight;
        while (item && (ypos + itemHeight) < graphics->height() ) {

ignores the final menu line if it reaches the absolute bottom of the display (in this case 32, ie.: while (item && (24+ 8) < 32))

I think it should be
while (item && (ypos + itemHeight) <= graphics->height() ) {

Making that change works for me - the menu then shows title + 3 lines and it all scrolls and functions correctly.

Author: davetcc
10/10/2019 12:08:13
Thanks for the feedback, I’ll add this to the release that’s due soon.




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