Coder Social home page Coder Social logo

forntoh / lcdmenu Goto Github PK

View Code? Open in Web Editor NEW
160.0 12.0 35.0 608 KB

Display navigable menu items on your LCD display 📟 with Arduino

Home Page: https://lcdmenu.forntoh.dev

License: MIT License

C++ 75.62% Python 7.42% Shell 3.00% C 13.68% Ruby 0.28%
arduino arduino-library lcd-display dynamic-menus menus

lcdmenu's Introduction

Header

About me

  • 📱 I love deloping mobile apps, I have learned all I can about Android Dev
  • 👩‍💻 I’m currently doing a lot with NextJS, Strapi & Supabase
  • 🥅 Goals: Contribute more to Open Source projects
  • ⚡ I also do 3D Modelling 😉

My GitHub stats

Forntoh's github stats Top Langs Forntoh's wakatime stats

lcdmenu's People

Contributors

actions-user avatar andcan avatar dejanmeznarc avatar forntoh avatar imgbotapp avatar sennedrent avatar thijstriemstra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lcdmenu's Issues

[BUG]: Update value of ItemProgress on runtime

Discussed in #134

Originally posted by Hoczer October 4, 2023
Hello.
I need to save and read "power" variable from eeprom and pass it to menu ItemProgress as default value. I need to keep user settings when device is going power down.
Help me pls.

MAIN_MENU(
  ITEM_TOGGLE("Rozpalanie", "ON", "OFF", rozpalanieCallback),
  ITEM_STRING_LIST("Tryb", workMode, 4, workModeSelect),
  ITEM_SUBMENU("Praca reczna", manualMenu),
  ITEM_PROGRESS("Nadmuch",power, ventPowerCallBack),
  ITEM_COMMAND("EXIT", exitMenu));
