From 8a2280edb0cc75599249130f7315b6ecaea4ef51 Mon Sep 17 00:00:00 2001 From: clement Date: Sat, 20 Jun 2026 00:33:10 +0200 Subject: [PATCH] feat(pwr): poll adaptatif des taches au repos --- components/audio_router/audio_router.c | 2 +- components/call_manager/call_manager.c | 4 +++- components/cli/cli.c | 2 +- components/hook_monitor/hook_monitor.c | 7 +++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/audio_router/audio_router.c b/components/audio_router/audio_router.c index 66e7121..f5e6a55 100644 --- a/components/audio_router/audio_router.c +++ b/components/audio_router/audio_router.c @@ -212,7 +212,7 @@ static void tone_task(void *a) tone_mode_t m = s_mode; if (m == TONE_NONE) { s_tone_idle = true; - vTaskDelay(pdMS_TO_TICKS(20)); + vTaskDelay(pdMS_TO_TICKS(100)); /* repos : poll lent -> CPU dort (éco batterie) */ t = 0; ph = 0; sco_acc_n = 0; diff --git a/components/call_manager/call_manager.c b/components/call_manager/call_manager.c index 8ac8485..3a1d3f9 100644 --- a/components/call_manager/call_manager.c +++ b/components/call_manager/call_manager.c @@ -259,7 +259,9 @@ static void call_task(void *arg) } } - vTaskDelay(pdMS_TO_TICKS(50)); + /* Poll adaptatif : 250 ms au repos (raccroché, rien à faire — le hook IRQ + * et la file BT réveillent à temps), 50 ms sinon (numérotation/appel). */ + vTaskDelay(pdMS_TO_TICKS(st == ST_IDLE ? 250 : 50)); } } diff --git a/components/cli/cli.c b/components/cli/cli.c index f77e90b..5af3aeb 100644 --- a/components/cli/cli.c +++ b/components/cli/cli.c @@ -54,7 +54,7 @@ static void cli_task(void *a) for (;;) { int c = getchar(); if (c == EOF) { - vTaskDelay(pdMS_TO_TICKS(30)); + vTaskDelay(pdMS_TO_TICKS(150)); /* repos : poll lent -> CPU dort (éco batterie) */ continue; } if (c == '\n' || c == '\r') { diff --git a/components/hook_monitor/hook_monitor.c b/components/hook_monitor/hook_monitor.c index aad758b..e2e612b 100644 --- a/components/hook_monitor/hook_monitor.c +++ b/components/hook_monitor/hook_monitor.c @@ -18,7 +18,8 @@ #define TAG "hook_monitor" -#define POLL_MS 10 +#define POLL_MS 10 /* décroché : résolution fine pour décoder les impulsions */ +#define POLL_IDLE_MS 80 /* raccroché (repos) : poll lent -> CPU dort + DFS (éco batterie) */ #define DEBOUNCE_MS 30 #define PULSE_MIN_WIDTH_MS 20 /* filtre anti-glitch */ #define INTER_DIGIT_GAP_MS 200 /* fin d'un chiffre au cadran */ @@ -93,7 +94,9 @@ static void hook_task(void *arg) pulse_count = 0; } } - vTaskDelay(pdMS_TO_TICKS(POLL_MS)); + /* Poll adaptatif : 10 ms décroché (décodage impulsions), 80 ms raccroché + * (repos) -> le CPU dort plus longtemps, DFS/tickless idle s'engagent. */ + vTaskDelay(pdMS_TO_TICKS(stable ? POLL_MS : POLL_IDLE_MS)); } }