diff --git a/game-ctrl/buttons.c b/game-ctrl/buttons.c index ce48155..fbbdb08 100644 --- a/game-ctrl/buttons.c +++ b/game-ctrl/buttons.c @@ -20,10 +20,6 @@ static uint8_t buttonsMoveLeftPressed() { return res; } -bool isConfigMode() { - return (P2IN & BIT4); -} - bool buttonsConfig1Pressed() { return buttonsMoveLeftPressed(); } @@ -69,6 +65,11 @@ static uint8_t buttonsMoveDownPressed() { return P2IN & BIT2; } +bool isConfigMode() { + return (P2IN & BIT2); +} + + void buttonsExec(void *handle) { static uint32_t unmuteTimestamp; uint32_t currentTimestamp = getSeconds(); diff --git a/game-ctrl/config.c b/game-ctrl/config.c index 76bf159..aee3284 100644 --- a/game-ctrl/config.c +++ b/game-ctrl/config.c @@ -53,16 +53,21 @@ void (*configHandler[])(void) = { configHandleFlash, configHandleResetHighScore, void configExec(void *handle) { static uint8_t configState = 0; + static uint8_t lastConfigState = 255; + + if (configState != lastConfigState) { + lastConfigState = configState; + + miniCanvasClear(); + canvasClear(); + miniCanvasSetPixel(configState, 0, _red); + } if (buttonsConfig1Pressed()) { configState += 1; if (configState >= sizeof(configHandler) / sizeof(configHandler[0])) { configState = 0; } - miniCanvasClear(); - canvasClear(); - - miniCanvasSetPixel(configState, 0, _red); } configHandler[configState](); @@ -77,7 +82,6 @@ void configExec(void *handle) { miniCanvasSetPixel(0, 2, _green); } - canvasShow(); }