From fef02d980f58567b6a632868a5cd90d88759e5aa Mon Sep 17 00:00:00 2001 From: Adam Wonak Date: Sat, 21 Jun 2025 23:13:32 -0700 Subject: [PATCH] Do not wrap menu selections. --- examples/Gravity/Gravity.ino | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/Gravity/Gravity.ino b/examples/Gravity/Gravity.ino index adb4b54..8b2234c 100644 --- a/examples/Gravity/Gravity.ino +++ b/examples/Gravity/Gravity.ino @@ -21,8 +21,8 @@ #include "app_state.h" #include "channel.h" -#include "save_state.h" #include "display.h" +#include "save_state.h" AppState app; StateManager stateManager; @@ -229,8 +229,7 @@ void editChannelParameter(int val) { } void updateSelection(int& param, int change, int maxValue) { - // This formula correctly handles positive and negative wrapping. - param = (param + change % maxValue + maxValue) % maxValue; + param = constrain(param + change, 0, maxValue - 1); } //