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