99
1010#include < menu.h>
1111#include < menuIO/SSD1306AsciiOut.h>
12- #include < menuIO/serialIn .h>
12+ #include < menuIO/serialIO .h>
1313using namespace Menu ;
1414
1515SSD1306AsciiWire oled;
@@ -73,15 +73,15 @@ class altPrompt:public prompt {
7373public:
7474 altPrompt (constMEM promptShadow& p):prompt(p) {}
7575 Used printTo (navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t ) override {
76- return out.printRaw (F (" special prompt!" ),len);
76+ return out.printRaw (F ( " special prompt!" ),len);
7777 }
7878};
7979
8080MENU (subMenu," Sub-Menu" ,showEvent,anyEvent,noStyle
8181 ,OP(" Sub1" ,showEvent,anyEvent)
8282 ,OP(" Sub2" ,showEvent,anyEvent)
8383 ,OP(" Sub3" ,showEvent,anyEvent)
84- ,altOP(altPrompt," " ,showEvent,anyEvent)
84+ // ,altOP(altPrompt,"",showEvent,anyEvent)
8585 ,EXIT(" <Back" )
8686);
8787
@@ -104,15 +104,19 @@ MENU(mainMenu,"Main menu",doNothing,noEvent,wrapStyle
104104#define fontW 5
105105#define fontH 8
106106
107+ // define output device
108+ idx_t serialTops[MAX_DEPTH]={0 };
109+ serialOut outSerial (Serial,serialTops);
110+
107111// describing a menu output device without macros
108112// define at least one panel for menu output
109113constMEM panel panels[] MEMMODE={{0 ,0 ,128 /fontW,64 /fontH}};
110114navNode* nodes[sizeof (panels)/sizeof (panel)];// navNodes to store navigation status
111115panelsList pList (panels,nodes,1 );// a list of panels and nodes
112116idx_t tops[MAX_DEPTH]={0 ,0 };// store cursor positions for each level
113117SSD1306AsciiOut outOLED (&oled,tops,pList);// oled output device menu driver
114- menuOut* outputs[]={&outOLED};// list of output devices
115- outputsList out (outputs,1 );// outputs list
118+ menuOut* constMEM outputs[] MEMMODE ={&outSerial,& outOLED, };// list of output devices
119+ outputsList out (outputs,sizeof (outputs)/sizeof(menuOut*) );// outputs list
116120
117121// macro to create navigation control root object (nav) using mainMenu
118122serialIn serial (Serial);
@@ -154,8 +158,8 @@ void setup() {
154158 oled.begin (&Adafruit128x64, I2C_ADDRESS);
155159 oled.setFont (System5x7);
156160 oled.clear ();
157- oled.print (" Hello world! " );
158- nav.idleTask =idle;// point a function to be used when menu is suspended
161+ oled.print (" menu 4.x test " );
162+ // nav.idleTask=idle;//point a function to be used when menu is suspended
159163}
160164
161165void loop () {
0 commit comments