Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WidgetBool process method to restrict value changes to edit mode #299

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/widget/WidgetBool.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ class WidgetBool : public BaseWidgetValue<bool> {
* @return true if command was handled, false otherwise
*/
bool process(LcdMenu* menu, const unsigned char command) override {
if (command == UP || command == DOWN) {
value = !value;
LOG(F("WidgetToggle::toggle"), value);
handleChange();
return true;
MenuRenderer* renderer = menu->getRenderer();
if (renderer->isInEditMode()) {
if (command == UP || command == DOWN) {
value = !value;
LOG(F("WidgetToggle::toggle"), value);
handleChange();
return true;
}
forntoh marked this conversation as resolved.
Show resolved Hide resolved
}
return false;
}
Expand Down
Loading