Skip to content

Commit 5936fb4

Browse files
committed
Merge branch 'tempIsland'
2 parents f6b4348 + 391ae2b commit 5936fb4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+677
-505
lines changed

examples/Serial/serialio/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ board = nanoatmega328
4141
framework = arduino
4242
upload_port=/dev/ttyUSB*
4343
upload_flags=-V
44-
build_flags = -DNODEBUG
44+
build_flags = -DNODEBUG -Wno-strict-aliasing -Wno-sign-compare -Wno-write-strings
4545
;
4646
; [env:teensy31]
4747
; platform = teensy

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=ArduinoMenu library
2-
version=4.10.4
2+
version=4.11.0
33
author=Rui Azevedo, [email protected]
44
maintainer=neu-rah, [email protected]
55
sentence=Generic menu/interactivity system

src/items.cpp

Lines changed: 93 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "menu.h"
1+
#include "menuDefs.h"
22
using namespace Menu;
33

44
bool prompt::hasTitle(navNode& nav) const {return (nav.target->has(showTitle)||(nav.root->showTitle&&!nav.target->has(noTitle)));}
@@ -8,6 +8,19 @@ idx_t prompt::printRaw(menuOut& out,idx_t len) const {
88
return print_P(out,getText(),len);
99
}
1010

11+
bool prompt::changed(const navNode &nav,const menuOut& out,bool sub,bool test) {
12+
trace(MENU_DEBUG_OUT<<"prompt::changed"<<endl);
13+
return dirty;
14+
}
15+
16+
result prompt::eventHandler(eventMask e,navNode& nav,idx_t i) {
17+
return operator()(e,nav,*this);
18+
}
19+
20+
#ifdef MENU_FMT_WRAPS
21+
classes prompt::type() const {return promptClass;}
22+
#endif
23+
1124
Used prompt::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr) {
1225
trace(MENU_DEBUG_OUT<<*(prompt*)this<<" prompt::printTo"<<endl);
1326
#ifdef MENU_FMT_WRAPS
@@ -39,52 +52,66 @@ Used prompt::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,id
3952
}
4053

