Compare commits
3 Commits
6ea15a23d6
...
9a19260a6c
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a19260a6c | |||
| 7a4448c852 | |||
| ac40b8ce27 |
@@ -20,7 +20,7 @@
|
||||
#ifdef DEBOUNCE_TIME
|
||||
#undef DEBOUNCE_TIME
|
||||
#endif
|
||||
#define DEBOUNCE_TIME 300 // in ms
|
||||
#define DEBOUNCE_TIME 250 // in ms
|
||||
|
||||
#define X_MAX 11
|
||||
#define Y_MAX 11
|
||||
|
||||
@@ -58,7 +58,7 @@ void Snake::loopCycle()
|
||||
*/
|
||||
void Snake::ctrlUp()
|
||||
{
|
||||
if ((system_get_time() / 1000) > _lastButtonClick + DEBOUNCE_TIME && _gameState == GAME_STATE_RUNNING)
|
||||
if (((system_get_time() / 1000) > (_lastButtonClick + DEBOUNCE_TIME)) && (_gameState == GAME_STATE_RUNNING) && (_userDirection != DIRECTION_UP))
|
||||
{
|
||||
_logger->log_string("Snake: UP");
|
||||
_userDirection = DIRECTION_DOWN; // need to swap direction as field is rotated 180deg
|
||||
@@ -72,7 +72,7 @@ void Snake::ctrlUp()
|
||||
*/
|
||||
void Snake::ctrlDown()
|
||||
{
|
||||
if ((system_get_time() / 1000) > _lastButtonClick + DEBOUNCE_TIME && _gameState == GAME_STATE_RUNNING)
|
||||
if (((system_get_time() / 1000) > (_lastButtonClick + DEBOUNCE_TIME)) && (_gameState == GAME_STATE_RUNNING) && (_userDirection != DIRECTION_DOWN))
|
||||
{
|
||||
_logger->log_string("Snake: DOWN");
|
||||
_userDirection = DIRECTION_UP; // need to swap direction as field is rotated 180deg
|
||||
@@ -86,7 +86,7 @@ void Snake::ctrlDown()
|
||||
*/
|
||||
void Snake::ctrlRight()
|
||||
{
|
||||
if ((system_get_time() / 1000) > _lastButtonClick + DEBOUNCE_TIME && _gameState == GAME_STATE_RUNNING)
|
||||
if (((system_get_time() / 1000) > (_lastButtonClick + DEBOUNCE_TIME)) && (_gameState == GAME_STATE_RUNNING) && (_userDirection != DIRECTION_RIGHT))
|
||||
{
|
||||
_logger->log_string("Snake: RIGHT");
|
||||
_userDirection = DIRECTION_LEFT; // need to swap direction as field is rotated 180deg
|
||||
@@ -100,7 +100,7 @@ void Snake::ctrlRight()
|
||||
*/
|
||||
void Snake::ctrlLeft()
|
||||
{
|
||||
if ((system_get_time() / 1000) > _lastButtonClick + DEBOUNCE_TIME && _gameState == GAME_STATE_RUNNING)
|
||||
if (((system_get_time() / 1000) > (_lastButtonClick + DEBOUNCE_TIME)) && (_gameState == GAME_STATE_RUNNING) && (_userDirection != DIRECTION_LEFT))
|
||||
{
|
||||
_logger->log_string("Snake: LEFT");
|
||||
_userDirection = DIRECTION_RIGHT; // need to swap direction as field is rotated 180deg
|
||||
|
||||
@@ -133,7 +133,7 @@ String time_to_string(uint8_t hours, uint8_t minutes)
|
||||
}
|
||||
else if (minutes >= 20 && minutes < 25)
|
||||
{
|
||||
message += "ZEHN VOR HALB ";
|
||||
message += "ZWANZIG NACH ";
|
||||
}
|
||||
else if (minutes >= 25 && minutes < 30)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user