```</div>

[BUG]: Can't compile if I add #include "LcdMenu.h" to any other file than main.cpp

What happened?

in my platformio project, if I add #include <LcdMenu.h>to another .h file, I get a conflict error when compiling.

It appears to only happen if the .h is included in a file that contains a constructor with at least 1 argument. Very strange.

Error:

c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `substring(char*, unsigned char, unsigned char, char*)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:4: multiple definition of `substring(char*, unsigned char, unsigned char, char*)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:4: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `concat(char const*, char, char const*, char*)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:9: multiple definition of `concat(char const*, char, char const*, char*)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:9: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `concat(char const*, char, char*)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:19: multiple definition of `concat(char const*, char, char*)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:19: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `concat(char const*, char const*, char*)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:26: multiple definition of `concat(char const*, char const*, char*)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:26: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `remove(char*, unsigned char, unsigned char)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:31: multiple definition of `remove(char*, unsigned char, unsigned char)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:31: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `mapProgress(unsigned short, long, long)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:39: multiple definition of `mapProgress(unsigned short, long, long)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:39: first defined here
c:/users/daniel/.platformio/packages/toolchain-xtensa-esp32/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: .pio\build\main\lib4fd\libmenu.a(MenuClass.cpp.o): in function `mapProgress(unsigned short, float, float)':
D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:44: multiple definition of `mapProgress(unsigned short, float, float)'; .pio\build\main\src\main.cpp.o:D:\9mediatech\acrobotics\code\jona\Acrobot/.pio/libdeps/main/LcdMenu/src/utils.h:44: first defined here
collect2.exe: error: ld returned 1 exit status
*** [.pio\build\main\firmware.elf] Error 1

To recreate:
main.cpp:

#include "MenuClass.h"

MenuClass menuClass(0x27);

void setup(){
}

void loop(){
}

MenuClass.h:

#ifndef MENUCLASS_H
#define MENUCLASS_H

#include <LcdMenu.h>

class MenuClass {
  public:
    MenuClass(uint8_t address);
  private:
    uint8_t address;
};

#endif

MenuClass.cpp:

#include "MenuClass.h"

MenuClass::MenuClass(uint8_t address) {
  this->address = address;
}

Version

3.3.2

What environment are you seeing the problem in?

No response

Board type

No response

Relevant log output

No response

[BUG] -

Describe the bug
Hello
I really like what LcdMenu has to offer. But unfortunately, the example codes return with a library error when compiled. Menu_basic errors here
Arduino: 1.8.13 (Windows 7), Motherboard: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

In file included from C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/LcdMenu.h:34:0,

              from C:\Users\bandi\Documents\Arduino\menu_basic\menu_basic.ino:1:

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In member function 'virtual void MenuItem::setIsOn(boolean)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:116:34: warning: unused parameter 'isOn' [-Wunused-parameter]

  virtual void setIsOn(boolean isOn){};

                               ^~~~

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In member function 'virtual void MenuItem::setValue(String)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:120:34: warning: unused parameter 'value' [-Wunused-parameter]

  virtual void setValue(String value){};

                               ^~~~~

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In member function 'void MenuItem::setText(const char*)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:125:30: warning: unused parameter 'text' [-Wunused-parameter]

  void setText(const char* text){};

                           ^~~~

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In member function 'virtual void MenuItem::setCallBack(fptr)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:130:35: warning: unused parameter 'callback' [-Wunused-parameter]

  virtual void setCallBack(fptr callback){};

                                ^~~~~~~~

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In member function 'virtual void MenuItem::setItemIndex(uint8_t)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:134:39: warning: unused parameter 'itemIndex' [-Wunused-parameter]

  virtual void setItemIndex(uint8_t itemIndex){};

                                    ^~~~~~~~~

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h: In constructor 'ItemHeader::ItemHeader(const char*, MenuItem**, byte)':

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:169:28: warning: unused parameter 'text' [-Wunused-parameter]

  ItemHeader(const char* text, MenuItem** parent, byte type)

                         ^~~~

C:\Users\bandi\Documents\Arduino\menu_basic\menu_basic.ino: At global scope:

C:\Users\bandi\Documents\Arduino\libraries\LcdMenu-3.0.0\src/MenuItem.h:212:58: error: expected primary-expression before ',' token

  MenuItem* mainMenu[] = {new ItemHeader(), __VA_ARGS__, new ItemFooter()}

                                                       ^

C:\Users\bandi\Documents\Arduino\menu_basic\menu_basic.ino:31:1: note: in expansion of macro 'MAIN_MENU'

MAIN_MENU(

^~~~~~~~~

exit status 1

Error translating to Arduino Pro or Pro Mini motherboard.

This report could have more information
"Show more output when compiling"
by enabling the option in File -> Preferences.

What do I do wrong?

Make isAtStart and isAtEnd public

I also found menu.getCursorPosition() but I'm not seeing a function to tell what the last position of the current menu is. I was hoping to do something like menu.getCursorPosition() == menu.getLastCursorPosition().

In my case there's many items in the menu, but I can only have a single button controlling selection. I also found there's isAtTheStart and isAtTheEnd which sound promising but they're private so can't be used.

Originally posted by @CraigSiemens in #147 (reply in thread)

[BUG]: Problem severity 8 reported by PlatformIO on menuItem.h at level 3.3.3

What happened?

Error During Build phase on line 219 : MenuItem* mainMenu[] = {new ItemHeader(), VA_ARGS, new ItemFooter()}
and reported as :
"expected primary-expression before ',' token"
This prevent my code from being uploaded to a Mega Arduino. Have tried to unload and reload LcdMenu but with no improvment.
21/10/23 : New error while running Exemple Callbacks on MenuItem.h line 153 #define ITEM_BASIC..... reported as "expression cannot be used as a function"
It looks as though MenuItem.h is incompatible with PIO

Version

3.3.3

What environment are you seeing the problem in?

Platform IO

Board type

Mega

Relevant log output

#define MAIN_MENU(...)           \
    extern MenuItem* mainMenu[]; \
    MenuItem* mainMenu[] = {new ItemHeader(), __VA_ARGS__, new ItemFooter()}

[BUG]: Issue with toggle Backlight in Example 03 Callbacks v3.2.0

What happened?

Unsing ITEM_TOGGLE("Backlight", toggleBacklight),
after executing cmd backlight LCD goes OFF and switch back to ON

in v3.0.0 it works
br
Marc-Andre

Version

3.2.0

What environment are you seeing the problem in?

Arduino

Board type

ESP-32 Development-Board

Relevant log output

none

[BUG] Update the latest value in ITEM_INPUT

Discussed in #144

Originally posted by Aditya-Shandilya November 1, 2023
Hello, I am new to this library and I am working on a project that involves calculating the area of either a rectangle or a circle. I have three variables: Length, Breadth, and Diameter. To facilitate the calculation, I've set up a system where I can input values for these dimensions. However, I've encountered a problem where entering a value for Length works fine, but when I input a value for Breadth, it seems to overwrite the Length value. The same issue occurs with Diameter. I debugged it a bit and found out that it is successfully storing the inputs in the variable but not updating it on the Lcd Screen rather the value that is being inputted globally is updated. Heres the snippet of my code:

#define CHARSET_SIZE 10
char charset[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
uint8_t charsetPosition;

int length = 0;
int breadth = 0;
int diameter = 0;

bool lengthSet = false;
bool breadthSet = false;
bool diameterSet = false;

void lengthInputCallback(char *value);
void breadthInputCallback(char *value);
void diameterInputCallback(char *value);

extern MenuItem *AreaMenu[];
extern MenuItem *RectangleSubMenu[];
extern MenuItem *CircleSubMenu[];

MAIN_MENU(
    ITEM_SUBMENU("Set Area", AreaMenu));

SUB_MENU(AreaMenu, mainMenu,
         ITEM_SUBMENU("Rectangle", RectangleSubMenu),
         ITEM_SUBMENU("Circle", CircleSubMenu));

SUB_MENU(RectangleSubMenu, AreaMenu,
         ITEM_INPUT("Length", lengthInputCallback),
         ITEM_INPUT("Breadth", breadthInputCallback));

SUB_MENU(CircleSubMenu, AreaMenu,
         ITEM_INPUT("Diameter", diameterInputCallback));

Above is the definition for my menu.
Button Definition that was referred from the example of the library:

if (debounce(BUTTON_UP))
  {
    if (menu.isInEditMode()) // Update the position only in edit mode
      charsetPosition = (charsetPosition + 1) % CHARSET_SIZE;
    menu.drawChar(charset[charsetPosition]); // Works only in edit mode
    menu.up();
  }
  else if (debounce(BUTTON_DOWN))
  {
    if (menu.isInEditMode())
      charsetPosition =
          constrain(charsetPosition - 1, 0, CHARSET_SIZE);
    menu.drawChar(charset[charsetPosition]);
    menu.down();
  }
  else if (debounce(BUTTON_ENTER))
  {
    if (menu.isInEditMode())
    {
      menu.type(charset[charsetPosition]);
    }
    charsetPosition = 0;
    menu.enter();
  }
  else if (debounce(BUTTON_BACK))
  {
    menu.back();
  }
}

Converting the string to an integer and storing it in a variable:

void lengthInputCallback(char *value)
{
  length = atoi(value); // Store the length value in the variable.
  lengthSet = true;
}
void breadthInputCallback(char *value)
{
  breadth = atoi(value);
  breadthSet = true;
}
void diameterInputCallback(char *value)
{
  diameter = atoi(value);
  diameterSet = true;
}

I have referred to the ItemInput example for character sets and managed to input values accordingly. However, the issue with values overwriting each other remains unresolved. Note that I have checked that all my connections are correct and the buttons are pressed correctly. The code also runs without any errors. Any guidance or suggestions to correct this behavior would be greatly appreciated.

Enhancement: ability to print custom characters

Hi,
I'd like the ability to print custom characters (my language has letters like č,ř,ě,š, etc.). My idea I have ATM is that you'd have a field where you'd assign the characters to a number to a created character. A bodge but it would work.

I'll try to help, but I'm not a good coder yet.

Compile warnings

Hello,

I'm developing a project using Visual Studio Code with PlatformIO add-on and every time I compile my code, I get these warnings.
The hardware I use is Arduino Nano (ATMega328p).

In file included from .pio\libdeps\NanoaATmega328\LcdMenu\src/LcdMenu.h:33:0,
                 from src\main.cpp:6:
.pio\libdeps\NanoaATmega328\LcdMenu\src/MenuItem.h: In constructor 'MenuItem::MenuItem(char*, char*, fptr, byte)':
.pio\libdeps\NanoaATmega328\LcdMenu\src/MenuItem.h:86:20: warning: 'MenuItem::value' will be initialized after [-Wreorder]
     String value = "";
                    ^
In file included from c:\users\kulverstukas\.platformio\packages\toolchain-atmelavr\avr\include\avr\eeprom.h:50:0,
                 from C:\users\kulverstukas\.platformio\packages\framework-arduino-avr\cores\arduino/USBAPI.h:25,
                 from C:\users\kulverstukas\.platformio\packages\framework-arduino-avr\cores\arduino/Arduino.h:233,
                 from src\main.cpp:1:
.pio\libdeps\NanoaATmega328\LcdMenu\src/MenuItem.h:48:21: warning:   'void (* MenuItem::callback)()' [-Wreorder]
     fptr callback = NULL;
                     ^
In file included from .pio\libdeps\NanoaATmega328\LcdMenu\src/LcdMenu.h:33:0,
                 from src\main.cpp:6:
.pio\libdeps\NanoaATmega328\LcdMenu\src/MenuItem.h:65:5: warning:   when initialized here [-Wreorder]
     MenuItem(char* text, char* value, fptr callback, byte type)
     ^

Public method to redraw menu

There's a paint method that should either be public but I think it would make more sense to add a new redraw() that calls the private paint().

Newliquidcrystal_1.3.5 and LcdMenu - compatibility issue

Hi Thomas
Your library seem exactly was I need, but I have a problem.
I changed to use the I2C library into the LiquidMenu_config.h but I have an error at the line " lcd.init();)" ->int LiquidCrystal_I2C::init()' is private within this context". I expect that the library "Newliquidcrystal_1.3.5" is not compatible with your code.
I tryed to cancel it, but nothing works.
May you tell me which library is to use with your code? Thank you in advance and best regards,
Stefano

arduino 1.8.5 compile submenu error.

Arduino: 1.8.15 (Linux), Board: "Arduino Uno"

arduino-builder -dump-prefs -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/allan/.arduino15/packages -tools /usr/share/arduino/hardware/tools/avr -tools /home/allan/.arduino15/packages -libraries /home/allan/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10815 -build-path /tmp/arduino_build_189558 -warnings=default -build-cache /tmp/arduino_cache_980456 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /tmp/arduino_modified_sketch_607289/SubMenu.ino
arduino-builder -compile -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/allan/.arduino15/packages -tools /usr/share/arduino/hardware/tools/avr -tools /home/allan/.arduino15/packages -libraries /home/allan/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10815 -build-path /tmp/arduino_build_189558 -warnings=default -build-cache /tmp/arduino_cache_980456 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /tmp/arduino_modified_sketch_607289/SubMenu.ino
Using board 'uno' from platform in folder: /usr/share/arduino/hardware/arduino/avr
Using core 'arduino' from platform in folder: /usr/share/arduino/hardware/arduino/avr
Build options changed, rebuilding all
Detecting libraries used...
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/home/allan/Arduino/libraries/Keypad/src/Key.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/home/allan/Arduino/libraries/Keypad/src/Keypad.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/home/allan/Arduino/libraries/LiquidCrystal/src/LiquidCrystal.cpp" -o "/dev/null"
Generating function prototypes...
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/tmp/arduino_build_189558/preproc/ctags_target_for_gcc_minus_e.cpp"
"/usr/bin/arduino-ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_189558/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/usr/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/Keypad/src" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp" -o "/tmp/arduino_build_189558/sketch/SubMenu.ino.cpp.o"
/tmp/arduino_modified_sketch_607289/SubMenu.ino:48:48: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Start service"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:49:50: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Connect to WiFi"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:50:60: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
ItemSubMenu("Settings", settingsMenu),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:51:44: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Blink SOS"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:52:47: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Blink random"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:58:48: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Backlight"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino:59:47: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
MenuItem("Contrast"),
^
/tmp/arduino_modified_sketch_607289/SubMenu.ino: In function ‘void setup()’:
SubMenu:66:52: error: no matching function for call to ‘LcdMenu::setupLcdWithMenu(int, MenuItem [7])’
void setup() { menu.setupLcdWithMenu(0x27, mainMenu); }
^
In file included from /tmp/arduino_modified_sketch_607289/SubMenu.ino:29:0:
/home/allan/Arduino/libraries/LcdMenu/src/LcdMenu.h:309:10: note: candidate: void LcdMenu::setupLcdWithMenu(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, MenuItem*)
void setupLcdWithMenu(
^
/home/allan/Arduino/libraries/LcdMenu/src/LcdMenu.h:309:10: note: candidate expects 7 arguments, 2 provided
/tmp/arduino_modified_sketch_607289/SubMenu.ino: In function ‘void loop()’:
SubMenu:69:16: error: ‘keypad’ was not declared in this scope
char key = keypad.getKey();
^
Using library Keypad at version 3.1.1 in folder: /home/allan/Arduino/libraries/Keypad
Using library LcdMenu at version 2.0.0-beta.2 in folder: /home/allan/Arduino/libraries/LcdMenu
Using library LiquidCrystal at version 1.0.7 in folder: /home/allan/Arduino/libraries/LiquidCrystal
exit status 1
no matching function for call to ‘LcdMenu::setupLcdWithMenu(int, MenuItem [7])’

To much memory usage on Arduino UNO

Hi, I have program with 6 submenus. After downloading my code the RAM usage is about 97%. Im using 6 submenus and in these submenus I use ItemCommand for calling my own functions with trivial commands (Serial.write). Is there ani option to solve this problem?

Here is my program

//####### PROGRAM PRO OVLADACI PULT HASICSKYCH STOPEK ######
// PROGRAM VYTVORIL JAN DRSKA PRO JEDNOTKU SDH JIZBICE
/*
/----/ /----/ /----/ /----/
/ / / / /--/ / / / /
/----/ /----/ /----/ /----/
/ / / / /--/ / / / /
/----/ /----/ /----/ /----/
*/

// VERZE 1.0
// POSLEDNI UPRAVA 03.04.2022

#include <LcdMenu.h>

#define CLK 8
#define DT 9
#define SW 2

#define LCD_ROWS 2
#define LCD_COLS 16

// Configure keyboard keys (ASCII)
#define UP 56 // NUMPAD 8
#define DOWN 50 // NUMPAD 2
#define LEFT 52 // NUMPAD 4
#define RIGHT 54 // NUMPAD 6
#define ENTER 53 // NUMPAD 5
#define BACK 55 // NUMPAD 7
#define BACKSPACE 8 // BACKSPACE
#define CLEAR 46 // NUMPAD .

bool menuZpetPom = false;

// Declare the main menu
extern MenuItem mainMenu[];
extern MenuItem Mpozarnisport[];
extern MenuItem Mvycvik[];
extern MenuItem Modpocet[];
extern MenuItem Mskore[];
extern MenuItem Mhodiny[];
extern MenuItem Mnastaveni[];

// Definice hlavniho menu
MenuItem mainMenu[] = {ItemHeader(),
ItemSubMenu("Pozarni sport",Mpozarnisport),
ItemSubMenu("Vycvik 5+1",Mvycvik),
ItemSubMenu("Odpocet",Modpocet),
ItemSubMenu("Skore",Mskore),
ItemSubMenu("Hodiny",Mhodiny),
ItemSubMenu("Nastaveni",Mnastaveni),
ItemFooter()};
// Definice vsech submenu 1. kategorie

void menuZpet();
void pozarniUtokStartPovolen(uint8_t isOn);
void pozarniUtokStart();
void pozarniUtokStop();
void pozarniUtokReset();
void pozarniUtokVypustit();
void pozarniUtokResetTercu();

MenuItem Mpozarnisport[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Start",pozarniUtokStart),
ItemCommand("Stop",pozarniUtokStop),
ItemCommand("Restart",pozarniUtokReset),
ItemCommand("Vypustit terce",pozarniUtokVypustit),
ItemCommand("Reset tercu",pozarniUtokResetTercu),
ItemFooter()};

void vycvikStart();
void vycvikStop();
void vycvikReset();

MenuItem Mvycvik[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Start",vycvikStart),
ItemCommand("Stop",vycvikStop),
ItemCommand("Reset",vycvikReset),
ItemFooter()};

void odpocetStart();
void odpocetStop();
void odpocetReset();

MenuItem Modpocet[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Start",odpocetStart),
ItemCommand("Stop",odpocetStop),
ItemCommand("Reset",odpocetReset),
ItemFooter()};

void skoreT1p();
void skoreT2p();
void skoreT1m();
void skoreT2m();
void skoreStart();
void skoreReset();

MenuItem Mskore[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Tym 1 +",skoreT1p),
ItemCommand("Tym 2 +",skoreT2p),
ItemCommand("Tym 1 -",skoreT1m),
ItemCommand("Tym 2 -",skoreT2m),
ItemCommand("Start",skoreStart),
ItemCommand("Reset jednotky",skoreReset),
ItemFooter()};

void hodinyStart();
void hodinyStop();
void hodinyNastavit();
void hodinyRezim();

MenuItem Mhodiny[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Spustit",hodinyStart),
ItemCommand("Zastavit",hodinyStop),
ItemCommand("Nastavit",hodinyNastavit),
ItemCommand("Rezim",hodinyRezim),
ItemFooter()};

void nastaveniReset();
void nastaveniPodsviceni(uint8_t isOn);

MenuItem Mnastaveni[] =
{
ItemHeader(mainMenu),
// ItemCommand("Zpet",menuZpet),
ItemCommand("Reset",nastaveniReset),
ItemToggle("Podsviceni",nastaveniPodsviceni),
ItemFooter()};

LcdMenu menu(LCD_ROWS, LCD_COLS);

int encCounter = 0;

bool btn = 0;
int counter = 0;
int actualStateCLK = 0;
int lastStateCLK = 0;
unsigned long lastButtonPressTime = 0;

void setup()
{
Serial.begin(9600);
menu.setupLcdWithMenu(0x3F, mainMenu);
pinMode(CLK,INPUT_PULLUP);
pinMode(DT,INPUT_PULLUP);
pinMode(SW,INPUT_PULLUP);
lastStateCLK = digitalRead(CLK);
}

void loop()
{
actualStateCLK = digitalRead(CLK);

if (actualStateCLK != lastStateCLK  && actualStateCLK == 1)
{
    if (digitalRead(DT) != actualStateCLK)
    {
        if(counter > -10)
            counter --;
    }

	else 
    {
        if(counter < 10)
            counter ++;
    }
    
    Serial.print(counter);
}

lastStateCLK = actualStateCLK; 
int btnState = digitalRead(SW); 

if (btnState == LOW) 
{
	if (millis() - lastButtonPressTime > 150) 
        btn = HIGH;
    else 
        btn = LOW;
        
	lastButtonPressTime = millis(); 
}

if (counter > encCounter) 
    menu.up();
if (counter < encCounter)
    menu.down();

encCounter = counter;

if(btn == HIGH)
    menu.enter();

if (menuZpetPom)
{
    menu.back();
    menuZpetPom = false;
}

}

void menuZpet()
{
menuZpetPom = true;
}

void pozarniUtokStartPovolen(uint8_t isOn){}
void pozarniUtokStart(){Serial.write(10);}
void pozarniUtokStop(){Serial.write(11);}
void pozarniUtokReset(){Serial.write(12);}
void pozarniUtokVypustit(){Serial.write(13);}
void pozarniUtokResetTercu(){Serial.write(14);}

void vycvikStart(){Serial.write(20);}
void vycvikStop(){Serial.write(21);}
void vycvikReset(){Serial.write(22);}

void odpocetStart(){Serial.write(30);}
void odpocetStop(){Serial.write(31);}
void odpocetReset(){Serial.write(32);}

void skoreT1p(){Serial.write(40);}
void skoreT2p(){Serial.write(41);}
void skoreT1m(){Serial.write(42);}
void skoreT2m(){Serial.write(43);}
void skoreStart(){Serial.write(44);}
void skoreReset(){Serial.write(45);}

void hodinyStart(){Serial.write(50);}
void hodinyStop(){Serial.write(51);}
void hodinyNastavit(){Serial.write(52);}
void hodinyRezim(){Serial.write(53);}

void nastaveniReset(){Serial.write(60);}
void nastaveniPodsviceni(uint8_t isOn){menu.toggleBacklight();}

Issue with Charsetinput.ino on esp32

What happened?

Hi Thomas,
try to use the LcdMenu for my project I run in a couple of issues.

Test with the Charsetinput. Ino example, that’s happened:

(using ESP32 Core Version 1.6.0 )
After select the first digit and hit enter “nan” shows up on lcd row.

(usingESP32 Core Version 2.9.0 )
After select the first digit and hit enter “task_wdt” shows up on lcd row.

(both Versions)

BACKSPACE can’t delete the “nan”, just override is possible.

Select first digit again -> enter works -> select second digit -> enter works => leaving the Input mode => result is 33n.
the "n" is from "nan" -> third digit was not edited.

br
Marc-Andre

Code: example Charsetinput.ino

environment : Arduino: 1.8.19 (Linux),

Board Typ: esp32 /AZ-Delivery ESP-32Development-Board, ESP-WROOM-32 Prozessor 160MHz, Tensilica L108 32 bit Dual-Core CPU, 512 KB SRAM & 16 MB Flashspeicher.

Bord driver for testing:
Core Version 2.9.0
Core Version 1.6.0

LcdMenu Version 3.0.0 / 3.0.1

Version

3.0.0

What environment are you seeing the problem on?

Arduino

Board type

ESP-32 Development-Board

Relevant log output

none

toggleBacklight() function causes error when using arduino LiquidCrystal library and USE_STANDARD_LCD

When using the built in Arduino LiquidCrystal library and USE_STANDARD_LCD,
the following error appears:

In file included from D:\path\to\project\project.ino:21:0:
D:\User\Documents\Arduino\libraries\LcdMenu\src/LcdMenu.h: In member function 'void LcdMenu::toggleBacklight()':
D:\User\Documents\Arduino\libraries\LcdMenu\src/LcdMenu.h:773:18: error: 'class LiquidCrystal' has no member named 'setBacklight'
             lcd->setBacklight(item->isOn);
                  ^~~~~~~~~~~~
exit status 1
Error compiling for board Arduino Uno.

fixed by adding #ifndef USE_STANDARD_LCD to the toggleBacklight() function, but not sure if this is the best solution:

void toggleBacklight() {
    #ifndef USE_STANDARD_LCD
    MenuItem* item = &currentMenuTable[cursorPosition];
    if (item->getType() == MENU_ITEM_TOGGLE) {
        lcd->setBacklight(item->isOn);
    }
    #else
    return;
    #endif
}

I should also mention that USE_STANDARD_LCD is the only option when using the built in library as LiquidCrystal_I2C.h doesn't seem to be part of the built in library.

Support for list of string/int/float/etc

PR #22 is a stab at list support for strings and ints (which works quite well on esp32) but that implementation has drawbacks like usage of vector.

Right now input and toggle are only supported menu types and hopefully lists can be added as well.

Error: example List.ino esp32

Discussed in #99

Originally posted by maansch June 14, 2023
Hi Thomas,
try to use the List.ino, during compiling I receive these error msg.

**** fixed in v3.1.1
compiling without error msg work’s now.


but it’s not possible to use the list.

Scrolling by UP / DOWN works.

ENTER LEFT/RIGHT has no function.

br
Marc-Andre

Code: example List.ino
environment : Arduino: 1.8.19 (Linux),
Board Typ: esp32
AZ-Delivery ESP-32Development-Board, ESP-WROOM-32 Prozessor 160MHz, Tensilica L108 32 bit Dual-Core CPU, 512 KB SRAM & 16 MB Flashspeicher.
Bord driver for testing:
Core Version 2.9.0
Core Version 1.6.0

Support for scrolling menu items

Sometimes the length of the label for a menu item is longer than 16 chars, cutting of the label. Would be cool if these chars can scroll on that line.

[BUG]: Error installing LcdMenu

What happened?

When trying to install the library, I get the following issue. Installing the library with the ZIP method seems to work fine, but I can use Arduino simulators as the error shows up both in VS Code and in Arduino IDE, as well as online simulators, such as wokwi.

Version

3.5.4

What environment are you seeing the problem in?

Arduino

Board type

Arduino Uno

Relevant log output

Failed to install library: 'LcdMenu:3.5.4'. No valid dependencies solution found: dependency 'LiquidCrystal_I2C' is not available

[BUG]: Cannot cycle through ItemList items

What happened?

Left and Right commands do not work on ItemList

Version

3.1.1

What environment are you seeing the problem in?

Platform IO, Arduino

Board type

No response

Relevant log output

No response

Go back with rotary encoder

Hi all, i'm trying your library with a rotary encoder with a button (KY-040), i can go up, down and enter sub-menu, nut i can't go back to the main menu because ItemSubHeader is not visible in the submenu.
Can you help me?
MYCODE:

#include <Arduino.h>

#include <LcdMenu.h>

#define LCD_ROWS 4
#define LCD_COLS 16

//Definizione pin
#define PIN_CLK 9
#define PIN_DT 10
#define PIN_SW 11

// Conserva stato ultima posizione encoder
volatile int prevClk;
volatile int prevDt;

volatile int pressingButton = 0;

extern MenuItem mainMenu[];
extern MenuItem settingsMenu[];

MenuItem mainMenu[] = {ItemHeader(),
                       MenuItem("Start service"),
                       MenuItem("Connect to WiFi"),
                       ItemSubMenu("Settings", settingsMenu),
                       MenuItem("Blink SOS"),
                       MenuItem("Blink random"),
                       ItemFooter()};



/**
 * Create submenu and precise its parent
 */
MenuItem settingsMenu[] = {ItemSubHeader(mainMenu),
                           MenuItem("Backlight"),
                           MenuItem("Contrast"),                        
                           ItemFooter()};

LcdMenu menu(LCD_ROWS, LCD_COLS);

void doEncoderA()
{

  Serial.println("doEncoderA");

  // Leggi valori dai pin dell'encoder
  int currClk = digitalRead(PIN_CLK);
  int currDt = digitalRead(PIN_DT);

  // Se la lettura corrente è diversa dall'ultima memorizzata
  if (currClk != prevClk)
  {

    Serial.print("[prevClk, prevDt | currClk, currDt] = ");
    Serial.print(prevClk);
    Serial.print(" ");
    Serial.print(prevDt);
    Serial.print(" | ");
    Serial.print(currClk);
    Serial.print(" ");
    Serial.print(currDt);

    //Se il valore di dt è uguale al valore corrente di clk
    if (currDt == currClk)
    {
      Serial.print(" -");
      menu.up();
    }
    else
    {
      Serial.print(" +");
      menu.down();
    }

    // Mostra lo stato del contatore
    Serial.print(" = ");

    //Aggiorna valori
    prevClk = currClk;
    prevDt = currDt;
  }
}
void doEncoderB()
{
  Serial.println("doEncoderB");
}
void encoderButtonPressed()
{
  if (pressingButton > 0)
  {
    pressingButton = 0;
  }
  else
  {
    Serial.println("ButtonPressed");
    menu.enter();
    pressingButton = 1;
  }
}

void setupRotaryEncoder()
{
  pinMode(PIN_CLK, INPUT);
  pinMode(PIN_DT, INPUT);
  pinMode(PIN_SW, INPUT);

  // Encoder pins on interrupt
  attachInterrupt(digitalPinToInterrupt(PIN_CLK), doEncoderA, CHANGE);
  attachInterrupt(digitalPinToInterrupt(PIN_DT), doEncoderB, CHANGE);
  attachInterrupt(digitalPinToInterrupt(PIN_SW), encoderButtonPressed, RISING);

  // Esegui prima lettura dei valori sui pin
  prevClk = digitalRead(PIN_CLK);
  prevDt = digitalRead(PIN_DT);
}

void setup()
{

  Serial.begin(9600);
  setupRotaryEncoder();
  menu.setupLcdWithMenu(0x27, mainMenu);
}

void loop()
{

}

Thanks

ItemInput callback issue

In the examples it's written that callbacks are available for ItemCommand and ItemToggle, however in the code I see that ItemInput can also have a callback and even calls it with .enter(), but every time I do that, Arduino resets completely without firing the callback.
I'm developing on an Arduino Nano.

This is my menu code:

MenuItem timerMenu[] = {
  ItemSubHeader(mainMenu),
  MenuItem((char*) "Delay time"),
  ItemInput((char*)"", (char*) TIME_ZERO, timerCallback),
  MenuItem("Game time"),
  ItemInput("", TIME_ZERO, NULL),
  ItemFooter()
};

timerCallback() is just this:

void timerCallback() {
  Serial.println("DONE");
}

Same if I have NULL as a callback as well.

[BUG] cannot exit from edit mode

Discussed in #139

Originally posted by fathanaa26 October 20, 2023
im using rotary encoder to navigate each item. when i enter edit mode from ItemProgress i couldnt go back to sub-menu. the serial debug show the condition is true / 1 like this :

0;1;30;1;1;
0;1;30;1;1;
0;1;30;1;1;
0;1;30;1;1

how can i exit from edit mode ?
thank you

#include <Arduino.h>
#include <LcdMenu.h>
#include <ItemSubMenu.h>
#include <Encoder.h>
#include <AceButton.h>
#include <ItemProgress.h>

#define enc_clk 12
#define enc_dt 11
#define enc_sw 10

using namespace ace_button;
AceButton btn(enc_sw);

extern MenuItem* settingsMenu[];
extern MenuItem* SystemRunning[];

void cb(uint16_t pos);
char* intMapping(uint16_t p){
  long maped = mapProgress(p, 100L,200L);
  static char buffer[10];
  itoa(maped, buffer, 10);
  concat(buffer,'m',buffer);
  return buffer;
}


MAIN_MENU(
  ITEM_SUBMENU("RUNNING",SystemRunning),
  ITEM_SUBMENU("CONTROL",settingsMenu)
);

SUB_MENU(SystemRunning, mainMenu,
  ITEM_BASIC("SYSTEM RUNNING"),
  ITEM_BASIC("00:00:00"),
  ITEM_BASIC("RPM 999")
  
);

SUB_MENU(settingsMenu, mainMenu,
  ITEM_PROGRESS("DURATION",10,intMapping,cb),
  ITEM_BASIC("SPEED")
  
);

LcdMenu menu(4, 20);
Encoder myEnc(enc_clk, enc_dt);

int64_t pos, last_pos = 0;
uint64_t mils, last_mils = 0;
uint8_t isCW;

void btn_h(AceButton*, uint8_t ev_type, uint8_t btn_state){
  Serial.print(F("handleEvent(): eventType: "));
  Serial.print(AceButton::eventName(ev_type));
  Serial.print(F("; buttonState: "));
  Serial.println(btn_state);
  
  switch (ev_type)
  {
  case AceButton::kEventClicked:
      menu.enter();
      
    break;
  
  case AceButton::kEventLongPressed:
      if(menu.isSubMenu() || menu.isInEditMode()){
       menu.back();
      }
  break;

  default:
    break;
  }
}

int inc_dbg;

void rotate(){
  
  pos = myEnc.read();
  if (pos % 4 == 0){
    if (last_pos > pos){
      menu.up();
      if(menu.isInEditMode()){
        inc_dbg++;
        menu.left();
      }
      last_pos = pos;
      
    }
    if (last_pos < pos){
      if(menu.isInEditMode()){
        inc_dbg--;
        menu.right();
      }
      menu.down();
      last_pos = pos;
      
    }
  }
}


void setup(){
  Serial.begin(9600);
  pinMode(enc_sw, INPUT_PULLUP);
  menu.setupLcdWithMenu(0x27, mainMenu, 10000);
  ButtonConfig* btn_cfg = btn.getButtonConfig();
  btn_cfg->setEventHandler(btn_h);
  btn_cfg->setFeature(ButtonConfig::kFeatureClick);
  btn_cfg->setFeature(ButtonConfig::kFeatureLongPress);

}

void loop(){
  menu.updateTimer();
  btn.check();
  rotate();

  char command = Serial.read();
  if (command == 1) menu.up();
  else if (command == 2) menu.down();
  else if (command == 3) menu.left();
  else if (command == 4) menu.right();
  else if (command == 5) menu.enter();
  else if (command == 6) menu.back();

  mils = millis();  
  if(mils - last_mils > 100){
    Serial.print(isCW);
    Serial.print(";");
    Serial.print(menu.getCursorPosition());
    Serial.print(";");
    Serial.print(inc_dbg);
    Serial.print(";");
    Serial.print(menu.isSubMenu());
    Serial.print(";");
    Serial.print(menu.isInEditMode());
    Serial.println(";");
    
    last_mils = mils;
  }
  
}

void cb(uint16_t p){
  p = inc_dbg;
  Serial.println(p);
}
```</div>

