From c7e51cde95228e3ddac889078e72ed059e49a65b Mon Sep 17 00:00:00 2001 From: Jeremie GABOLDE Date: Wed, 21 Sep 2022 20:50:52 +0200 Subject: [PATCH] fixed bug with anim effect disable not showing button toggles --- Maybe/Maybe.ino | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Maybe/Maybe.ino b/Maybe/Maybe.ino index bd7a172..72ba351 100644 --- a/Maybe/Maybe.ino +++ b/Maybe/Maybe.ino @@ -223,7 +223,7 @@ void initSevSegDisplay() void loop() { //animation draw tick - if (animationEnabled && animationPlaying && millis() > (animationLastFrameMillis + animationFrameDelayMillis)) + if (animationEnabled && animationPlaying && (millis() > (animationLastFrameMillis + animationFrameDelayMillis))) { drawAnimation(animationLooping); animationLastFrameMillis = millis(); @@ -464,6 +464,13 @@ MemSlot* getMemorySlot(String memSlotName) void sendInputOuput(int input) { + int numberOfModes = sizeof(modes)/(sizeof(Action)*15); + + int currentMode = (getMemorySlot("prst")->value) % numberOfModes; + //Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix, + Action actionToRun = modes[currentMode][input-1]; //getting the virtual inputs from the modes array. + //Inputs uids starts with 1, so input - 1 to get the index 0 of the array + String inputName = "bt"; inputName += input; MemSlot* buttonInputMem = getMemorySlot(inputName); @@ -488,17 +495,10 @@ void sendInputOuput(int input) buttonsVirtualState[input-1] = false; } } + + clickKey(actionToRun.keyID, actionToRun.keyModifierID); } - lastInputMillis = millis(); - - int numberOfModes = sizeof(modes)/(sizeof(Action)*15); - - int currentMode = (getMemorySlot("prst")->value) % numberOfModes; - //Hardware inputs ordered from the bottom left = 1 to the top right = 12 on the switch matrix, - Action actionToRun = modes[currentMode][input-1]; //getting the virtual inputs from the modes array. - //Inputs uids starts with 1, so input - 1 to get the index 0 of the array - if (actionToRun.keyID == -1) //menu input, input mapping can be changed in modeAction.h { if (isInMenu) @@ -526,11 +526,8 @@ void sendInputOuput(int input) { menuEnter(); } - else - { - clickKey(actionToRun.keyID, actionToRun.keyModifierID); - } + lastInputMillis = millis(); } void clickKey(int key, int modifier) @@ -544,9 +541,12 @@ void clickKey(int key, int modifier) void playAnimation(int animID) { + if (animationEnabled) + { currentAnimationID = animID; animationFrame = 0; animationPlaying = true; + } } void drawAnimation(bool looping)