other button to start config mode

This commit is contained in:
Wolfgang Hottgenroth 2024-05-19 21:47:31 +02:00
parent d9fd18d799
commit d9769c6b28
2 changed files with 14 additions and 9 deletions

View File

@ -20,10 +20,6 @@ static uint8_t buttonsMoveLeftPressed() {
return res; return res;
} }
bool isConfigMode() {
return (P2IN & BIT4);
}
bool buttonsConfig1Pressed() { bool buttonsConfig1Pressed() {
return buttonsMoveLeftPressed(); return buttonsMoveLeftPressed();
} }
@ -69,6 +65,11 @@ static uint8_t buttonsMoveDownPressed() {
return P2IN & BIT2; return P2IN & BIT2;
} }
bool isConfigMode() {
return (P2IN & BIT2);
}
void buttonsExec(void *handle) { void buttonsExec(void *handle) {
static uint32_t unmuteTimestamp; static uint32_t unmuteTimestamp;
uint32_t currentTimestamp = getSeconds(); uint32_t currentTimestamp = getSeconds();

View File

@ -53,16 +53,21 @@ void (*configHandler[])(void) = { configHandleFlash, configHandleResetHighScore,
void configExec(void *handle) { void configExec(void *handle) {
static uint8_t configState = 0; static uint8_t configState = 0;
static uint8_t lastConfigState = 255;
if (configState != lastConfigState) {
lastConfigState = configState;
miniCanvasClear();
canvasClear();
miniCanvasSetPixel(configState, 0, _red);
}
if (buttonsConfig1Pressed()) { if (buttonsConfig1Pressed()) {
configState += 1; configState += 1;
if (configState >= sizeof(configHandler) / sizeof(configHandler[0])) { if (configState >= sizeof(configHandler) / sizeof(configHandler[0])) {
configState = 0; configState = 0;
} }
miniCanvasClear();
canvasClear();
miniCanvasSetPixel(configState, 0, _red);
} }
configHandler[configState](); configHandler[configState]();
@ -77,7 +82,6 @@ void configExec(void *handle) {
miniCanvasSetPixel(0, 2, _green); miniCanvasSetPixel(0, 2, _green);
} }
canvasShow(); canvasShow();
} }