fixed bug with anim effect disable not showing button toggles

This commit is contained in:
Jeremie GABOLDE 2022-09-21 20:50:52 +02:00
parent 28d2959a9c
commit c7e51cde95
1 changed files with 14 additions and 14 deletions

View File

@ -223,7 +223,7 @@ void initSevSegDisplay()
void loop() void loop()
{ {
//animation draw tick //animation draw tick
if (animationEnabled && animationPlaying && millis() > (animationLastFrameMillis + animationFrameDelayMillis)) if (animationEnabled && animationPlaying && (millis() > (animationLastFrameMillis + animationFrameDelayMillis)))
{ {
drawAnimation(animationLooping); drawAnimation(animationLooping);
animationLastFrameMillis = millis(); animationLastFrameMillis = millis();
@ -464,6 +464,13 @@ MemSlot* getMemorySlot(String memSlotName)
void sendInputOuput(int input) 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"; String inputName = "bt";
inputName += input; inputName += input;
MemSlot* buttonInputMem = getMemorySlot(inputName); MemSlot* buttonInputMem = getMemorySlot(inputName);
@ -488,17 +495,10 @@ void sendInputOuput(int input)
buttonsVirtualState[input-1] = false; 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 (actionToRun.keyID == -1) //menu input, input mapping can be changed in modeAction.h
{ {
if (isInMenu) if (isInMenu)
@ -526,11 +526,8 @@ void sendInputOuput(int input)
{ {
menuEnter(); menuEnter();
} }
else
{
clickKey(actionToRun.keyID, actionToRun.keyModifierID);
}
lastInputMillis = millis();
} }
void clickKey(int key, int modifier) void clickKey(int key, int modifier)
@ -544,9 +541,12 @@ void clickKey(int key, int modifier)
void playAnimation(int animID) void playAnimation(int animID)
{ {
if (animationEnabled)
{
currentAnimationID = animID; currentAnimationID = animID;
animationFrame = 0; animationFrame = 0;
animationPlaying = true; animationPlaying = true;
}
} }
void drawAnimation(bool looping) void drawAnimation(bool looping)