neu-rah / arduinomenu Goto Github PK
View Code? Open in Web Editor NEWArduino generic menu/interactivity system
License: GNU Lesser General Public License v2.1
Arduino generic menu/interactivity system
License: GNU Lesser General Public License v2.1
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?
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
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
Hi,
Missing streamFlow.h
menu.h
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.
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
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.
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 !
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.
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 ?
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?
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:
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
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 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
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
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.
Great job on this Menu! Would it be easy to use a 5-button keyboard for inputs? I'm struggling with figuring out how to use this with your menu.
http://yourduino.com/sunshop2/index.php?l=product_detail&p=334
Any assistance or pointers would be greatly appreciated!
Thanks again for your efforts on building this great menu!
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.
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.
Now that the encoder part works with the ATmega 1284p chip. I've noticed that the push button of the encoder is not working.
is it possible to have a homescreen on the lcd. and with press on encoder button, entering the menu?
Why?
UTFT_menu_1.txt
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
Is I possible to use a GLCD with ST7920 chip with your library?
Ben
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 :)
}
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
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:
Now my questions:
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?
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.
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
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 ?
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
Menu/src/macros.h:179:41: error: 'menuTextField' does not name a type
Menu/src/macros.h:178:94: error: invalid conversion from 'void (*)()' to 'bool (*)()' [-fpermissive]
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]
Menu/src/menuFields.h:41:12: error: initializing argument 3 of 'menuValue<T>::menuValue(const char*, T, promptAction) [with T = unsigned char]'
Menu/src/macros.h:190:34: error: '_menuTextField24' was not declared in this scope
Menu/src/macros.h:190:34: error: '_menuTextField26' was not declared in this scope
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 !
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?
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
As I understand (by practice and from source code), keyStream should be used only with non-debounce buttons... Can you add this info to wiki?
Maybe It should be modified the same way: https://programmingelectronics.com/tutorial-19-debouncing-a-button-with-arduino-old-version ?
I can do this.
Hi! When works, can you make an example with this? (without serial or encoder include) Sorry for my bad english. Thank you!
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 :)
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
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)
);
Mac OS X IDE 1.0.6 compile ending with a bunch of "Object missing-in reference to ..." errors
missing "this" pointers? just a guess
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
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);
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?
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
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
send customization variables to PROGMEM (static const)
allow static customization... what is the best way of doing it?
Encoder button (and possibly other button types) are blocking until the button is released....
make this non-blocking
Move menu structures into progmem...
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
*/
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
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!
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 <pcint.h>//this is incompatible with software serial (arduino needs an handler!)
//#include <menuPrint.h>//Print (Serial) menu
///////////////////////////////////////////////////////////////////////////
//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
///////////////////////////////////////////////////////////////////////////
//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
#error "Uknown pinout"
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 !
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?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.