mirror of
https://github.com/wled/WLED.git
synced 2025-07-19 00:36:36 +00:00
read initial voltage correctly
This commit is contained in:
parent
35d26afcb4
commit
05a8c692f2
@ -27,7 +27,6 @@ class Battery
|
||||
public:
|
||||
Battery()
|
||||
{
|
||||
this->setVoltage(USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE);
|
||||
this->setVoltageMultiplier(USERMOD_BATTERY_VOLTAGE_MULTIPLIER);
|
||||
this->setCalibration(USERMOD_BATTERY_CALIBRATION);
|
||||
}
|
||||
|
@ -150,6 +150,8 @@ class UsermodBattery : public Usermod
|
||||
// update the choosen battery type with configured values
|
||||
bat->update(cfg);
|
||||
|
||||
bat->setVoltage(readVoltage());
|
||||
|
||||
nextReadTime = millis() + readingInterval;
|
||||
lastReadTime = millis();
|
||||
|
||||
@ -389,7 +391,7 @@ class UsermodBattery : public Usermod
|
||||
addBatteryToJsonObject(battery, false);
|
||||
|
||||
// read voltage in case calibration or voltage multiplier changed to see immediate effect
|
||||
// voltage = readVoltage();
|
||||
bat->setVoltage(readVoltage());
|
||||
|
||||
DEBUG_PRINTLN(F("Battery config saved."));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user