From f0518bc99a00ca38d8b7da4bac30dd500e3a511b Mon Sep 17 00:00:00 2001 From: neilhao Date: Sat, 30 Jul 2022 20:12:28 +0800 Subject: [PATCH] 'BATTERY_SENSE_SAMPLES' (#1577) --- src/Power.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Power.cpp b/src/Power.cpp index 6d95e2e09..fa09eaeba 100644 --- a/src/Power.cpp +++ b/src/Power.cpp @@ -112,7 +112,18 @@ class AnalogBatteryLevel : public HasBatteryLevel const uint32_t min_read_interval = 5000; if (millis() - last_read_time_ms > min_read_interval) { last_read_time_ms = millis(); + +#ifdef BATTERY_SENSE_SAMPLES +//Set the number of samples, it has an effect of increasing sensitivity, especially in complex electromagnetic environment. + uint32_t raw = 0; + for(uint32_t i=0; i