From 5830335c8495936b3808f3ab10b28eb1b2cd4c5f Mon Sep 17 00:00:00 2001 From: Lino Schmidt Date: Sun, 4 Sep 2022 11:47:33 +0200 Subject: [PATCH] Fixed buttonPress --- src/main.cpp | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index ec36b54..9558a13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -254,28 +254,26 @@ void joystickButtonPress() { } } - if(!abort) { - for(int i = 0; i < CodeLenght; i++) { - Serial.print(String(Code[i])); - } - Serial.println(" Len:" + String(CodeLenght)); - - if(Code[0] == 0 && Code[1] == 1 && Code[2] == 0 && Code[3] == 1 && CodeLenght == 4) { - Serial.println("Calibrate..."); - calibrateMaxMin(); - } else if(Code[0] == 0 && CodeLenght == 1 && AutoplayOn == true) { - Serial.println("Save position..."); - savePos(); - } else if(Code[0] == 1 && CodeLenght == 1 && AutoplayOn == true) { - Serial.println("Start Autoplay..."); - autoplayStart = true; - autoplayLoop = 0; - inAutoplay = true; - attached(true); - } else if(Code[0] == 0 && Code[1] == 0 && CodeLenght == 2 && AutoplayOn == true) { - Serial.println("Clear positions..."); - clearPos(); - } + for(int i = 0; i < CodeLenght; i++) { + Serial.print(String(Code[i])); + } + Serial.println(" Len:" + String(CodeLenght)); + + if(Code[0] == 0 && Code[1] == 1 && Code[2] == 0 && Code[3] == 1 && CodeLenght == 4) { + Serial.println("Calibrate..."); + calibrateMaxMin(); + } else if(Code[0] == 0 && CodeLenght == 1 && AutoplayOn == true) { + Serial.println("Save position..."); + savePos(); + } else if(Code[0] == 1 && CodeLenght == 1 && AutoplayOn == true) { + Serial.println("Start Autoplay..."); + autoplayStart = true; + autoplayLoop = 0; + inAutoplay = true; + attached(true); + } else if(Code[0] == 0 && Code[1] == 0 && CodeLenght == 2 && AutoplayOn == true) { + Serial.println("Clear positions..."); + clearPos(); } }