@@ -12,13 +12,13 @@ www.r-site.net
1212#include < TFT_eSPI.h>
1313
1414#include < menu.h>
15- #include < menuIO/serialIn.h>
16- #include < menuIO/serialOut.h>
15+ #include < menuIO/serialIO.h>
1716#include < menuIO/TFT_eSPIOut.h>
17+ // #include <menuIO/chainStream.h>
1818
1919using namespace Menu ;
2020
21- TFT_eSPI gfx = TFT_eSPI() ;
21+ TFT_eSPI gfx;
2222
2323result doAlert (eventMask e, prompt &item);
2424
@@ -120,23 +120,30 @@ const colorDef<uint16_t> colors[] MEMMODE={
120120 {{(uint16_t )White,(uint16_t )Yellow},{(uint16_t )Blue, (uint16_t )Red, (uint16_t )Red}},// titleColor
121121};
122122
123+ #define MAX_DEPTH 4
124+
123125serialIn serial (Serial);
124126
125- MENU_INPUTS (in,&serial);
127+ // MENU_INPUTS(in,&serial);its single, no need to `chainStream`
126128
127- TFT_eSPIOut gfxOut (gfx);
129+ // define serial output device
130+ idx_t serialTops[MAX_DEPTH]={0 };
131+ serialOut outSerial (Serial,serialTops);
128132
129- #define MAX_DEPTH 4
133+ #define GFX_WIDTH 128
134+ #define GFX_HEIGHT 64
135+ #define fontW 6
136+ #define fontH 9
130137
131- menuOut* constMEM outputs[] MEMMODE={&outSerial,&gfxOut};// list of output devices
138+ constMEM panel panels[] MEMMODE = {{0 , 0 , GFX_WIDTH / fontW, GFX_HEIGHT / fontH}};
139+ navNode* nodes[sizeof (panels) / sizeof (panel)]; // navNodes to store navigation status
140+ panelsList pList (panels, nodes, 1 ); // a list of panels and nodes
141+ idx_t eSpiTops[MAX_DEPTH]={0 };
142+ TFT_eSPIOut eSpiOut (gfx,colors,eSpiTops,pList,fontW,fontH+1 );
143+ menuOut* constMEM outputs[] MEMMODE={&outSerial,&eSpiOut};// list of output devices
132144outputsList out (outputs,sizeof (outputs)/sizeof(menuOut*));// outputs list controller
133145
134- // MENU_OUTPUTS(out,MAX_DEPTH
135- // ,ADAGFX_OUT(gfx,colors,6*textScale,9*textScale,{0,0,14,8},{14,0,14,8})
136- // ,SERIAL_OUT(Serial)
137- // );
138-
139- NAVROOT (nav,mainMenu,MAX_DEPTH,in,out);
146+ NAVROOT (nav,mainMenu,MAX_DEPTH,serial,out);
140147
141148// when menu is suspended
142149result idle (menuOut& o,idleEvent e) {
@@ -162,19 +169,10 @@ void setup() {
162169 // outGfx.usePreview=true;//reserve one panel for preview?
163170 // nav.showTitle=false;//show menu title?
164171
165- // pinMode(encBtn, INPUT_PULLUP);
166- #ifdef USE_CLICK_ENCODER
167- Timer1.initialize (1000 );
168- Timer1.attachInterrupt (timerIsr);
169- #else
170- encButton.begin ();
171- encoder.begin ();
172- #endif
173-
174172 SPI.begin ();
175173 // gfx.initR(INITR_BLACKTAB);
176174 gfx.setRotation (3 );
177- gfx.setTextSize (textScale);// test scalling
175+ // gfx.setTextSize(textScale);//test scalling
178176 gfx.setTextWrap (false );
179177 gfx.fillScreen (Black);
180178 gfx.setTextColor (Red,Black);
0 commit comments