4154
#ifdef MENU_ASYNC
42-
bool prompt::async(const char*uri,navRoot& root,idx_t lvl) {
43-
trace(MENU_DEBUG_OUT<<"prompt::async ["<<uri<<"]"<<endl;);
44-
return true;
45-
}
46-
idx_t menuNode::parseUriNode(const char*&uri) {
47-
if (*uri=='/') uri++;//TODO check who does this part!
48-
bool neg=false;
49-
if (*uri=='-') {
50-
uri++;
51-
neg=true;
55+
idx_t prompt::selected() const {return 0;}
56+
const char* prompt::typeName() const {return "prompt";}
57+
bool prompt::async(const char*uri,navRoot& root,idx_t lvl) {
58+
trace(MENU_DEBUG_OUT<<"prompt::async ["<<uri<<"]"<<endl;);
59+
return true;
5260
}
53-
assert(*uri=='-'||strchr(numericChars,uri[0]));
54-
int n=0;
55-
while (*uri) {
56-
char* d=strchr(numericChars,uri[0]);
57-
if (d) n=n*10+((*d)-'0');
58-
else break;
59-
uri++;
61+
idx_t menuNode::parseUriNode(const char*&uri) {
62+
if (*uri=='/') uri++;//TODO check who does this part!
63+
bool neg=false;
64+
if (*uri=='-') {
65+
uri++;
66+
neg=true;
67+
}
68+
assert(*uri=='-'||strchr(numericChars,uri[0]));
69+
int n=0;
70+
while (*uri) {
71+
char* d=strchr(numericChars,uri[0]);
72+
if (d) n=n*10+((*d)-'0');
73+
else break;
74+
uri++;
75+
}
76+
//state transformation (for events preservation)
77+
if (neg) n=sz()-n;//allow negative index from end of list
78+
if (n<0) n=0;
79+
else if (n>=sz()) n=sz()-1;//never trusting web!
80+
return n;
6081
}
61-
//state transformation (for events preservation)
62-
if (neg) n=sz()-n;//allow negative index from end of list
63-
if (n<0) n=0;
64-
else if (n>=sz()) n=sz()-1;//never trusting web!
65-
return n;
66-
}
6782

68-
bool menuNode::async(const char*uri,navRoot& root,idx_t lvl) {
69-
trace(MENU_DEBUG_OUT<<*(prompt*)this<<" menuNode::async "<<uri<<" lvl:"<<lvl<<" root.level:"<<root.level<<endl);
70-
// assert(root.path[lvl].target==this);
71-
if ((!uri[0])||(uri[0]=='/'&&!uri[1])) {
72-
root.escTo(lvl);
73-
trace(MENU_DEBUG_OUT<<*(prompt*)this<<" async true! "<<uri<<endl);
74-
return true;
75-
}
76-
if (uri[0]=='/') uri++;//TODO check who does this part!
77-
assert(strchr(numericChars,uri[0]));
78-
int n=parseUriNode(uri);
79-
trace(MENU_DEBUG_OUT<<"n:"<<n<<" sel:"<<root.path[lvl].sel<<endl);
80-
if (!(root.path[lvl].sel==n&&root.path[lvl+1].target==&operator[](n)&&root.level>lvl)) {
81-
root.escTo(lvl/*+(lvl&&root.path[lvl].sel==n?-1:0)*/);
82-
root.doNav(navCmd(idxCmd,n));
83+
bool menuNode::async(const char*uri,navRoot& root,idx_t lvl) {
84+
trace(MENU_DEBUG_OUT<<*(prompt*)this<<" menuNode::async "<<uri<<" lvl:"<<lvl<<" root.level:"<<root.level<<endl);
85+
// assert(root.path[lvl].target==this);
86+
if ((!uri[0])||(uri[0]=='/'&&!uri[1])) {
87+
root.escTo(lvl);
88+
trace(MENU_DEBUG_OUT<<*(prompt*)this<<" async true! "<<uri<<endl);
89+
return true;
90+
}
91+
if (uri[0]=='/') uri++;//TODO check who does this part!
92+
assert(strchr(numericChars,uri[0]));
93+
int n=parseUriNode(uri);
94+
trace(MENU_DEBUG_OUT<<"n:"<<n<<" sel:"<<root.path[lvl].sel<<endl);
95+
if (!(root.path[lvl].sel==n&&root.path[lvl+1].target==&operator[](n)&&root.level>lvl)) {
96+
root.escTo(lvl/*+(lvl&&root.path[lvl].sel==n?-1:0)*/);
97+
root.doNav(navCmd(idxCmd,n));
98+
}
99+
return operator[](n).async(uri,root,lvl+1);
83100
}
84-
return operator[](n).async(uri,root,lvl+1);
85-
}
101+
const char* navTarget::typeName() const {return "navTarget";}
86102
#endif
87103

104+
constText* textField::validator(int i) {return ((textFieldShadow*)shadow)->operator[](i%sz());}
105+
106+
#ifdef MENU_FMT_WRAPS
107+
classes textField::type() const {return textFieldClass;}
108+
#endif
109+
110+
#ifdef MENU_ASYNC
111+
const char* textField::typeName() const {return "textField";}
112+
#endif
113+
114+
88115
void textField::doNav(navNode& nav,navCmd cmd) {
89116
trace(MENU_DEBUG_OUT<<"textField::doNav:"<<cmd.cmd<<endl);
90117
switch(cmd.cmd) {
@@ -176,6 +203,14 @@ Used textField::printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len
176203
return l;
177204
}
178205

206+
#ifdef MENU_FMT_WRAPS
207+
classes fieldBase::type() const {return fieldClass;}
208+
#endif
209+
210+
#ifdef MENU_ASYNC
211+
const char* fieldBase::typeName() const {return "fieldBase";}
212+
#endif
213+
179214
////////////////////////////////////////////////////////////////////////////////
180215
////////////////////////////////////////////////////////////////////////////////
181216
////////////////////////////////////////////////////////////////////////////////
@@ -192,6 +227,15 @@ void menuNode::clearChanged(const navNode &nav,const menuOut& out,bool sub) {
192227
_changes<true>(nav,out,sub,false);
193228
}
194229

230+
#ifdef MENU_FMT_WRAPS
231+
classes menuNode::type() const {return menuClass;}
232+
#endif
233+
234+
#ifdef MENU_ASYNC
235+
const char* menuNode::typeName() const {return "mn";}
236+
#endif
237+
238+
195239
////////////////////////////////////////////////////////////////////////////////
196240
////////////////////////////////////////////////////////////////////////////////
197241
////////////////////////////////////////////////////////////////////////////////
@@ -465,3 +509,11 @@ bool menuNode::_changes(const navNode &nav,const menuOut& out,bool sub,bool test
465509
return true;
466510
} else return false;
467511
}
512+
513+
#ifdef MENU_ASYNC
514+
const char* menu::typeName() const {return "menu";}
515+
#endif
516+
517+
#ifdef MENU_ASYNC
518+
const char* menuVariantBase::typeName() const {return "menuVariantBase";}
519+
#endif

0 commit comments

Comments
 (0)