From 289884ab9087635f41dc83a10a2f8970cf73fc9e Mon Sep 17 00:00:00 2001 From: gelakinetic Date: Mon, 28 Oct 2024 11:07:18 +0000 Subject: [PATCH] Disable speaker when not used --- main/modes/games/ultimateTTT/ultimateTTT.c | 3 +++ main/modes/utilities/dance/dance.c | 3 +++ main/modes/utilities/gamepad/gamepad.c | 3 +++ main/modes/utilities/timer/modeTimer.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/main/modes/games/ultimateTTT/ultimateTTT.c b/main/modes/games/ultimateTTT/ultimateTTT.c index 5fc3ea0c3..de330b030 100644 --- a/main/modes/games/ultimateTTT/ultimateTTT.c +++ b/main/modes/games/ultimateTTT/ultimateTTT.c @@ -91,6 +91,9 @@ ultimateTTT_t* ttt; */ static void tttEnterMode(void) { + // TODO enable speaker if BGM is added + setDacShutdown(true); + // Allocate memory for the mode ttt = calloc(1, sizeof(ultimateTTT_t)); diff --git a/main/modes/utilities/dance/dance.c b/main/modes/utilities/dance/dance.c index aef1e86d6..a491e8d1a 100644 --- a/main/modes/utilities/dance/dance.c +++ b/main/modes/utilities/dance/dance.c @@ -150,6 +150,9 @@ danceMode_t* danceState; */ void danceEnterMode(void) { + // No speaker output for LEDs! + setDacShutdown(true); + danceState = calloc(1, sizeof(danceMode_t)); danceState->danceIdx = 0; diff --git a/main/modes/utilities/gamepad/gamepad.c b/main/modes/utilities/gamepad/gamepad.c index a0143b16a..3532eaf11 100644 --- a/main/modes/utilities/gamepad/gamepad.c +++ b/main/modes/utilities/gamepad/gamepad.c @@ -269,6 +269,9 @@ static const tinyusb_config_t ns_tusb_cfg = { */ void gamepadEnterMode(void) { + // Disable speaker for gamepad + setDacShutdown(true); + // Allocate and zero memory gamepad = (gamepad_t*)calloc(1, sizeof(gamepad_t)); diff --git a/main/modes/utilities/timer/modeTimer.c b/main/modes/utilities/timer/modeTimer.c index 4a57a489d..5d6b552dd 100644 --- a/main/modes/utilities/timer/modeTimer.c +++ b/main/modes/utilities/timer/modeTimer.c @@ -120,6 +120,9 @@ static timerMode_t* timerData = NULL; static void timerEnterMode(void) { + // Disable speaker for timer + setDacShutdown(true); + timerData = calloc(1, sizeof(timerMode_t)); loadFont("ibm_vga8.font", &timerData->textFont, false);