Enhancement: make `cursorPosition` public

Hi, I'm working on a menu that work's like this:
If there is no input for certain amount of time the menu is hidden and info screen is shown (state of pumps, etc) and after longer amount of time backlight will be turned off.
Then if user inputs if backlight is on and infoscreen is shown, menu shows, if even the backlight is off, it will turn on on the first keypress and the menu will be shown on the second keypress.

Now for the problem. When the menu is shown again the cursor has the position from the last time someone used it. I'd set cursorPosition = 1 to do it, but you've set it as private. This would allow people to reset the cursor position and setup keyboard shortcuts, etc

'class LiquidCrystal_I2C' has no member named 'init'

I was getting this error. Maybe because of the LiquidCrystal_I2C library I was using.

I fixed it by replacing init() with begin() in LcdMenu.h
lcd->init(); --> lcd->begin();

And now its working fine for me

Edit LIST menu item when keyboard not have UP/DOWN buttons

My keyboard have only 5 buttons.
LEFT, RIGHT, POWER, AUTO, MENU.
When I press MENU - MENU will open.
LEFT/RIGHT I use like UP/DOWN through menu. But I need to use LEFT/RIGHT to change values on LIST.
How can I check if menu item is list and then I invoke in code menu.right() or menu.left() to change values on list?
And after I exit from menu item LIST LEFT/RIGHT will work to change menu items..
Help?

ITEM_COMMAND not working

What happened?

ITEM_COMMAND("EXIT MENU", exitMenu));  //close menu and off backlight

void exitMenu()
{
  Serial.println("working");
  menu.resetMenu();
  menu.hide();
}

And function not invoking when presing ENTER.
But I can navigate throught menu, I can enter to submenu using ENTER.

Arduino & STM32F4.
Any ideas?

Version

3.3.2

What environment are you seeing the problem in?

Platform IO

Board type

blackpill STM32F4ccu6

Relevant log output

No response

[BUG]: Down-scroll arrow works incorrect (or at least differently from the Up-scroll one)

What happened?

Scrolling arrows should appear only in case if there are available menu items behind the menu's visible area (they show if you can still scroll above/below). The up-scroll arrow works properly: the arrow doesn't appear if there aren't available items above, perfect. But the down-scroll arrow doesn't disappear until the cursor is at the very bottom, even if the menu at very bottom.

To understand the issue better: the up-scroll arrow shows available items above menu and the down-scroll one shows available items below cursor.

It's not a very critical bug, but I would like it to be fixed. Maybe later I will create a pull request to this repo to fix this issue.

==> Explaining video <==

Version

3.5.4

What environment are you seeing the problem in?

No response

Board type

No response

Relevant log output

No response

Not working with ESP32

Getting errors something like this

Rebooting...
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d437a  PS      : 0x00060530  A0      : 0x800d4413  A1      : 0x3ffb1ee0  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x3ffc1104  A5      : 0x00000001  
A6      : 0x00060b20  A7      : 0x00000000  A8      : 0x80087bb0  A9      : 0x3ffb1e70  
A10     : 0x00000003  A11     : 0x00060b23  A12     : 0x00060b20  A13     : 0x00000001  
A14     : 0x00060b23  A15     : 0x00000000  SAR     : 0x00000016  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000008  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

ELF file SHA256: 0000000000000000

Backtrace: 0x400d437a:0x3ffb1ee0 0x400d4410:0x3ffb1f00 0x400d4431:0x3ffb1f20 0x400d4450:0x3ffb1f40 0x400d4461:0x3ffb1f60 0x400d4279:0x3ffb1f80 0x400d7042:0x3ffb1fb0 0x40086a75:0x3ffb1fd0

The issue is probably me

I'm working with your great library together with an encoder.
Things are moving, and happening.

But if I hover over a menu item, and push the encoder button all I can think of is to use menu.enter(); to use that menu choice.
but how can I go to any subroutine from there?
is it only possible with an ItemToggle?

since I use an encoder I added a submenu line "Back"
But after several tries I can't seem to get back to the main menu (menu.back(); wasn't accepted sadly) :(

sorry for this obvious questions, but if someone could help, that would be super nice.

Backlight support for non-I2C

I had to hack and add the last 2 parameters to new LiquidCrystal in order to get the backlight working.

#ifndef USE_STANDARD_LCD
        uint8_t lcd_Addr, MenuItem* menu) {
        lcd = new LiquidCrystal_I2C(lcd_Addr, maxCols, maxRows);
        lcd->init();
        lcd->backlight();
#else
        uint8_t rs, uint8_t en, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3,
        MenuItem* menu) {
        this->lcd = new LiquidCrystal(rs, en, d0, d1, d2, d3, DisplayBacklightPin, POSITIVE); // <---
        this->lcd->begin(maxCols, maxRows);
#endif

would be nice if this could be supported in the library.

How to change int values with menu?

Discussed in #47

Originally posted by JimmyRigIt October 13, 2021
Let me start out by saying, This menu system is AWESOME! So much easier to implement than 500 line sketches. Thanks for all the hard work.

I am building a powder coating oven controller and need to set a number of int variables from 0 to 600..... this would be a massive char list...... surly their must be a better way.

Next step is saving/loading the values from an SD card so i can save multiple "programs". Will post that here if i get it working.

e.g. use ItemRange menu type with min, max and step

Error: compiling example List.ino esp32

Discussed in #99

Originally posted by maansch June 14, 2023
Hi Thomas,
try to use the List.ino, during compiling I receive these error msg.

/home/mas/A_Prog_A/Arduino/libraries/LcdMenu/src/ItemList.h: In constructor 'ItemList::ItemList(const char*, String*, uint8_t, fptrInt)':
/home/mas/A_Prog_A/Arduino/libraries/LcdMenu/src/ItemList.h:34:21: error: 'ItemList::items' will be initialized after [-Werror=reorder]
String* items = NULL; ///< Pointer to an array of items
^
/home/mas/A_Prog_A/Arduino/libraries/LcdMenu/src/ItemList.h:33:24: error: 'void (* ItemList::callback)(uint8_t)' [-Werror=reorder]
fptrInt callback = NULL; ///< Pointer to a callback function
^
In file included from /tmp/arduino_modified_sketch_881776/List.ino:21:0:
/home/mas/A_Prog_A/Arduino/libraries/LcdMenu/src/ItemList.h:47:5: error: when initialized here [-Werror=reorder]
ItemList(const char* key, String* items, const uint8_t itemCount,
^
cc1plus: some warnings being treated as errors

Bibliothek LcdMenu in Version 3.0.1 im Ordner: /home/mas/A_Prog_A/Arduino/libraries/LcdMenu wird verwendet
Bibliothek LiquidCrystal_I2C in Version 1.1.4 im Ordner: /home/mas/A_Prog_A/Arduino/libraries/LiquidCrystal_I2C wird verwendet
Bibliothek Wire in Version 1.0.1 im Ordner: /home/mas/arduinoide/arduino-1.8.19_ESP32/portable/packages/esp32/hardware/esp32/1.0.6/libraries/Wire wird verwendet

exit status 1
Fehler beim Kompilieren für das Board ESP32 Dev Module.

Do you have an idea where the error could be?
I would be grateful for your help.

br
Marc-Andre

Code: example List.ino
environment : Arduino: 1.8.19 (Linux),
Board Typ: esp32
AZ-Delivery ESP-32Development-Board, ESP-WROOM-32 Prozessor 160MHz, Tensilica L108 32 bit Dual-Core CPU, 512 KB SRAM & 16 MB Flashspeicher.
Bord driver for testing:
Core Version 2.9.0
Core Version 1.6.0

Ability to change cursor appearance

Because it now seems hardcoded to a right arrow (→) a.k.a. 0x7E

Use case: I'd like to use a left arrow as well.

something like setCursorChar()?

[NEW] Add LCD timeout

The library should include an optional timeout.

void setTimeout(uint8_t timeout);
  • When the time elapses, the LCD is cleared and the backlight is switched off.
  • The LCD's state will be restored when a key is pressed (or if action invokes paint()).
  • When the timeout is set to zero, the LCD stays on as long as it is powered.
  • If no timeout is provided, a default of 5s is used.

Benefit

  • Save energy 🤷‍♂️🚮⚡

Using LiquidCrystal without I2C

I could figure out how to make it work with LiquidCrystal.h without I2C, but I could not make work for both with a #define directive
example #define NO_I2C for LiquidCrystal.h

Could you adapt you version for both systems "LiquidCrystal.h" and "LiquidCrystal_I2C.h"

[BUG]: Failed to install in Arduino IDE

What happened?

Upon pressing the install button I receive an error: Failed to install library: 'LcdMenu:3.3.3'. No valid dependencies solution found: dependency 'LiquidCrystal_I2C' is not available. I already have LiquidCrystal_I2C v1.1.2 installed.

I tried:

  • restarting the IDE
  • uninstalling LiquidCrystal_I2C
  • reinstalling LiquidCrystal_I2C
  • installing Lcd Menu v 3.3.2, 3.3.1, 3.2.0, 3.1.1, 3.0.1, 2.1.3, 1.2.0

Always getting the same error message

What worked:

  • Installing from ZIP

Version

3.3.3

What environment are you seeing the problem in?

Arduino

Board type

No response

Relevant log output

No response

[IMPROVEMENT] Make MenuGenerator accept extra params (v2.0.0)

The current implementation of generateMenu() uses only the name to generate the menu items, also the type is not used.

To do

  • Accept extra parameters textOn, textOff, value, callback.
  • Use a map (name::string, callback::fptr) to detect the callbacks to be attached to the menu item.
  • Add support appending generated menu to existing menu.
  • Benchmark MenuGenerator memory footprint.
  • Update menu generator docs.

[NEW-FEATURE] - LCD menu avec encodeur rotatif KY-040

Is your feature request related to a problem?

Bonjour,
Merci pour le travail que vous avez effectué sur cette bibliothèque, il va grandement me simplifier mon projet de doseuse à miel.

Je souhaiterais savoir s'il est possible d'utiliser votre bibliothèque avec un encodeur rotatif type KY-040, j'ai essayé de le faire, mais pour le moment les résultats ne sont pas probants (mes capacités en programmation sont très limitées)
Voici la bibliothèque que j'utilise pour mon encodeur rotatif : https://github.com/igorantolic/ai-esp32-rotary-encoder/blob/master/README_old.md

Merci d'avance pour ton aide

Sébastien

Describe the solution you'd like?

Fonctionnement de la bibliothèque LCDmenu avec encodeur rotatif KY-040

Describe alternatives you've considered

No response

Additional context

No response

Back from submenu

When returning from the submenu it does not return to the same line from which it was called

not taking EEPROM data

When the menu item is created, the initial data is assigned to the variable. But If I try to assign an EEPROM data it's not updating, it is taking the initial data only.
If I change the value from the Menu it is updating, but if I manually update the data outside the Menu it is not taking.

This will work
For ex:

//if this is my menu Item
ItemInput("ValueA", String(valueA), inputCallback)

//Inside inputCallback
if (selectedMenu == "ValueA") {
    valueA = value.toFloat();
    Serial.println("valueA: " + String(valueA));
  }

If I try to update "valueA" outside the inputCallBack it is not working
Something like this:

void updateA() {
  valueA = 10;
  menu.show();
}

Same for EEPROM data.

generatemenu compile error

Arduino: 1.8.15 (Linux), Board: "Arduino Uno"

arduino-builder -dump-prefs -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/allan/.arduino15/packages -tools /usr/share/arduino/hardware/tools/avr -tools /home/allan/.arduino15/packages -libraries /home/allan/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10815 -build-path /tmp/arduino_build_733096 -warnings=default -build-cache /tmp/arduino_cache_980456 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /home/allan/Arduino/GenerateMenu/GenerateMenu.ino
arduino-builder -compile -logger=machine -hardware /usr/share/arduino/hardware -hardware /home/allan/.arduino15/packages -tools /usr/share/arduino/hardware/tools/avr -tools /home/allan/.arduino15/packages -libraries /home/allan/Arduino/libraries -fqbn=arduino:avr:uno -ide-version=10815 -build-path /tmp/arduino_build_733096 -warnings=default -build-cache /tmp/arduino_cache_980456 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=/home/allan/.arduino15/packages/arduino/tools/arduinoOTA/1.3.0 -prefs=runtime.tools.avr-gcc.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=/home/allan/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7 -verbose /home/allan/Arduino/GenerateMenu/GenerateMenu.ino
Using board 'uno' from platform in folder: /usr/share/arduino/hardware/arduino/avr
Using core 'arduino' from platform in folder: /usr/share/arduino/hardware/arduino/avr
Build options changed, rebuilding all
Detecting libraries used...
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_BoseWave.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Denon.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Dish.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_DistanceProtocol.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_JVC.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Kaseikyo.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_LG.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Lego.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_MagiQuest.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_NEC.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Pronto.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_RC5_RC6.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Samsung.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Sony.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Template.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/Arduino-IRremote-master/src/ir_Whynter.cpp" -o "/dev/null"
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/home/allan/Arduino/libraries/LiquidCrystal/src/LiquidCrystal.cpp" -o "/dev/null"
Generating function prototypes...
"/usr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/tmp/arduino_build_733096/preproc/ctags_target_for_gcc_minus_e.cpp"
"/usr/bin/arduino-ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_733096/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/usr/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10815 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-I/usr/share/arduino/hardware/arduino/avr/cores/arduino" "-I/usr/share/arduino/hardware/arduino/avr/variants/standard" "-I/home/allan/Arduino/libraries/LcdMenu/src" "-I/home/allan/Arduino/libraries/Arduino-IRremote-master/src" "-I/home/allan/Arduino/libraries/LiquidCrystal/src" "-I/home/allan/Arduino/libraries/Neotimer/src" "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp" -o "/tmp/arduino_build_733096/sketch/GenerateMenu.ino.cpp.o"
In file included from /home/allan/Arduino/GenerateMenu/GenerateMenu.ino:25:0:
/home/allan/Arduino/libraries/Neotimer/src/neotimer.h:41:2: warning: ‘typedef’ was ignored in this declaration
};
^
/home/allan/Arduino/GenerateMenu/GenerateMenu.ino: In function ‘void setup()’:
GenerateMenu:59:41: error: no matching function for call to ‘LcdMenu::setupLcdWithMenu(int, MenuItem*&)’
menu.setupLcdWithMenu(0x27, mainMenu);
^
In file included from /home/allan/Arduino/GenerateMenu/GenerateMenu.ino:24:0:
/home/allan/Arduino/libraries/LcdMenu/src/LcdMenu.h:309:10: note: candidate: void LcdMenu::setupLcdWithMenu(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t, MenuItem*)
void setupLcdWithMenu(
^
/home/allan/Arduino/libraries/LcdMenu/src/LcdMenu.h:309:10: note: candidate expects 7 arguments, 2 provided
Using library LcdMenu at version 2.0.0-beta.2 in folder: /home/allan/Arduino/libraries/LcdMenu
Using library Arduino-IRremote-master at version 3.4.0 in folder: /home/allan/Arduino/libraries/Arduino-IRremote-master
Using library LiquidCrystal at version 1.0.7 in folder: /home/allan/Arduino/libraries/LiquidCrystal
Using library Neotimer at version 1.1.6 in folder: /home/allan/Arduino/libraries/Neotimer
exit status 1
no matching function for call to ‘LcdMenu::setupLcdWithMenu(int, MenuItem*&)’

[BUG] SubMenu problem

What happened?

Dear Thomas
I am asking for your help again. While testing SubMenu.ino, I noticed that the submenu text does not appear on the lcd when running SubMenu. This is also the case if I call the submenu from a submenu. I don't know if the problem is known. I couldn't find it on the github pages. The menu item syntax is good. The program editor does not give any errors, there are no translation errors. I looked through the .h files, but I don't know what I'm looking for. I thought it might be a type conflict, but I couldn't find any indication of this, or a version update...? Please deal with the problem.

#include <ItemSubMenu.h>
#include <LcdMenu.h>
Arduino: 1.8.19 (Windows 7), Motherboard: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)", LcdMenu version 3.0.0
Postscript:
I promise I'll close the topic when it's finished :)
Hi
Andrew

Version

3.0.0

What environment are you seeing the problem on?

Arduino

Board type

Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)

Relevant log output

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.