@@ -12,13 +12,13 @@ www.r-site.net
12
12
#include < TFT_eSPI.h>
13
13
14
14
#include < menu.h>
15
- #include < menuIO/serialIn.h>
16
- #include < menuIO/serialOut.h>
15
+ #include < menuIO/serialIO.h>
17
16
#include < menuIO/TFT_eSPIOut.h>
17
+ // #include <menuIO/chainStream.h>
18
18
19
19
using namespace Menu ;
20
20
21
- TFT_eSPI gfx = TFT_eSPI() ;
21
+ TFT_eSPI gfx;
22
22
23
23
result doAlert (eventMask e, prompt &item);
24
24
@@ -120,23 +120,30 @@ const colorDef<uint16_t> colors[] MEMMODE={
120
120
{{(uint16_t )White,(uint16_t )Yellow},{(uint16_t )Blue, (uint16_t )Red, (uint16_t )Red}},// titleColor
121
121
};
122
122
123
+ #define MAX_DEPTH 4
124
+
123
125
serialIn serial (Serial);
124
126
125
- MENU_INPUTS (in,&serial);
127
+ // MENU_INPUTS(in,&serial);its single, no need to `chainStream`
126
128
127
- TFT_eSPIOut gfxOut (gfx);
129
+ // define serial output device
130
+ idx_t serialTops[MAX_DEPTH]={0 };
131
+ serialOut outSerial (Serial,serialTops);
128
132
129
- #define MAX_DEPTH 4
133
+ #define GFX_WIDTH 128
134
+ #define GFX_HEIGHT 64
135
+ #define fontW 6
136
+ #define fontH 9
130
137
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
132
144
outputsList out (outputs,sizeof (outputs)/sizeof(menuOut*));// outputs list controller
133
145
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);
140
147
141
148
// when menu is suspended
142
149
result idle (menuOut& o,idleEvent e) {
@@ -162,19 +169,10 @@ void setup() {
162
169
// outGfx.usePreview=true;//reserve one panel for preview?
163
170
// nav.showTitle=false;//show menu title?
164
171
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
-
174
172
SPI.begin ();
175
173
// gfx.initR(INITR_BLACKTAB);
176
174
gfx.setRotation (3 );
177
- gfx.setTextSize (textScale);// test scalling
175
+ // gfx.setTextSize(textScale);//test scalling
178
176
gfx.setTextWrap (false );
179
177
gfx.fillScreen (Black);
180
178
gfx.setTextColor (Red,Black);
0 commit comments