@@ -29,6 +29,9 @@ ITEM macro, like OP but do allow custom system styles and extra arguments at end
2929#include < Arduino.h>
3030
3131#include < menu.h>
32+ #ifdef DEBUG
33+ #include < Dump.h>
34+ #endif
3235
3336// inputs
3437#include < menuIO/encoderIn.h>
@@ -74,28 +77,18 @@ softKeyIn<1> encButton(encBtn_map);//1 is the number of keys
7477Stream* inputsList[]={&encStream,&encButton,&Serial};
7578chainStream<3 > in (inputsList);// 3 is the number of inputs
7679
77- void dot () {Serial.print (" +" );}
78-
79- char * const hexChars PROGMEM =" 0123456789ABCDEF" ;
80- char * constMEM validData[] PROGMEM ={hexChars,hexChars};// individual character validators
81-
82- constMEM char op1Text[] PROGMEM =" Name" ;// field name
83- constMEM textFieldShadowRaw op1InfoRaw PROGMEM ={(callback)doNothing,(Menu::systemStyles)(_noStyle|_canNav|_parentDraw),op1Text,enterEvent,noStyle,2 ,validData};// PROGMEM static stuff
84- constMEM textFieldShadow& op1Info=*(textFieldShadow*)&op1InfoRaw;// hacking c++ to use progmem (hugly)
85- textField op1 (" AA" ,op1Info);// text length not enforced to match validators length yet
80+ char * const hexDigit PROGMEM =" 0123456789ABCDEF" ;
81+ char * const hexNr[] PROGMEM ={" 0" ," x" ,hexDigit,hexDigit};
82+ char buf1[]=" 0x11" ;
8683
8784// a menu using a plugin field
8885MENU (mainMenu," Main menu" ,doNothing,noEvent,wrapStyle
86+ ,BARFIELD (test," Bar field" ," %" ,0 ,100 ,10 ,1 ,doNothing,noEvent,wrapStyle)// numeric field with a bar
8987 ,FIELD (test," Original" ," %" ,0 ,100 ,10 ,1 ,doNothing,noEvent,wrapStyle)// normal numeric field (2 edit levels)
9088 ,FIELD (test," O. Simple" ," %" ,0 ,100 ,1 ,0 ,doNothing,noEvent,wrapStyle)// normal numeric field (1 edit level)
9189 ,altFIELD(cancelField,test," Cancelable" ," %" ,0 ,100 ,10 ,1 ,doNothing,enterEvent,wrapStyle)// cancelable field (2 edit levels)
9290 ,altFIELD(cancelField,test," C. Simple" ," %" ,0 ,100 ,1 ,0 ,doNothing,enterEvent,wrapStyle)// cancelable field (1 edit level)
93- // ,EDIT(barField,test,"Bar field","%",0,100,10,1,doNothing,noEvent,wrapStyle)//numeric field with a bar
94- // ,altFIELD(barField,test,"Bar field","%",0,100,10,1,doNothing,noEvent,wrapStyle)//numeric field with a bar
95- ,BARFIELD (test," Bar field" ," %" ,0 ,100 ,10 ,1 ,doNothing,noEvent,wrapStyle)// numeric field with a bar
96- // ,ITEM(textEdit,"Text",doNothing,noEvent,_canNav,name)
97- ,OBJ (op1)
98- ,OP (" Empty 0" ,dot,enterEvent)// just an empty regular option
91+ ,EDIT (" Hex" ,buf1,hexNr,doNothing,noEvent,noStyle)
9992 ,EXIT (" <Exit" )
10093);
10194
@@ -116,7 +109,7 @@ void setup() {
116109 encoder.begin ();
117110 lcd.begin (16 ,2 );
118111 lcd.setCursor (0 , 0 );
119- lcd.print (" Menu 3.0 LCD" );
112+ lcd.print (" Menu 3.x LCD" );
120113 lcd.setCursor (0 , 1 );
121114 lcd.print (" r-site.net" );
122115 options->numValueInput =false ;// numeric keys in fields used as accelerators instead
@@ -126,9 +119,12 @@ void setup() {
126119 // barFieldOptions::empty="░";//if not stick with the defaults
127120 cancelFieldOptions::quitOnEsc=true ;
128121 cancelFieldOptions::accelSendEsc=true ;// normal is enter
122+ #ifdef DEBUG
123+ dumpPgm (Serial,(textFieldShadowRaw*)mainMenu[5 ].shadow ,sizeof (textFieldShadowRaw));
124+ #endif
129125}
130126
131127void loop () {
132128 nav.poll ();
133- delay (100 );// simulate a delay when other tasks are done
129+ delay (100 );// simulate other tasks delay
134130}
0 commit comments