Skip to content

Commit c3d4823

Browse files
committed
empty input stream
#146 use `noInput` class also fixing escKey to exit sleep mode consuming input on first check.
1 parent 88cc2b5 commit c3d4823

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/io.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
inline void fieldOff() {setFieldMode(false);}
2121
};
2222

23+
class noInput:public menuIn {
24+
public:
25+
size_t write(uint8_t) override {}
26+
int available() override {return 0;}
27+
int read() override {return -1;}
28+
int peek() override {return -1;}
29+
};
30+
2331
#ifdef MENU_ASYNC
2432
class StringStream:public menuIn {
2533
public:

src/nav.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ result navNode::sysEvent(eventMask e,idx_t i) {
111111
void navRoot::doInput(menuIn& in) {
112112
trace(Serial<<"navRoot::doInput"<<endl);
113113
if (sleepTask) {
114-
if (options->getCmdChar(enterCmd)==in.read() || options->getCmdChar(escCmd)==in.read()) idleOff();
114+
char c=in.read();
115+
if (options->getCmdChar(enterCmd)==c || options->getCmdChar(escCmd)==c) idleOff();
115116
} else {
116117
idx_t inputBurstCnt=inputBurst+1;
117118
//if (in.available())

0 commit comments

Comments
 (0)