flashcolor and highscore config done

This commit is contained in:
Wolfgang Hottgenroth 2024-05-19 20:46:00 +02:00
parent 4cb0a10617
commit 7894359f30

View File

@ -5,6 +5,7 @@
#include "scheduler.h"
#include "buttons.h"
#include "eeprom.h"
#include "display.h"
typedef enum { e_Config_Flash, e_Config_ResetHighscore, e_Config_End } t_ConfigState;
@ -12,19 +13,25 @@ typedef enum { e_Config_Flash, e_Config_ResetHighscore, e_Config_End } t_ConfigS
static bool configChanged = false;
static void configHandleFlash() {
miniCanvasSetPixel(0, 1, eepromReadFlashColor());
if (buttonsConfig2Pressed()) {
configChanged = true;
uint8_t color = eepromReadFlashColor() + 1;
if (color == _color_end) {
color = 0;
}
canvasFillRow(CANVAS_HEIGHT-1, color);
displaySetValue(color);
eepromSetFlashColor(color);
}
}
static void configHandleResetHighScore() {
displaySetValue(eepromReadHighScore());
if (buttonsConfig2Pressed()) {
configChanged = true;
eepromSetHighScore(0);
}
}
void (*configHandler[])(void) = { configHandleFlash, configHandleResetHighScore };
@ -39,6 +46,7 @@ void configExec(void *handle) {
configState = e_Config_Flash;
}
miniCanvasClear();
canvasClear();
miniCanvasSetPixel(configState, 0, _medium_red);
}