Feat: enable deepsleep on boot

This commit is contained in:
Bertrand Benjamin 2022-10-12 08:30:24 +02:00
parent 11cf1cf782
commit 8bb37341f2

View File

@ -26,11 +26,27 @@ void setup() {
pinMode(STATUSLED, OUTPUT);
pinMode(POWERBUTTON, INPUT);
esp_sleep_enable_ext0_wakeup(POWERBUTTON, 1);
esp_sleep_wakeup_cause_t source_reveil;
source_reveil = esp_sleep_get_wakeup_cause();
Serial.println(source_reveil);
switch(source_reveil){
case ESP_SLEEP_WAKEUP_EXT0 :
break;
default :
Serial.println("Deepsleep mod -- first boot");
delay(500);
esp_deep_sleep_start();
break;
}
wifi_init();
wifi_info();
esp_sleep_enable_ext0_wakeup(POWERBUTTON, 1);
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
audio.setVolume(30);
// audio.connecttohost("http://192.168.2.216:8000/06%20-%20H4dopi.mp3");