Skip to content

Commit b7bb71b

Browse files
committed
only auto-enter sleep mode on roots that can exit
1 parent a0bffcb commit b7bb71b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/nav.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@ navCmd navRoot::exit() {
197197
return escCmd;
198198
}
199199

200+
bool navRoot::changed(const menuOut& out) {
201+
if (sleepTask) return idleChanged;
202+
if (node().changed(out)) {
203+
lastChanged=millis();
204+
return true;
205+
} else if (canExit&&timeOut&&(millis()-lastChanged)/1000>timeOut) idleOn(idleTask);
206+
return false;
207+
}
208+
209+
200210
#ifdef MENU_ASYNC
201211
// prompt* navRoot::seek(char* uri) {
202212
// StringStream s(uri);

src/nav.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,7 @@
121121
inline navNode& node() const {return path[level];}
122122
inline menuNode& active() const {return *node().target;}
123123
inline prompt& selected() const {return active()[node().sel];}
124-
bool changed(const menuOut& out) {
125-
if (sleepTask) return idleChanged;
126-
if (node().changed(out)) {
127-
lastChanged=millis();
128-
return true;
129-
} else if (timeOut&&(millis()-lastChanged)/1000>timeOut) idleOn(idleTask);
130-
return false;
131-
}
124+
bool changed(const menuOut& out);
132125
inline bool changed(idx_t n) {return changed(out[n]);}
133126
#ifdef MENU_ASYNC
134127
void escTo(idx_t lvl);

0 commit comments

Comments
 (0)