mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 14:42:05 +00:00
Power::readPowerStatus is called on startup, but AnalogBatteryLevel::getBattVoltage skips the read because 5 seconds have not elapsed since last_read_time_ms, which is initialized to zero. `batMv=3100` is reported because AnalogBatteryLevel::last_read_value is initialized as: ``` float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS); ```
This commit is contained in:
parent
e866734a25
commit
8fcfe7f28b
@ -271,7 +271,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
|
||||
config.power.adc_multiplier_override > 0 ? config.power.adc_multiplier_override : ADC_MULTIPLIER;
|
||||
// Do not call analogRead() often.
|
||||
const uint32_t min_read_interval = 5000;
|
||||
if (!Throttle::isWithinTimespanMs(last_read_time_ms, min_read_interval)) {
|
||||
if (!initial_read_done || !Throttle::isWithinTimespanMs(last_read_time_ms, min_read_interval)) {
|
||||
last_read_time_ms = millis();
|
||||
|
||||
uint32_t raw = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user