Browse Source

Adding some delays/stuff to avoid ugly noises when powering off/on

master
Torsten Stauder 4 years ago
parent
commit
631f60b31f
  1. 6
      src/AudioPlayer.cpp
  2. 9
      src/System.cpp

6
src/AudioPlayer.cpp

@ -168,9 +168,15 @@ void AudioPlayer_SetupVolume(void) {
#endif #endif
#ifdef GPIO_PA_EN #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); Port_Write(GPIO_PA_EN, true, true);
#endif #endif
#ifdef GPIO_HP_EN #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); Port_Write(GPIO_HP_EN, false, true);
#endif #endif
} else { } else {

9
src/System.cpp

@ -7,6 +7,7 @@
#include "Log.h" #include "Log.h"
#include "Mqtt.h" #include "Mqtt.h"
#include "SdCard.h" #include "SdCard.h"
#include "Port.h"
constexpr const char prefsRfidNamespace[] PROGMEM = "rfidTags"; // Namespace used to save IDs of rfid-tags 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 constexpr const char prefsSettingsNamespace[] PROGMEM = "settings"; // Namespace used for generic settings
@ -186,6 +187,14 @@ void System_DeepSleepManager(void) {
return; 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; System_Sleeping = true;
Log_Println((char *) FPSTR(goToSleepNow), LOGLEVEL_NOTICE); Log_Println((char *) FPSTR(goToSleepNow), LOGLEVEL_NOTICE);

Loading…
Cancel
Save