First steps for discharge curves, calibration can be deactivated now

This commit is contained in:
CommanderRedYT
2021-10-14 20:32:52 +02:00
parent 5dc794b903
commit 7e7727e180
9 changed files with 45 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ class HardwareSerial;
#endif
namespace {
struct Controller {
Controller(
#ifdef FEATURE_SERIAL
@@ -60,11 +61,17 @@ struct Controller {
FeedbackParser parser{serial, feedbackValid, feedback};
#endif
float getCalibratedVoltage() const
float getCalibratedVoltage(bool applyCalibration) const
{
float voltage = feedback.batVoltage;
//if (settings.battery.applyCalibration)
if (applyCalibration)
{
voltage = ((voltage - float(voltageCalib30V)) * (20.f / (float(voltageCalib50V) - float(voltageCalib30V))) + 30.f);
}
else
{
voltage = voltage / 100.;
}
return voltage;
}
};