Replace inverse smoothstep with regular smoothstep for battery curve
All checks were successful
Compile / Compile (push) Successful in 1m22s

This commit is contained in:
Lewis Jackson 2023-06-01 15:12:39 +03:00
parent 3e7ddb805c
commit 32cd26fccf

View file

@ -15,6 +15,7 @@ float WatchFeatures::Battery::GetVoltage()
uint8_t WatchFeatures::Battery::GetPercentage() uint8_t WatchFeatures::Battery::GetPercentage()
{ {
float voltage = GetVoltage(); float voltage = GetVoltage();
Serial.println(voltage);
float level = (GetVoltage() - 3.6f) / 0.6f; float level = (GetVoltage() - 3.6f) / 0.6f;
if (level < 0.0f) { if (level < 0.0f) {
@ -23,7 +24,7 @@ uint8_t WatchFeatures::Battery::GetPercentage()
level = 1.0f; level = 1.0f;
} }
level = 0.5f - sin(asin(1.0f - 2.0f * level) / 3.0f); level = level * level * (3.0f - 2.0f * level);
return std::round(level * 100.0f); return std::round(level * 100.0f);
} }