From d16f9efeecd9f182a150354479f885eb9e2d9bee Mon Sep 17 00:00:00 2001 From: Maximilian Mewes Date: Fri, 6 Jan 2023 19:09:12 +0100 Subject: [PATCH] =?UTF-8?q?Added=20forgotten=20file=20=F0=9F=98=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usermods/Battery/unkown.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usermods/Battery/unkown.h b/usermods/Battery/unkown.h index 63b2674f3..f36c3195e 100644 --- a/usermods/Battery/unkown.h +++ b/usermods/Battery/unkown.h @@ -22,6 +22,14 @@ class Unkown : public Battery this->setCalibration(USERMOD_BATTERY_UNKOWN_CALIBRATION); } + void update(batteryConfig cfg) + { + if(cfg.minVoltage) this->setMinVoltage(cfg.minVoltage); else this->setMinVoltage(USERMOD_BATTERY_UNKOWN_MIN_VOLTAGE); + if(cfg.maxVoltage) this->setMaxVoltage(cfg.maxVoltage); else this->setMaxVoltage(USERMOD_BATTERY_UNKOWN_MAX_VOLTAGE); + if(cfg.calibration) this->setCapacity(cfg.calibration); else this->setCapacity(USERMOD_BATTERY_UNKOWN_CAPACITY); + if(cfg.calibration) this->setCalibration(cfg.calibration); else this->setCalibration(USERMOD_BATTERY_UNKOWN_CALIBRATION); + } + float mapVoltage(float v, float min, float max) override { return this->linearMapping(v, min, max); // basic mapping