re-enable auto sleep

This commit is contained in:
2025-10-06 09:16:19 +02:00
parent 3f8d90c18a
commit 126d377836

View File

@@ -10,6 +10,15 @@
#include "freertos/task.h"
#include "sdkconfig.h"
#include <driver/gpio.h>
#include <esp_sleep.h>
#include <power_helper.hpp>
#include <shutdowner.hpp>
#include "esp_chip_info.h"
#include "esp_flash.h"
#include "esp_pm.h"
#include "esp_system.h"
#include <algorithm>
#include <array>
#include <cmath>
@@ -909,15 +918,27 @@ private:
// ─────────────────────────────────────────────────────────────────────────────
// Entry
extern "C" void app_main() {
esp_pm_config_t pm_config = {
.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, .min_freq_mhz = 16, .light_sleep_enable = true};
ESP_ERROR_CHECK(esp_pm_configure(&pm_config));
printf("Hello world!\n");
// TODO: Where to put that?
ESP_ERROR_CHECK(esp_sleep_enable_gpio_wakeup());
// For some reason, calling it here hangs on startup, sometimes
// ESP_ERROR_CHECK(gpio_install_isr_service(0));
PowerHelper::get();
Shutdowner::get();
Buttons::get();
gpio_install_isr_service(0);
ESP_ERROR_CHECK(gpio_install_isr_service(0));
Shutdowner::get().install_isr();
PowerHelper::get().install_isr();
Buttons::get().install_isr();
I2cGlobal::get();
BatMon::get();
SpiGlobal::get();
SMD::get();
SMD::get().clear();
DispTools::get().clear();
static PlatformFramebuffer fb;
static PlatformInput input;