diff --git a/src/AudioPlayer.cpp b/src/AudioPlayer.cpp index 450d7ba..7f204d7 100644 --- a/src/AudioPlayer.cpp +++ b/src/AudioPlayer.cpp @@ -168,9 +168,15 @@ void AudioPlayer_SetupVolume(void) { #endif #ifdef GPIO_PA_EN + while (millis() < 500) { + delay(10); // Wait a bit in order to avoid ugly noises when enabling amp + } Port_Write(GPIO_PA_EN, true, true); #endif #ifdef GPIO_HP_EN + while (millis() < 500) { + delay(10); // Wait a bit in order to avoid ugly noises when enabling amp + } Port_Write(GPIO_HP_EN, false, true); #endif } else { diff --git a/src/System.cpp b/src/System.cpp index 285c72b..e173fcc 100644 --- a/src/System.cpp +++ b/src/System.cpp @@ -7,6 +7,7 @@ #include "Log.h" #include "Mqtt.h" #include "SdCard.h" +#include "Port.h" constexpr const char prefsRfidNamespace[] PROGMEM = "rfidTags"; // Namespace used to save IDs of rfid-tags constexpr const char prefsSettingsNamespace[] PROGMEM = "settings"; // Namespace used for generic settings @@ -186,6 +187,14 @@ void System_DeepSleepManager(void) { return; } + // Disable amps in order to avoid ugly noises when powering off + #ifdef GPIO_PA_EN + Port_Write(GPIO_PA_EN, false); + #endif + #ifdef GPIO_HP_EN + Port_Write(GPIO_HP_EN, false); + #endif + System_Sleeping = true; Log_Println((char *) FPSTR(goToSleepNow), LOGLEVEL_NOTICE);