fixes to chaingame

This commit is contained in:
2020-12-16 19:38:11 +01:00
parent a6765b1d26
commit 4c9ee88508
4 changed files with 41 additions and 80 deletions

View File

@@ -7,8 +7,8 @@
#include "buttons.h"
#include "led.h"
#define TIMEOUT 15000 // 15sec * 1000ms
#define GAMESELECTTIMEOUT 7000 // 7sec * 1000ms
#define TIMEOUT 15000 // 15sec * 1000ms
#define GAMESELECTTIMEOUT 7000 // 7sec * 1000ms
typedef enum
{
@@ -35,6 +35,8 @@ void HandleIdle(void)
{
//prepare for next game
nextGame = ChainGame;
ResetChainGame();
turnOffLed(YELLOW);
}
//red button first released
@@ -42,6 +44,7 @@ void HandleIdle(void)
{
//prepare for next game
nextGame = magicSwitchBoard;
turnOffLed(RED);
}
//green button first released
@@ -49,6 +52,7 @@ void HandleIdle(void)
{
//prepare for next game
nextGame = detectLED;
turnOffLed(GREEN);
}
//wait for all buttons to be switched off
@@ -62,7 +66,7 @@ void HandleIdle(void)
void HandleGameSelectTimeout(void)
{
uint64_t currentmillis = millis();
if(buttonIsPressed(YELLOW) && buttonIsPressed(RED) && buttonIsPressed(GREEN))
if (buttonIsPressed(YELLOW) && buttonIsPressed(RED) && buttonIsPressed(GREEN))
//if (yellow && red && green)
{
//all buttons pressed, wait for next game