bugfixes, release 1.1

This commit is contained in:
2021-01-10 14:58:17 +01:00
parent 009903ec17
commit f78f3c5eaa
2 changed files with 12 additions and 7 deletions

View File

@@ -45,22 +45,27 @@ void ResetChainGame(void)
patternIndex = 0; patternIndex = 0;
patternFlag = false; patternFlag = false;
firstpattern = false; firstpattern = false;
cheatbutton = NONE; cheatbutton = 0;
cheatButtonFlag = false; cheatButtonFlag = false;
} }
void HandleChainGame(void) void HandleChainGame(void)
{ {
if (buttonIsPressed(ledpattern[patternIndex]) && !cheatButtonFlag) if (buttonIsPressed(ledpattern[patternIndex]) && !patternFlag && !cheatButtonFlag)
{ {
turnOnLed(ledpattern[patternIndex]); turnOnLed(ledpattern[patternIndex]);
patternFlag = true; patternFlag = true;
cheatbutton = 0;
} }
else if (buttonIsPressed(cheatbutton) && !patternFlag && !cheatButtonFlag) else if (buttonIsPressed(cheatbutton) && !patternFlag && !cheatButtonFlag)
{ {
turnOnLed(cheatbutton); turnOnLed(cheatbutton);
cheatButtonFlag = true; cheatButtonFlag = true;
} }
else if (anybutton() && !patternFlag && !cheatButtonFlag )
{
cheatbutton = 0;
}
if (!buttonIsPressed(ledpattern[patternIndex])) if (!buttonIsPressed(ledpattern[patternIndex]))
{ {
@@ -71,7 +76,7 @@ void HandleChainGame(void)
{ {
turnOffLed(cheatbutton); turnOffLed(cheatbutton);
cheatButtonFlag = false; cheatButtonFlag = false;
cheatbutton = NONE; cheatbutton = 0;
} }
if (!anybutton()) if (!anybutton())
@@ -85,15 +90,15 @@ void HandleChainGame(void)
} }
//check cheatbuttons //check cheatbuttons
if (buttonIsPressed(1) && (cheatbutton == NONE)) if (buttonIsPressed(4) && (cheatbutton == 0))
{ {
cheatbutton = 1; cheatbutton = 1;
} }
else if (buttonIsPressed(2) && (cheatbutton == NONE)) else if (buttonIsPressed(5) && (cheatbutton == 0))
{ {
cheatbutton = 2; cheatbutton = 2;
} }
else if (buttonIsPressed(3) && (cheatbutton == NONE)) else if (buttonIsPressed(6) && (cheatbutton == 0))
{ {
cheatbutton = 3; cheatbutton = 3;
} }

View File

@@ -8,7 +8,7 @@
#include "led.h" #include "led.h"
#define TIMEOUT 15000 // 15sec * 1000ms #define TIMEOUT 15000 // 15sec * 1000ms
#define GAMESELECTTIMEOUT 7000 // 7sec * 1000ms #define GAMESELECTTIMEOUT 5000 // 7sec * 1000ms
typedef enum typedef enum
{ {