From 36a44de11991d12254fe486ec1f61f8810457f92 Mon Sep 17 00:00:00 2001 From: Kevin Le Date: Wed, 6 May 2026 13:16:54 +0700 Subject: [PATCH] Reduced time drift from 60s/day to 7s/day for ESP32-based repeaters with power saving. --- examples/simple_repeater/main.cpp | 4 ++-- src/helpers/ESP32Board.h | 12 ------------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/examples/simple_repeater/main.cpp b/examples/simple_repeater/main.cpp index 7946809e..2ce056f5 100644 --- a/examples/simple_repeater/main.cpp +++ b/examples/simple_repeater/main.cpp @@ -154,10 +154,10 @@ void loop() { if (the_mesh.getNodePrefs()->powersaving_enabled && !the_mesh.hasPendingWork()) { #if defined(NRF52_PLATFORM) - board.sleep(1800); // nrf ignores seconds param, sleeps whenever possible + board.sleep(0); // nrf ignores seconds param, sleeps whenever possible #else if (the_mesh.millisHasNowPassed(POWERSAVING_FIRSTSLEEP_SECS * 1000)) { // To check if it is time to sleep - board.sleep(1800); // Sleep. Wake up after 30 minutes or when receiving a LoRa packet + board.sleep(30); // Sleep. Wake up after a while or when receiving a LoRa packet } #endif } diff --git a/src/helpers/ESP32Board.h b/src/helpers/ESP32Board.h index 36e34976..73c58e2f 100644 --- a/src/helpers/ESP32Board.h +++ b/src/helpers/ESP32Board.h @@ -73,18 +73,6 @@ public: return; } - // Use more accurate clock in sleep -#if SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256 - if (rtc_clk_slow_src_get() != SOC_RTC_SLOW_CLK_SRC_RC_FAST) { - - // Switch slow clock source to RC_FAST / 256 (~31.25 kHz) - rtc_clk_slow_src_set(SOC_RTC_SLOW_CLK_SRC_RC_FAST); - - // Calibrate slow clock - esp_clk_slow_boot_cal(1024); - } -#endif - // Set GPIO wakeup gpio_num_t wakeupPin = (gpio_num_t)getIRQGpio();