Replace inverse smoothstep with regular smoothstep for battery curve
All checks were successful
Compile / Compile (push) Successful in 1m22s
All checks were successful
Compile / Compile (push) Successful in 1m22s
This commit is contained in:
parent
3e7ddb805c
commit
32cd26fccf
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue