Giter VIP home page Giter VIP logo

arduinomenu's People

Contributors

christophepersoz avatar d21d3q avatar datacute avatar evfool avatar fa1ke5 avatar ferchinas avatar fmatray avatar grahamwhaley avatar hamidsaffari avatar ivankravets avatar joennuh avatar keldonin avatar knockoutperformance avatar koendv avatar luckyluzz avatar msh2050 avatar nagarjunredla avatar nathandarnell avatar neu-rah avatar per1234 avatar reaper7 avatar roboter avatar scls19fr avatar smplman avatar sphh avatar tamojitsaha avatar thijstriemstra avatar vladkozlov69 avatar welshcoder avatar yevgenb 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  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

arduinomenu's Issues

Serial Menu + Encoder. It is possible??

This library is just amazing!

Is there a possibility to use Serial Menu with Encoder?? I am using this Serial LCD but I need the encoder for the menu.

How may I achieve this?

Unable to compile after adding FIELD

Hi and thank for this great lib!
I got a issue, hope you can help me. After adding FIELD to the Main Manu in the I2C Example the Arduino IDE 1.6.9 is not able to comple the code.

MENU(mainMenu,"Main",
OP("Frequency",nothing),
OP("Dutty",nothing),
OP("Setup",nothing)
FIELD(frequency,"Freq","Hz",0,16000000,100,1,nothing()),
);

ERROR:

Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Thomas\Documents\Arduino\I2C_menu\I2C_menu.ino:20:0:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:123:28: error: expected constructor, destructor, or type conversion before '(' token

#define FIELD(...) FIELD_(COUNTER,VA_ARGS)

                        ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:95:26: note: in definition of macro 'DECL'

#define DECL(x) DECL_##x

                      ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:46:5: note: in expansion of macro 'FOR_EACH_2'

 FOR_EACH_2(what, __VA_ARGS__)

 ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:49:5: note: in expansion of macro 'FOR_EACH_3'

 FOR_EACH_3(what,  __VA_ARGS__)

 ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:38:37: note: in expansion of macro 'FOR_EACH_4'

#define CONCATENATE2(arg1, arg2) arg1##arg2

                                 ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:93:34: note: in expansion of macro 'FOR_EACH_'

#define FOR_EACH(what, x, ...) FOR_EACH_(FOR_EACH_NARG(x, VA_ARGS), what, x, VA_ARGS)

                              ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:99:5: note: in expansion of macro 'FOR_EACH'

 FOR_EACH(DECL,__VA_ARGS__)\

 ^

C:\Users\Thomas\Documents\Arduino\I2C_menu\I2C_menu.ino:28:1: note: in expansion of macro 'MENU'

MENU(mainMenu,"Main",

^

C:\Users\Thomas\Documents\Arduino\I2C_menu\I2C_menu.ino:32:3: note: in expansion of macro 'FIELD'

FIELD(frequency,"Freq","Hz",0,16000000,100,1,nothing()),

^

I2C_menu:28: error: 'mainMenu_data' was not declared in this scope

MENU(mainMenu,"Main",

  ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:103:26: note: in definition of macro 'MENU'

 menu id (text,sizeof(id##_data)/sizeof(prompt*),id##_data);

                      ^

I2C_menu:28: error: 'mainMenu_data' was not declared in this scope

MENU(mainMenu,"Main",

  ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-master/menu.h:103:53: note: in definition of macro 'MENU'

 menu id (text,sizeof(id##_data)/sizeof(prompt*),id##_data);

exit status 1
'mainMenu_data' was not declared in this scope

I2C_menu.zip

U8Glib and interactivity question

Hello,

I plan to use your fantastic menu library for an another project and I wonder if it is adaptable to use U8Glib graphic library instead of Adafruit library ?
Also, do you think that the menu behavior can act as an all interactive options available — I mean changing directly the values without changing the content of the display.

Thanks a lot !
Christophe

streamFlow.h

Hi,

Missing streamFlow.h

menu.h

include "../utils/streamFlow.h"

Use of a different Encoder library

Hello,

Do you think ids that possible to use an another Encoder library (https://github.com/0xPIT/encoder) with ArduinoMenu ? The library mentioned have some behaviors that are interesting for my project, but I'm not sure I can map it to your Menu Library and take advantage of Acceleration, Button Click, Held, Double Click, etc.
Also, I plan to run the Menu on a Teensy board and not an Arduino one, and I'm not sure that Teensy 3.2 require a PCInt remapping (and I also don't know how to do it !). Because of that I would like to Stream from ClickEncoder library instead of QuadEncoder.

If you can have a look, that could be great !
Thanks a lot.

ISO C++ forbids initialization of member...

Arduino: 1.0.6 (Mac OS X), Board: "Arduino Nano w/ ATmega328"
ISO C++ forbids initialization of member...

we have to move member initialization to the class constructors

FIELD menu usage

Hi! Thanks for this avesome library! It works very well, but i can not use Numeris Fields.
My code is at: github.com/szepnorbee/Menu_test/tree/master/menu_test_4

When i compile it i get an error:
variable 'menuField _menuField8' has initializer but incomplete type

I do not understand what I was doing wrong. Thank you for your help and sorry for my bad english.

Issue on build still with GCC under XCode

Hi Rui,

Hope you are good.

I'm still having a problem when I'm trying to build a Menu under Xcode IDE + embedXcode+. It seems that the GCC option are more restrictive or something like that and create error on build.

Here the one I'm getting on a really simple menu with 2 SELECT entry.

First error on macros.h
/Developer/_Arduino/libraries/Menu/src/macros.h:186:68: error: conversion from 'void()' to 'promptAction' is ambiguous

Second error on menuField.h
/Developer/_Arduino/libraries/Menu/src/menuFields.h:41:12: error: initializing argument 3 of 'menuValue<T>::menuValue(const char*, T, promptAction) [with T = unsigned char]'

uint8_t _prjId = 0;

void loadProject() {}
void saveProject() {}

SELECT( _prjId, loadPrj, "LOAD BANK ",
       VALUE( "1", 1, loadProject ),
       VALUE( "2", 2, loadProject ),
       VALUE( "3", 3, loadProject ),
       VALUE( "4", 4, loadProject ),
       VALUE( "5", 5, loadProject ),
       VALUE( "6", 6, loadProject ),
       VALUE( "7", 7, loadProject ),
       VALUE( "8", 8, loadProject ),
       VALUE( "9", 9, loadProject ),
       VALUE( "10", 10, loadProject ),
       VALUE( "11", 11, loadProject ),
       VALUE( "12", 12, loadProject )
       );

SELECT( _prjId, savePrj, "SAVE IN BANK ",
       VALUE( "1", 1, saveProject ),
       VALUE( "2", 2, saveProject ),
       VALUE( "3", 3, saveProject ),
       VALUE( "4", 4, saveProject ),
       VALUE( "5", 5, saveProject ),
       VALUE( "6", 6, saveProject ),
       VALUE( "7", 7, saveProject ),
       VALUE( "8", 8, saveProject ),
       VALUE( "9", 9, saveProject ),
       VALUE( "10", 10, saveProject ),
       VALUE( "11", 11, saveProject ),
       VALUE( "12", 12, saveProject )
       );

MENU( mPageA,"PROJECTS",
     SUBMENU( loadPrj ),
     SUBMENU( savePrj )
     );

Is there a way to fix it by adding some option on GCC or changing the code to solve the errors on build ? I would like to stay under Xcode IDE which provide much much more than the bad Arduino IDE to code under OS X ;)

Is the only way to avoid error is code the menu without Macro as you suggest in the Wiki ?
If yes, what is the correct syntax for TOGGLE, SELECT, FIELD and VALUE ?

Let me know if you need more informations.

Thanks !

Arduino Menu for ATmega644P

HI

i have tried with atmega2560. It is working fine.

But when i am trying with ATmega644A encoder is not working. It complains that "uC PCINT REVERSE MAP IS NOT DEFINED".

i have checked the pcint.h file and there are only two micros 328p and mega2560.
How do i add ATmega644P micro?

Please help.

setPosition() is no more working inside a SUBMENU

Hi ;)

I have notice in the latest version that setPosition() is no longer working when you are entering in a SUBMENU. So the position I'm defining just before the pool is only taken in account in the ROOT.

I've tried to change that in menuField.h, with no success. Do you have an idea ?

Examples won't compile out of the box

Just trying the samples included in the download.

The error I got after compile in Arduino IDE version 1.6.3: "streamFlow.h: No such file or directory"
Missing file?

Menu with ATmega 1284p

I'm trying to load a sketch with your menu system. However I got the following error: #error "uC PCINT REVERSE MAP IS NOT DEFINED"
I found in a previous issue that someone hat the same problem. I entered in the PCINT.h file the following line:

elif ( defined(AVR_ATmega1284) )

    const uint8_t PROGMEM pcintPinMap[4][8]={{A0,A1,A2,A3,A4,A5,A6,A7},{0,1,2,3,4,5,6,7},{16,17,18,19,20,21,22,23},{8,9,10,11,12,13,14,15}};

as you sugested in the previous issue.
I found the pin numbers on the follow site: https://github.com/NicoHood/PinChangeInterrupt.
Ben

ArduinoMenu v2.4 does not build on Teensy 3.1/3.2 due to PROGMEM

It is just a move of my feedback concerning the build of v2.4 on Teensy board.
Before posting it I tried to #include <avr/pgmspace.h> In menuFields.h but as you noticed this does not solve it. I saw some lib using the same functions that you are using for PROGMEM which seems working. I'm just wondering if it's not a problem related to Template/Macro

Here the build error I'm getting on Teensy board:

Arduino: 1.6.7 (Mac OS X), TD: 1.29, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimized (overclock), US English"

/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/christophepersoz/Developer/_Arduino/libraries" -fqbn=teensy:avr:teensy31:usb=serial,speed=96opt,keys=en-us -ide-version=10607 -build-path "/var/folders/93/95zp52wn3dq81d0dgrtmj_b80000gn/T/build0da4f63f4b42a48bacd9931d3ed57970.tmp" -warnings=none -verbose "/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino"
/Applications/Arduino.app/Contents/Java/arduino-builder -compile -logger=machine -hardware "/Applications/Arduino.app/Contents/Java/hardware" -tools "/Applications/Arduino.app/Contents/Java/tools-builder" -tools "/Applications/Arduino.app/Contents/Java/hardware/tools/avr" -built-in-libraries "/Applications/Arduino.app/Contents/Java/libraries" -libraries "/Users/christophepersoz/Developer/_Arduino/libraries" -fqbn=teensy:avr:teensy31:usb=serial,speed=96opt,keys=en-us -ide-version=10607 -build-path "/var/folders/93/95zp52wn3dq81d0dgrtmj_b80000gn/T/build0da4f63f4b42a48bacd9931d3ed57970.tmp" -warnings=none -verbose "/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino"
Build options changed, rebuilding all

...

"/Applications/Arduino.app/Contents/Java/tools-builder/ctags/5.8-arduino5/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/var/folders/93/95zp52wn3dq81d0dgrtmj_b80000gn/T/build0da4f63f4b42a48bacd9931d3ed57970.tmp/preproc/ctags_target_for_gcc_minus_e.cpp"
"/Applications/Arduino.app/Contents/Java/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++" -c -O -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -fno-exceptions -felide-constructors -std=gnu++0x -fno-rtti -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -D__MK20DX256__ -DTEENSYDUINO=129 -DARDUINO=10607 -DF_CPU=96000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-I/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/cores/teensy3" "-I/Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SPI" "-I/Users/christophepersoz/Developer/_Arduino/libraries/U8g_teensy" "-I/Users/christophepersoz/Developer/_Arduino/libraries/U8glib" "-I/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src" "/var/folders/93/95zp52wn3dq81d0dgrtmj_b80000gn/T/build0da4f63f4b42a48bacd9931d3ed57970.tmp/sketch/U8Glib_ClickEncoder_Teensy_Demo.ino.ino.cpp" -o "/var/folders/93/95zp52wn3dq81d0dgrtmj_b80000gn/T/build0da4f63f4b42a48bacd9931d3ed57970.tmp/sketch/U8Glib_ClickEncoder_Teensy_Demo.ino.ino.cpp.o"
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:29:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:102:8: warning: extra tokens at end of #endif directive [enabled by default]
 #endif RSITE_ARDUINOP_MENU_LCD
        ^
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:27:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h: In constructor 'menuOut::menuOut(int, int, int, int)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:48:9: warning: 'menuOut::maxY' will be initialized after [-Wreorder]
     int maxY;
         ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:45:9: warning:   'int menuOut::top' [-Wreorder]
     int top;//top for this device
         ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:56:12: warning:   when initialized here [-Wreorder]
     inline menuOut(int x=0x7F,int y=0x7F,int resX=1,int resY=1)
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:51:9: warning: 'menuOut::resY' will be initialized after [-Wreorder]
     int resY;
         ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:44:11: warning:   'menu* menuOut::drawn' [-Wreorder]
     menu* drawn;//last drawn menu, avoiding clear/redraw
           ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:56:12: warning:   when initialized here [-Wreorder]
     inline menuOut(int x=0x7F,int y=0x7F,int resX=1,int resY=1)
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h: In constructor 'prompt::prompt(const char*)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:123:10: warning: 'prompt::enabled' will be initialized after [-Wreorder]
     bool enabled;
          ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:121:18: warning:   'promptAction prompt::action' [-Wreorder]
     promptAction action;
                  ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:124:12: warning:   when initialized here [-Wreorder]
     inline prompt(const char * text):text(text),enabled(true),action(nothing) {}
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h: In constructor 'menuNode::menuNode(const char*)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:141:12: warning: 'menuNode::oy' will be initialized after [-Wreorder]
     int ox,oy;//coordinate origin displacement
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:140:9: warning:   'int menuNode::width' [-Wreorder]
     int width;//field or menu width
         ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:145:12: warning:   when initialized here [-Wreorder]
     inline menuNode(const char * text):prompt(text),ox(0),oy(0),width(32),previousMenu(NULL) {}
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h: In constructor 'menuNode::menuNode(const char*, promptAction)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:141:12: warning: 'menuNode::oy' will be initialized after [-Wreorder]
     int ox,oy;//coordinate origin displacement
            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:140:9: warning:   'int menuNode::width' [-Wreorder]
     int width;//field or menu width
         ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menu.h:146:12: warning:   when initialized here [-Wreorder]
     inline menuNode(const char * text,promptAction action):prompt(text,action),ox(0),oy(0),width(32) {}
            ^
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:28:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In member function 'virtual bool menuVariant<T>::needRedraw(menuOut&, bool)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:139:56: error: there are no arguments to 'pgm_read_ptr_near' that depend on a template parameter, so a declaration of 'pgm_read_ptr_near' must be available [-fpermissive]
    bool nr=((menuValue<T>*)pgm_read_ptr_near(&data[sel]))->value!=target;//||p.lastSel!=sel;
                                                        ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:139:56: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In member function 'void menuVariant<T>::sync()':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:147:52: error: there are no arguments to 'pgm_read_ptr_near' that depend on a template parameter, so a declaration of 'pgm_read_ptr_near' must be available [-fpermissive]
      if (((menuValue<T>*)pgm_read_ptr_near(&data[n]))->value==target)
                                                    ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In member function 'virtual void menuVariant<T>::printTo(menuOut&)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:153:42: error: there are no arguments to 'pgm_read_ptr_near' that depend on a template parameter, so a declaration of 'pgm_read_ptr_near' must be available [-fpermissive]
    ((prompt*)pgm_read_ptr_near(&data[sel]))->printTo(p);
                                          ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In member function 'virtual bool menuSelect<T>::needRedraw(menuOut&, bool)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:182:67: error: there are no arguments to 'pgm_read_ptr_near' that depend on a template parameter, so a declaration of 'pgm_read_ptr_near' must be available [-fpermissive]
    return ((menuValue<T>*)pgm_read_ptr_near(&menu::data[menu::sel]))->value!=menuVariant<T>::target;
                                                                   ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In member function 'virtual void menuSelect<T>::printTo(menuOut&)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:188:54: error: there are no arguments to 'pgm_read_ptr_near' that depend on a template parameter, so a declaration of 'pgm_read_ptr_near' must be available [-fpermissive]
    ((prompt*)pgm_read_ptr_near(&menu::data[menu::sel]))->printTo(p);
                                                      ^
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:29:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h: In constructor 'menuU8G::menuU8G(U8GLIB&, unsigned char, unsigned char, unsigned char, unsigned char, uint8_t, uint8_t)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:31:13: warning: 'menuU8G::gfx' will be initialized after [-Wreorder]
     U8GLIB& gfx;
             ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:25:18: warning:   'unsigned char menuU8G::bgColor' [-Wreorder]
    unsigned char bgColor;
                  ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:32:5: warning:   when initialized here [-Wreorder]
     menuU8G(
     ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:27:18: warning: 'menuU8G::disabledColor' will be initialized after [-Wreorder]
    unsigned char disabledColor;
                  ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:24:18: warning:   'unsigned char menuU8G::hiliteColor' [-Wreorder]
    unsigned char hiliteColor;
                  ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:32:5: warning:   when initialized here [-Wreorder]
     menuU8G(
     ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:29:17: warning: 'menuU8G::disabledColorHi' will be initialized after [-Wreorder]
   unsigned char disabledColorHi;
                 ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:48:63: warning:   base 'menuOut' [-Wreorder]
     menuOut(gfx.getWidth()/resX,gfx.getHeight()/resY,resX,resY)
                                                               ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:32:5: warning:   when initialized here [-Wreorder]
     menuU8G(
     ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h: In member function 'virtual void menuU8G::printMenu(menu&, bool)':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuU8G.h:92:56: error: 'pgm_read_ptr_near' was not declared in this scope
      printPrompt(*(prompt*)pgm_read_ptr_near(&m.data[i]),i == m.sel,i+1,m.ox,(i-top)+m.oy,m.width);
                                                        ^
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:28:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'menuField<T>::menuField(T&, const char*, const char*, T, T, T, T, bool (*)()) [with T = int]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:69:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:57:26: warning: 'menuField<int>::func' will be initialized after [-Wreorder]
   promptFeedback (*func)();
                          ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:56:8: warning:   'bool menuField<int>::tunning' [-Wreorder]
   bool tunning;
        ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:60:3: warning:   when initialized here [-Wreorder]
   menuField(T &value,const char * text,const char *units,T low,T high,T step,T tune=0,promptFeedback (*func)()=nothing)
   ^
In file included from /Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:28:0:
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'void menuVariant<T>::sync() [with T = bool]':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:261:64:   required from 'menuToggle<T>::menuToggle(const char*, unsigned int, menuValue<T>* const*, T&) [with T = bool]'
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:59:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:147:52: error: 'pgm_read_ptr_near' was not declared in this scope
      if (((menuValue<T>*)pgm_read_ptr_near(&data[n]))->value==target)
                                                    ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'void menuVariant<T>::sync() [with T = int]':
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:226:64:   required from 'menuChoice<T>::menuChoice(const char*, unsigned int, menuValue<T>* const*, T&) [with T = int]'
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:81:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:147:52: error: 'pgm_read_ptr_near' was not declared in this scope
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'void menuVariant<T>::printTo(menuOut&) [with T = int]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:153:42: error: 'pgm_read_ptr_near' was not declared in this scope
    ((prompt*)pgm_read_ptr_near(&data[sel]))->printTo(p);
                                          ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'bool menuVariant<T>::needRedraw(menuOut&, bool) [with T = int]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:139:56: error: 'pgm_read_ptr_near' was not declared in this scope
    bool nr=((menuValue<T>*)pgm_read_ptr_near(&data[sel]))->value!=target;//||p.lastSel!=sel;
                                                        ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'bool menuChoice<T>::activate(menuOut&, Stream&, bool) [with T = int]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:244:76: error: 'pgm_read_ptr_near' was not declared in this scope
     menuValue<T>* cp=(menuValue<T>*)pgm_read_ptr_near(&this->menu::data[op]);
                                                                            ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'void menuVariant<T>::printTo(menuOut&) [with T = bool]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:153:42: error: 'pgm_read_ptr_near' was not declared in this scope
    ((prompt*)pgm_read_ptr_near(&data[sel]))->printTo(p);
                                          ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'bool menuVariant<T>::needRedraw(menuOut&, bool) [with T = bool]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:139:56: error: 'pgm_read_ptr_near' was not declared in this scope
    bool nr=((menuValue<T>*)pgm_read_ptr_near(&data[sel]))->value!=target;//||p.lastSel!=sel;
                                                        ^
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h: In instantiation of 'bool menuToggle<T>::activate(menuOut&, Stream&, bool) [with T = bool]':
/Users/christophepersoz/Library/Mobile Documents/com~apple~CloudDocs/Developer/_Arduino/libraries/Menu/examples/U8Glib_ClickEncoder_Teensy_Demo.ino/U8Glib_ClickEncoder_Teensy_Demo.ino.ino:121:1:   required from here
/Users/christophepersoz/Developer/_Arduino/libraries/Menu/src/menuFields.h:268:82: error: 'pgm_read_ptr_near' was not declared in this scope
    menuValue<T>* cp=(menuValue<T>*)pgm_read_ptr_near(&this->menu::data[menu::sel]);
                                                                                  ^
Using library SPI at version 1.0 in folder: /Applications/Arduino.app/Contents/Java/hardware/teensy/avr/libraries/SPI 
Using library U8g_teensy in folder: /Users/christophepersoz/Developer/_Arduino/libraries/U8g_teensy (legacy)
Using library U8glib in folder: /Users/christophepersoz/Developer/_Arduino/libraries/U8glib (legacy)
Using library Menu at version 2.4 in folder: /Users/christophepersoz/Developer/_Arduino/libraries/Menu 
Error compiling for "Teensy 3.2 / 3.1"

And for both, the Sketch U8Glib_ClickEncoder_Teensy_Demo.ino.ino is the one include in the v2.4 named U8Glib_menu.ino with the following changes at the beginning to have the same Sketch for 2 different boards.

#include <avr/pgmspace.h>
#if defined(__AVR_ATmega2560__)
  #include <U8glib.h>
#elif defined (__MK20DX256__) || defined(__MK20DX128__) // Teensy 3.2, 3.1 and 3.0
  #include <SPI.h>          // SPI transaction library
  #include <U8g_teensy.h>   // OLED display driver u8g_teensy
#else
  #error "DEFINE YOUR BOARD TYPE HERE"
#endif


#include <menu.h>//menu macros and objects
#include <menuFields.h>
#include <menuU8G.h>

#define U8_DC 9
#define U8_CS 10
#define U8_RST 7


#if defined(__AVR_ATmega2560__)
  U8GLIB_NHD31OLED_GR u8g(U8_CS, U8_DC, U8_RST); 
  //U8GLIB_PCD8544 u8g(U8_CS, U8_DC, U8_RST) ;
#elif defined (__MK20DX256__) || defined(__MK20DX128__) // Teensy 3.2, 3.1 and 3.0
  U8GLIB u8g(&u8g_dev_ssd1322_nhd31oled_2x_gr_hw_spi, u8g_com_hw_spi_fn); // HW SPI Com: CS = 10, A0 = 9 (Hardware Pins are  SCK = 13 and MOSI = 11)
#else
  #error "U8GLIB DISPLAY NEEDED"
#endif


menuU8G gfx(u8g,1,0,1,1,7,9);

As you see, there much is much more issues on Teensy. Maybe they are all linked. The main concern is pgm_read_ptr_near() which is not recognized.

It's a good idea to introduce the use of #define USEPGM. Teensy have a lot of SRAM and that will allows us to test the v2.4 ;)
Thanks a lot

PCINT on atmega328

PCInt status is not being correctly signaled on PCINT status map for atmega328
cause interrupt vector to be called only once, therefor encoder is not working on atmega328
atmega2560 seems to work fine

how to force menu refresh?

hello
Can't find the way to force refresh (redraw) of menu, got some "fields" which variables are changing and would like them to appear updated in the menu without need of moving in menus.
thanks

Question about hierarchy position feedback

Hi Rui,

I have a mainMenu that contains 5 SUBMENU (direct sibling).
Is that possible after calling mainMenu.poll() to have a feedback of which SUBMENU I clicked on ?
Only the first level interest me.

I tried to add just after the pool an action on the first SUBMENU with the following trigger code

 PageA.action = trig;

But it removes the poll of the SUBMENU PageA, so the SUBMENU does not shows up as it should.

I know that mainMenu.sel returns me the level of the SUBMENU, but I don't know if I did clicked it to enter in or no.

I there a workaround to have this feedback ?
Thank you.

What's to change when updating 2.0 to 2.4?

Hey,
got a bit time and wanted update to 2.4 cause of PROGMEM feature. Got a lot compile errors. Some known things to change in my project?

Thanks!

Arduino: 1.6.9 (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino:14:0:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h: In member function 'virtual void menuLCD::printMenu(menu&, bool)':

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:47:85: error: no matching function for call to 'menuLCD::printPrompt(prompt&, bool, int, int, int&)'

       printPrompt(*(prompt*)pgm_read_ptr_near(&m.data[i]),i==m.sel,i+1,i-top,m.width);

                                                                                     ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:47:85: note: candidate is:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:35:16: note: virtual void menuLCD::printPrompt(prompt&, bool, int, int, int, int)

   virtual void printPrompt(prompt &o,bool selected,int idx,int posX,int posY,int width) {

                ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:35:16: note:   candidate expects 6 arguments, 5 provided

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:50:61: error: no matching function for call to 'menuLCD::printPrompt(prompt&, bool, int, int, int&)'

     printPrompt(menu::exitOption,m.sel==m.sz,0,i-top,m.width);

                                                             ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:50:61: note: candidate is:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:35:16: note: virtual void menuLCD::printPrompt(prompt&, bool, int, int, int, int)

   virtual void printPrompt(prompt &o,bool selected,int idx,int posX,int posY,int width) {

                ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menuLCDs.h:35:16: note:   candidate expects 6 arguments, 5 provided

In file included from C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:36:0,

                 from C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino:13:

C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino: At global scope:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:162:41: error: conversion from 'void()' to 'promptAction' is ambiguous

   prompt op##cnt(title_##cnt,__VA_ARGS__);

                                         ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:117:17: note: in expansion of macro 'DECL_OP_'

 #define DECL(x) DECL_##x

                 ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:12:34: note: in expansion of macro 'DECL'

 #define FOR_EACH_1(what, x, ...) what(x)

                                  ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:15:3: note: in expansion of macro 'FOR_EACH_1'

   FOR_EACH_1(what,  __VA_ARGS__)

   ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:18:3: note: in expansion of macro 'FOR_EACH_2'

   FOR_EACH_2(what, __VA_ARGS__)

   ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:10:35: note: in expansion of macro 'FOR_EACH_3'

 #define CONCATENATE2(arg1, arg2)  arg1##arg2

                                   ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:112:32: note: in expansion of macro 'FOR_EACH_'

 #define FOR_EACH(what, x, ...) FOR_EACH_(FOR_EACH_NARG(x, __VA_ARGS__), what, x, __VA_ARGS__)

                                ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/macros.h:121:3: note: in expansion of macro 'FOR_EACH'

   FOR_EACH(DECL,__VA_ARGS__)\

   ^

C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino:95:1: note: in expansion of macro 'MENU'

 MENU(subDateTime, "Date/Time",

 ^

C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino:76:6: note: candidates are:

 void setTimeRTC()

      ^

In file included from C:\Users\Thomas\Documents\Arduino\Projects\Aquarium\ArduinoMenu_I2C_LCD_16x2_RotaryEncoder\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13\ArduinoMenu_I2C_LCD_RotaryEncoder-2016.09.13.ino:13:0:

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:109:10: note: promptAction::promptAction(promptAction::callback) <near match>

   inline promptAction(callback f):hFn(f) {}

          ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:109:10: note:   no known conversion for argument 1 from 'void()' to 'promptAction::callback {aka bool (*)(prompt&, menuOut&, Stream&)}'

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:108:10: note: promptAction::promptAction(bool (*)(prompt&, menuOut&)) <near match>

   inline promptAction(promptFeedback (*f)(prompt&,menuOut&)):hFn((callback)f) {}

          ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:108:10: note:   no known conversion for argument 1 from 'void()' to 'bool (*)(prompt&, menuOut&)'

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:107:10: note: promptAction::promptAction(bool (*)(prompt&)) <near match>

   inline promptAction(promptFeedback (*f)(prompt&)):hFn((callback)f) {}

          ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:107:10: note:   no known conversion for argument 1 from 'void()' to 'bool (*)(prompt&)'

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:106:12: note: promptAction::promptAction(bool (*)()) <near match>

     inline promptAction(promptFeedback (*f)()):hFn((callback)f) {}

            ^

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:106:12: note:   no known conversion for argument 1 from 'void()' to 'bool (*)()'

C:\Users\Thomas\Documents\Arduino\libraries\ArduinoMenu-2.4\src/menu.h:125:12: error:   initializing argument 2 of 'prompt::prompt(const char*, promptAction)'

     inline prompt(const char * text,promptAction action)

            ^

exit status 1
Error compiling for board Arduino/Genuino Uno.

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

Dynamic menu labels

Hi @neu-rah, its me again!!

There is a way to make dynamic menu names? So if I change somenthing in a function then will change the name in the menu.

For example:

If I have a menu item with name: Start Time XX:XX

When I setup this time to YY:YY, when I return to the menu its shows Start Time YY:YY.

Thanks,
Nico.

enter menu

is it possible to have a homescreen on the lcd. and with press on encoder button, entering the menu?

Recommended way to detect top-level exit was pressed?

Hi, I love the library though I struggle to understand using it sometimes !

What do you recommend for detecting that top-level exit is pressed when using the "canExit=true" mechanism? I don't need to detect sub-menu exit.

On a side note, my submenus don't seem to be showing "exit", but rather a duplicate of the last submenu entry

Using ST7920 GLCD

Is I possible to use a GLCD with ST7920 chip with your library?

Ben

Problem with activeMenu

Hi, I would like to display (overlay) a time function in only selected submenus with the following code:
menuNode::activeMenu;// is the current menu
menuNode::activeMenu->sel;// is the index of selected option (hilited), zero based

But it seems there is no activeMenu (compiler says: error: 'activeMenu' is not a member of 'menuNode').

I am trying to overlay a submenu with this example in my function:
if (menuNode::activeMenu==myMenuName) {
thenOverlayMyTimeCodeInTopRight :)
}

chainStream.h peek and read returns -1 on Teensy

Hi Rui,

I discover that chainstream.h and particularly peek() and read() returns -1 every twice move or click when used with ClickEncoder. The clickencoderstream seems working well, but when I'm tracing on Serial the values returned by chainstream there is this -1 that creates missed clicks or move of the encoder. At this time the workaround I found is to replace the -1 by 1 ( not really academic I admit). I don't know if this is linked to ARM platform. I don't have a Arduino to test it.

Thanks

Thanks and two questions

Hi. really cool menu :)
took me a while but managed to figure it out. I think it would be easier for people if you could make your examples a bit more complex.
By this I mean:

  1. add some submenu (1 level or even 2 levels down) just so people can figure out easily how to construct complex menu.
  2. the toggle part was nice, but it would be great if you would add also some function calling, not only variable changing. for a beginner like me it would be easier to figure out everything. I am not a programmer, but an el. engineer. I like to tinker. i know how to program at a decent level (nothing fancy) but my lack of experience, makes it very hard for me to implement stuff, and it's easier just to construct by copy-pasting.

Now my questions:

  1. Could you maybe make the menu to have also a background/screensaver (i have no idea what to call it). Similar to what you will find on a 3d printer.
    a screen where you can see stats (whatever people want) and you first have to press select/enter to go into the actual menu. and when the menu times out, or you press exit, to go back to that stats screen.
    would this be possible?

  2. would it be possible to add a time out function. if you don't touch anything for 30 sec/1 min the menu goes back to the main page?

Once again thank you very much.

v2.3 do not build

Hello !

Can you tell me if the 2.3 can be build out of the box with the U8Glib.ino I sent you ? I'm getting a lot of error linked to promptAction() and prompt() from menu.h

So, I'm going back to 2.2 at this time.

Otherwise, I tried to figure it out what's going on with FIELD() in edit mode (refresh issues), without any success - did you find something relevant on your side?

Thanks

Changing CHOOSE or TOGGLE behavior on graphic display

Me again :D

Can you tell me where is the CHOOSE or TOGGLE behavior and methods in the lib ? I would like to change the way how the values are displayed - On graphic display you often have enough room to do that.So, I though to something like that :

Menu Choose/Toggle selected > Click (will stay on the menu screen) to edit value > Up/Down will change the value with datas from the VALUE fields > Click to validate changes.

I don't know which one is the easiest to change, maybe TOGGLE.
What do you think ?

Text fields, providing methods for text entry

Hi Rui,

I'm keep going on my dev and since I stop the test and move back to my dev environment (Xcode 7.3.1 + embedXcode+ ) I'm getting some errors on build. I think the compiler is more restrictive than the one on Arduino IDE (I'm still looking for a way to change that).

Here are the errors that pops up on build (I got them several times, but it's always the same in a way).

1.Error on promptAction, Menu/src/macros.h:186:68: error: conversion from 'void()' to 'promptAction' is ambiguous

  1. Menu/src/macros.h:179:41: error: 'menuTextField' does not name a type
    (it seems that the Macro for TEXTFIED isn't working)
  2. Menu/src/macros.h:178:94: error: invalid conversion from 'void (*)()' to 'bool (*)()' [-fpermissive]
    It seems that activate the -fpermissive option on the compiler can turn this error into warning (looking for that)
  3. Menu/src/menuFields.h:59:3: error: initializing argument 8 of 'menuField<T>::menuField(T&, const char*, const char*, T, T, T, T, bool (*)()) [with T = unsigned char]' [-fpermissive]
  4. Menu/src/menuFields.h:41:12: error: initializing argument 3 of 'menuValue<T>::menuValue(const char*, T, promptAction) [with T = unsigned char]'
  5. Menu/src/macros.h:190:34: error: '_menuTextField24' was not declared in this scope
    (I'm trying to use the TEXTFIELD() to have a project name edited, not sure that it works)
  6. Menu/src/macros.h:190:34: error: '_menuTextField26' was not declared in this scope
  7. Menu/src/menu.h:124:12: error: initializing argument 2 of 'prompt::prompt(const char*, promptAction)'

Any idea or clue to solve that - maybe be that there is some dev trick to avoid them ? On the other hand I ask some help to embedXcode developper to find out a solution for -fpermissive on build which can solve a lot.

Thanks and have a great day !

Text fields

received suggestion from Alex

Thank you for your Arduino menu, I run it on esp8266 device and it works good!
Can you add ability to edit string via menu?

Strange behavior with ClickEncoderStream.h

Hi Rui,

I'm still going on my project and Teensy debug, and I'm still notice a bug I mentioned you when you were working on PROGMEM issue. I thought it was OK since then, but it is not ;)
Here the problem :

• On Serial and Display, the encoder is restricted to lines 1 and 2 of the menu, even if the menu have more lines.
• The strange behavior is, if the line 2 is a FIELD, I can edit the value (limited to the first 2 values on a SELECT or a TOGGLE), validate it, and then the limitation shift of one line. So after that I can only select lines 2 and 3, and so on. The range is still limited to 2 lines.
• Linked to that, the cycling navigation does not work.

Any ideas of what's going wrong with the navigation ? It was working well on v2.1 if I remind me well.
I will check the values by putting some Serial outputs on QuadEncoder changes to see what's going on. If on your side you have an idea...

Thanks !
Christophe

CHOOSE submenu draw & behavior?

The "CHOOSE" submenu has a "hiden" non selelectable menu-item at bottom of menu if the value list contains number of members less than .maxY and has a doubled, also non selectale item if more or equal.
Is it a bug?
And a second question. How I can add an "Exit" option to the "Choose" submenu?
I suspect that these two questions are interdependent :)

Add a function on SUBMENU call

Hello,

You menu is great to create complex structure and easy debugging/navigation/use, thanks a lot to share it.
Now that I'm much more comfortable with your library, I would like to expand it and add a function on SUBMENU call. Is that possible ? I tried but it seems that is only possible for OP, FIELD and VALUE.
Any track to follow ?
This will allows to launch several actions entering a sub-menu instead of doing it inside the loop by testing the level of the current menu.

Thanks in advance

Reduction of memory usage?

Hey,
I got my Menu quiet finished and now it takes up to 30% of program storage space and about 50% of dynamic memory on an UNO. Is it possible to reduce the footprint?

//*-------------------------------------------------------------------------------------------------------------------------------------
// MENU DEFINITION
//*-------------------------------------------------------------------------------------------------------------------------------------

  TOGGLE(Firti_ManualON,Ferti_TOG,"PumpMan     ",
  VALUE("On",HIGH),
  VALUE("Off",LOW)
);
MENU(subMenuTimer, "Fertilization",
     SUBMENU(Ferti_TOG),
     FIELD(FertiPumpSpeed ,       "PumpSpeed  ", "%", 0, 60, 1, 0),
     FIELD(Ferti_StartTime,       "StartTime  ", "h", 0, 24, 1, 0),
     FIELD(Ferti_DurationTime ,   "Duration   ", "s", 0, 60, 1, 0)
    );

MENU(subDateTime, "Date/Time",
     FIELD(hour1 ,   "Hour    ", " ", 0, 24, 1, 0),
     FIELD(minute1 , "Minute  ", " ", 0, 60, 1, 0),
     OP("SaveClockMemory", setTimeRTC)
    );

MENU(subMenuTemperature,  "Temp/Light/PID",
     FIELD(TempSetpoint,   "SetPoint", "C", 15, 30, 1, 0),
     FIELD(TempAlarm,      "Alarm   ", "C", 15, 30, 1, 0),
     FIELD(PID_AutoManOff, "PID Mode   ", "", 0, 3, 1, 0),
     FIELD(Xd,             "PID Xd     ", "", 0, 10, 1, 0),
     FIELD(Xi,             "PID Xi     ", "", 0, 10, 1, 0),
     FIELD(Xs,             "PID Xs     ", "", 0, 10, 1, 0),
     FIELD(PID_MAN,        "PID MAN-Y  ", "%", 0, 100, 1, 0),
     FIELD(LightMaxY,      "PID MaX-Y  ", "%", 50, 100, 1, 0),
     FIELD(LightMinY,      "PID MiN-Y  ", "%", 0, 50, 0, 0),
     FIELD(LightOn ,       "Light On   ", "h", 0, 24, 1, 0),
     FIELD(LightOff ,      "Light Off  ", "h", 0, 24, 1, 0)
    );

MENU(mainMenu, "Aquarium",
     SUBMENU(subMenuTemperature),
     SUBMENU(subMenuTimer),
     SUBMENU(subDateTime),
     OP("Exit", pauseMenu)
    );


Refreshrate of Menu

Hi,
I have an analoginput as value in a FIELD to show it on Homescreen. But now it's only refreshing the screen when I navigate thru the Menu. Is there a way to refresh it faster?

MENU(mainMenu,"Aquarium", FIELD(TempInput,"Temp "," C",0,0,0,0), FIELD(TempOutputProzent,"Light "," %",0,0,0,0), SUBMENU(subMenuSettings) );
ArduinoMenu_I2C_LCD_RotaryEncoder-2016.07.22.zip

menuLCDs.h error

If compile I2C menu example, I get error in printPrompt function:

/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h: In member function 'virtual void menuLCD::printMenu(menu&, bool)':
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:47:77: error: no matching function for call to 'menuLCD::printPrompt(prompt&, bool, int, int, int&)'
       printPrompt(*(prompt*)pgmPtrNear(m.data[i]),i==m.sel,i+1,i-top,m.width);
                                                                             ^
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:47:77: note: candidate is:
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:35:16: note: virtual void menuLCD::printPrompt(prompt&, bool, int, int, int, int)
   virtual void printPrompt(prompt &o,bool selected,int idx,int posX,int posY,int width) {
                ^
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:35:16: note:   candidate expects 6 arguments, 5 provided
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:50:61: error: no matching function for call to 'menuLCD::printPrompt(prompt&, bool, int, int, int&)'
     printPrompt(menu::exitOption,m.sel==m.sz,0,i-top,m.width);
                                                             ^
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:50:61: note: candidate is:
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:35:16: note: virtual void menuLCD::printPrompt(prompt&, bool, int, int, int, int)
   virtual void printPrompt(prompt &o,bool selected,int idx,int posX,int posY,int width) {
                ^
/Users/dontsov/Documents/Arduino/libraries/ArduinoMenu-master/src/menuLCDs.h:35:16: note:   candidate expects 6 arguments, 5 provided

I prepare, you need add 'index' argument when call 'printPrompt':

printPrompt((prompt)pgmPtrNear(m.data[i]),i==m.sel, i, i+1,i-top,m.width);
printPrompt(menu::exitOption,m.sel==m.sz, 0, 0,i-top,m.width);

use PROGMEM

move as mutch as possible to progmem.. this is needed for uno, but we will loose hability to have dynamic things.... can we have both?

Serial (TX only) with Encoder

Hello,

Is there a way to use serLCD.h instead of the library you had implemented ? I'm using that library to communicate with a 1 wire serial LCD which are not supported yet by the LCD Libraries included.

Thank you

Consolidate API

API proposals

utility functions

new memory mode (PROGMEM) makes it horrible to set simple things like prompt enable/disable.

add aux function to ez this
eventually add extra macro parameter

customization

send customization variables to PROGMEM (static const)

allow static customization... what is the best way of doing it?

non-block encoder button

Encoder button (and possibly other button types) are blocking until the button is released....
make this non-blocking

Progmem

Move menu structures into progmem...

Compile problem with FIELD

Hello Rui, wrote an email yesterday but found the forum now, sorry for that:

I found your Arduino-Menue Lib in youtube. Its really a cool thing which saves a lot of time in coding embedded application. I would like to use it in my Balancing Robot project. It took me no affords to get the example code with the i2c lcd running in my arduino 1.0.6 ide on windows. But if i add a FIELD menue entry the compiler throws out an error:

I2C_menu:34: error: variable 'menuField<const char [5]> _menuField0' has initializer but incomplete type

the modified Code is here

/********************
Arduino generic menu system
Arduino menu on I2C LCD example
http://www.r-site.net/?at=//op%5B%40id=%273090%27%5D

Sep.2014 Rui Azevedo - ruihfazevedo(@rrob@)gmail.com
creative commons license 3.0: Attribution-ShareAlike CC BY-SA
This software is furnished "as is", without technical support, and with no
warranty, express or implied, as to its usefulness for any purpose.

Thread Safe: No
Extensible: Yes

LCD library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
http://playground.arduino.cc/Code/LCD3wires
*/

include <Wire.h>

include <LiquidCrystal_I2C.h>

include <menu.h>//menu macros and objects

include <menuLCDs.h>//F. Malpartida LCD's

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
menuLCD menu_lcd(lcd,16,2);//menu output device

int para=0;
void nothing() {}

MENU(mainMenu,"Main",
FIELD(para,"Para","Unit",0,1000,10,1,nothing),
OP("Frequency",nothing),
OP("Dutty",nothing),
OP("Setup",nothing)
);

void setup()
{
Serial.begin(9600);
Wire.begin();
lcd.begin(16,2);
lcd.print("Ok");
}

void loop()
{
//serial can use numbers or +/- and Enter=* Esc=/ to navigate (nav keys can be redefined)
mainMenu.poll(menu_lcd,Serial);
}

Maybe you can be so kind and point me to the right way cause my knowledge in #-directive is very weak (yes i am a spoiled java-guy in real life;-))

greetings from austria and thanks

robert

How to exit from main menu?

Hello! Really great library, I tested with arduino nano+serial 1604 display and encoder with button and it works very well!
More than the issue already reported few days ago by lfc7 on menu refresh, which I haven't solved as well, I am wondering if there is any "embedded mechanism" to exit from main menu, and in such a case, how to re-enter.
Currently I have simply included an "Exit" menu option calling an exit function which prevent menu to be called in void loop().
Thanks!

bug on graphics on long menus

Hi, i just used your great lib to do some menu actions.

However i noticed a -maybe- bug in your lib.

i have some long menus, with different options. And as you see on the screenshot there is a displaying bug at "input 6". The appeareance of this bug differs if i change the text in this line, but it is laways present.

Any ideas ?

screenshot: https://pl.vc/pt8go

code (to reproduce the bug, not the whole project, only the menu code):

`/***************************************
Arduino generic menu system
GFX menu - unsing adafruit gfx screens
tested on ATmega2560
http://www.r-site.net/?at=//op%5B%40id=%273090%27%5D

Sept. 2014 Rui Azevedo - ruihfazevedo(@rrob@)gmail.com

creative commons license 3.0: Attribution-ShareAlike CC BY-SA
This software is furnished "as is", without technical support, and with no
warranty, express or implied, as to its usefulness for any purpose.

Thread Safe: No
Extensible: Yes

Adafruit GFX library from:
https://learn.adafruit.com/adafruit-gfx-graphics-library/overview
Display ST7735 driver
http://www.adafruit.com/product/358
_/
/
_***************
Rui Azevedo 2014
ruihfazevedo@[email protected]
********/

include <SPI.h>

include <menu.h>//menu macros and objects

include "menuFields.h"

//#include <pcint.h>//this is incompatible with software serial (arduino needs an handler!)

include <quadEncoder.h>//quadrature encoder driver and fake stream

include <keyStream.h>//keyboard driver and fake stream (for the encoder button)

include <chainStream.h>// concatenate multiple input streams (this allows adding a button to the encoder)

//#include <menuPrint.h>//Print (Serial) menu

include <Adafruit_GFX.h> // Core graphics library

include <Adafruit_ST7735.h> // Hardware-specific library

include <menuGFX.h>

if defined(AVR_ATmega2560)

///////////////////////////////////////////////////////////////////////////
//TFT + SD
//#define sdCS 9//not using SD card
#define tftCS 10
#define dc 8
#define rst -1
////////////////////////////////////////////
// ENCODER (aka rotary switch) PINS
#define encA 10
#define encB 12
#define encBtn 13

elif defined(AVR_ATmega328) || defined(AVR_ATmega328P)

///////////////////////////////////////////////////////////////////////////
//TFT + SD
//#define sdCS 9//not using SD card
#define tftCS 10
#define dc 8
#define rst -1
////////////////////////////////////////////
// ENCODER (aka rotary switch) PINS
#define encA 2
#define encB 3
#define encBtn 4

else

#error "Uknown pinout"

endif

Adafruit_ST7735 tft(tftCS, dc, rst);
///////////////////////////////////////////////////////////////////////////
//functions to wire as menu actions

//aux function
void nothing() {}

void setValue(int &value,prompt &p,menuOut &o, Stream &i,const char* text,const char* units="",int sensivity=5,int low=0,int hi=100,int steps=0,void (*func)()=nothing);

volatile unsigned int inputModes[] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; // 0 = off 1 = CYL 2 = EGT
volatile unsigned int temperatureIndicatorEGT[] = {150, 170, 200};
volatile unsigned int temperatureIndicatorCYL[] = {150, 170, 200};

/////////////////////////////////////////////////////////////////////////
// MENU DEFINITION
// here we define the menu structure and wire actions functions to it

TOGGLE(inputModes[0],input1,"Input 1 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[1],input2,"Input 2 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[2],input3,"Input 3 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[3],input4,"Input 4 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[4],input5,"Input 5 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[5],input6,"Input 6 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[6],input7,"Input 7 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[7],input8,"Input 8 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);
TOGGLE(inputModes[8],input9,"Input 9 :",
VALUE("OFF",0),
VALUE("EGT",1),
VALUE("CYL",2)
);

MENU(EGT,"EGT",
FIELD(temperatureIndicatorEGT[0],"EGT LOW"," C",0,400,10,1,nothing),
FIELD(temperatureIndicatorEGT[1],"EGT HIGH"," C",0,400,10,1,nothing),
FIELD(temperatureIndicatorEGT[2],"EGT CRITICAL"," C",0,400,10,1,nothing)
);

MENU(CYL,"CYL",
FIELD(temperatureIndicatorCYL[0],"CYL LOW"," C",0,400,10,1,nothing),
FIELD(temperatureIndicatorCYL[1],"CYL HIGH"," C",0,400,10,1,nothing),
FIELD(temperatureIndicatorCYL[2],"CYL CRITICAL"," C",0,400,10,1,nothing)
);

MENU(Temperatures,"Temperatures",
SUBMENU(EGT),
SUBMENU(CYL)
);

MENU(inputMode,"Input Modes",
SUBMENU(input1),
SUBMENU(input2),
SUBMENU(input3),
SUBMENU(input4),
SUBMENU(input5),
SUBMENU(input6),
SUBMENU(input7),
SUBMENU(input8),
SUBMENU(input9)
);

MENU(Log,"Log",
OP("Op1",nothing),
OP("Op2",nothing),
OP("Op3",nothing)
);

MENU(Time,"Time",
OP("Op1",nothing),
OP("Op2",nothing),
OP("Op3",nothing)
);

MENU(LCD,"LCD",
OP("Op1",nothing),
OP("Op2",nothing),
OP("Op3",nothing)
);

MENU(mainMenu,"Sistema",
SUBMENU(Temperatures),
SUBMENU(inputMode),
SUBMENU(Log),
SUBMENU(Time),
SUBMENU(LCD)
);

//the quadEncoder
quadEncoder encoder(encA,encB);//simple quad encoder driver
quadEncoderStream enc(encoder,5);// simple quad encoder fake Stream

//a keyboard with only one key :D, this is the encoder button
keyMap encBtn_map[]={{-encBtn,menu::enterCode}};//negative pin numbers means we have a pull-up, this is on when low
keyLook<1> encButton(encBtn_map);

//multiple inputs allow conjugation of the quadEncoder with a single key keyboard that is the quadEncoder button
Stream* in[]={&enc,&encButton};
chainStream<2> quadEncoder_button(in);

//alternative to previous but now we can input from Serial too...
Stream* in3[]={&enc,&encButton};
chainStream<3> allIn(in3);

//describing a menu output, alternatives so far are Serial or LiquidCrystal LCD
menuGFX gfx(tft);

/////////////////////////////////////////////////////////////////////////
void setup() {
SPI.begin();
tft.initR(INITR_BLACKTAB);
tft.setRotation(4);
tft.setTextWrap(false);
tft.setTextColor(ST7735_RED,ST7735_BLACK);
tft.setTextSize(1);
gfx.resX_=1;//update resolution after font size change
gfx.resY_=1;//update resolution after font size change
tft.fillScreen(ST7735_BLACK);
tft.print("Menu test on GFX");
//testing menu limits (not using all the screen)
//size is within screen limits even after rotation
//this limits are not constrained, please ensure your text fits
gfx.maxX=24;
gfx.maxY=16;
gfx.bgColor=BLACK;

pinMode(encBtn, INPUT);
digitalWrite(encBtn,1);

encoder.begin();

delay(300);
tft.fillScreen(BLACK);
}

///////////////////////////////////////////////////////////////////////////////
// testing the menu system
void loop() {
mainMenu.poll(gfx,allIn);
}
`

I am using an rotary encoder, arduino uno and teh adafruit 1.8 breakout board.

Have a nice day !

Create MultiDesktop config

Thanks for the library, it's really perfect.
I want to create device with main screen and menu for change settings. I think, it's rather common aim.
As I see "custom menu drawing" in you API, I think, my idea is possible be solved by your library. Isn't it?

MultiDesktop concept diagram

encoder issue

I have an encoder / sketch working on an Arduino Nano but can't get it to work on an Arduino Mega. Are there any known issues with that hardware or maybe I'm just overlooking something obvious. I am using pins 2[clk],3[dt],4[sw] for both pieces of hardware.

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.