feat(pwr): DFS 160/80 + light sleep (eco batterie)
Repo State / repo-state (push) Failing after 13m59s
Repo State / repo-state (push) Failing after 13m59s
This commit is contained in:
@@ -9,13 +9,41 @@
|
||||
#include "call_manager.h"
|
||||
#include "bt_hfp.h"
|
||||
#include "cli.h"
|
||||
#include "esp_pm.h"
|
||||
|
||||
static const char *TAG = "rtc_phone";
|
||||
|
||||
/* DFS : le CPU descend a min_freq_mhz au repos (audio en veille) et remonte a
|
||||
* max_freq_mhz pendant un appel (le driver I2S pose un verrou APB_FREQ_MAX quand
|
||||
* les canaux sont actifs). light_sleep_enable : light sleep automatique quand
|
||||
* aucun verrou n'est pris (limite tant que le BT est connecte, mais inoffensif). */
|
||||
static void power_mgmt_init(void)
|
||||
{
|
||||
#if CONFIG_PM_ENABLE
|
||||
esp_pm_config_t pm = {
|
||||
.max_freq_mhz = CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ, /* 160 */
|
||||
.min_freq_mhz = 80,
|
||||
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
|
||||
.light_sleep_enable = true,
|
||||
#else
|
||||
.light_sleep_enable = false,
|
||||
#endif
|
||||
};
|
||||
esp_err_t err = esp_pm_configure(&pm);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGW(TAG, "esp_pm_configure: %s", esp_err_to_name(err));
|
||||
} else {
|
||||
ESP_LOGI(TAG, "DFS actif (%d/%d MHz, light_sleep=%d)",
|
||||
pm.max_freq_mhz, pm.min_freq_mhz, pm.light_sleep_enable);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
ESP_LOGI(TAG, "RTC BL PHONE — socle ESP-IDF v5.4");
|
||||
ESP_ERROR_CHECK(config_store_init());
|
||||
power_mgmt_init(); /* DFS / light sleep — eco batterie */
|
||||
ESP_ERROR_CHECK(hal_i2s_init());
|
||||
/* SLIC init AVANT audio_router (ordre anti-deadlock GPIO). */
|
||||
ESP_ERROR_CHECK(slic_init());
|
||||
|
||||
@@ -38,3 +38,18 @@ CONFIG_SPIRAM_SPEED_40M=y # verrouille 40 MHz détecté au boot — prévie
|
||||
# I2S ISR en IRAM : indispensable quand le Bluetooth (SCO) desactive le cache flash,
|
||||
# sinon l'ISR I2S ne tourne pas -> buffers DMA non recycles -> i2s_channel_write timeout.
|
||||
CONFIG_I2S_ISR_IRAM_SAFE=y
|
||||
|
||||
# --- Economie d'energie (batterie) ---
|
||||
# DFS : le CPU descend a 80 MHz au repos (audio en veille) et remonte a 160 MHz
|
||||
# pendant un appel (le driver I2S pose un verrou APB_MAX quand les canaux sont actifs).
|
||||
# esp_pm_configure() est appele dans app_main (max 160 / min 80 / light sleep).
|
||||
CONFIG_PM_ENABLE=y
|
||||
CONFIG_FREERTOS_USE_TICKLESS_IDLE=y
|
||||
CONFIG_FREERTOS_IDLE_TIME_BEFORE_SLEEP=3
|
||||
# Routines de sleep en IRAM : reduit la conso et le jitter de reveil.
|
||||
CONFIG_PM_SLP_IRAM_OPT=y
|
||||
CONFIG_PM_RTOS_IDLE_OPT=y
|
||||
# Le LPCLK BT reste sur le quartz principal (MAIN_XTAL deja regle) : le controleur
|
||||
# BT empeche le light sleep profond tant qu'il est connecte -> lien/SCO stables.
|
||||
# Le gain au repos vient du DFS + power-down codec/I2S. Le light sleep profond
|
||||
# (LPCLK BT sur RC) sera le levier suivant si l'autonomie reste insuffisante.
|
||||
|
||||
Reference in New Issue
Block a user