start in muted state

This commit is contained in:
2024-04-18 13:48:36 +02:00
parent b49665512f
commit 076c0f3f1a

View File

@ -49,7 +49,7 @@ static uint8_t buttonsMoveDownPressed() {
void buttonsExec(void *handle) { void buttonsExec(void *handle) {
static uint32_t unmuteTimestamp; static uint32_t unmuteTimestamp;
uint32_t currentTimestamp = getSeconds(); uint32_t currentTimestamp = getSeconds();
static bool unmuteFlag = true; static bool mutedFlag = true;
if (! stoneIsValid()) { if (! stoneIsValid()) {
@ -88,16 +88,16 @@ void buttonsExec(void *handle) {
if (buttonPressed == 1) { if (buttonPressed == 1) {
canvasShow(); canvasShow();
if (! unmuteFlag) { if (mutedFlag) {
soundCtrl(SOUND_UNMUTE); soundCtrl(SOUND_UNMUTE);
unmuteFlag = true; mutedFlag = false;
} }
unmuteTimestamp = currentTimestamp; unmuteTimestamp = currentTimestamp;
} }
if (unmuteFlag && (unmuteTimestamp + MUTE_DELAY < currentTimestamp)) { if ((! mutedFlag) && (unmuteTimestamp + MUTE_DELAY < currentTimestamp)) {
soundCtrl(SOUND_MUTE); soundCtrl(SOUND_MUTE);
unmuteFlag = false; mutedFlag = true;
} }
} }