Skip to content

Commit

Permalink
BugFix - Update ItemList only in edit mode
Browse files Browse the repository at this point in the history
  • Loading branch information
forntoh committed Jan 29, 2024
1 parent 74443b7 commit b54b718
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/LcdMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,13 @@ class LcdMenu {
switch (item->getType()) {
#ifdef ItemList_H
case MENU_ITEM_LIST: {
item->setItemIndex(item->getItemIndex() - 1);
if (previousIndex != item->getItemIndex()) update();
// Log
printCmd(F("LEFT"),
item->getItems()[item->getItemIndex()].c_str());
if (isInEditMode()) {
item->setItemIndex(item->getItemIndex() - 1);
if (previousIndex != item->getItemIndex()) update();
// Log
printCmd(F("LEFT"),
item->getItems()[item->getItemIndex()].c_str());
}
break;
}
#endif
Expand Down Expand Up @@ -662,13 +664,15 @@ class LcdMenu {
switch (item->getType()) {
#ifdef ItemList_H
case MENU_ITEM_LIST: {
item->setItemIndex((item->getItemIndex() + 1) %
item->getItemCount());
// constrain(item->itemIndex + 1, 0, item->itemCount - 1);
update();
// Log
printCmd(F("RIGHT"),
item->getItems()[item->getItemIndex()].c_str());
if (isInEditMode()) {
item->setItemIndex((item->getItemIndex() + 1) %
item->getItemCount());
// constrain(item->itemIndex + 1, 0, item->itemCount - 1);
update();
// Log
printCmd(F("RIGHT"),
item->getItems()[item->getItemIndex()].c_str());
}
break;
}
#endif
Expand Down

0 comments on commit b54b718

Please sign in to comment.