Open crivaronicolini opened 1 year ago
Hi! I'm trying to write an altFIELD that takes a string as a parameter and uses the updated value of the variable, to save it using the Preferences library with an exitEvent. I'd like to write something like:
Preferences
exitEvent
#include <Preferences.h> Preferences prefs; prefs.begin("test"); int timeOn=10; int timeOff=90; MENU(mainMenu, "Blink menu", doNothing,noEvent, wrapStyle ,altFIELD(saveField, "timeOn", timeOn,"On","ms",0,100,10,1, doNothing, exitEvent, noStyle) ,altFIELD(saveField, "timeOff". timeOff,"Off","ms",0,100,10,1,doNothing, exitEvent, noStyle) ,EXIT("<Back") );
with an altFIELD that executes
altFIELD
template<typename T> class saveField:public menuField<T> { public: using menuField<T>::menuField; // code prefs.putInt(key, value); //would be prefs.putInt("timeOn", timeOn); };
when the exitEvent is called.
Thanks!
Hi! I'm trying to write an altFIELD that takes a string as a parameter and uses the updated value of the variable, to save it using the
Preferences
library with anexitEvent
. I'd like to write something like:with an
altFIELD
that executeswhen the
exitEvent
is called.Thanks!