This commit is contained in:
CommanderRedYT
2022-01-03 23:47:55 +01:00
parent c8e36dda17
commit 03aeee7a22
4 changed files with 5 additions and 4 deletions

View File

@ -196,5 +196,5 @@ std::string getBatteryDebugString()
} }
namespace battery { namespace battery {
float bootBatPercentage{-1}; std::optional<float> bootBatPercentage;
} }

View File

@ -34,5 +34,5 @@ float getPercentageByWh(float wh);
float getTarget_mAh(); float getTarget_mAh();
namespace battery { namespace battery {
extern float bootBatPercentage; extern std::optional<float> bootBatPercentage;
} }

View File

@ -102,7 +102,8 @@ void BatteryMenu::redraw()
avgVoltage = avgVoltage / controllers.size(); avgVoltage = avgVoltage / controllers.size();
const auto batPercent = getBatteryPercentage(avgVoltage, BatteryCellType(configs.battery.cellType.value)); const auto batPercent = getBatteryPercentage(avgVoltage, BatteryCellType(configs.battery.cellType.value));
m_doubleProgressBarBatPercentage.redraw(batPercent, battery::bootBatPercentage); if (battery::bootBatPercentage)
m_doubleProgressBarBatPercentage.redraw(batPercent, *battery::bootBatPercentage);
} }
void BatteryMenu::back() void BatteryMenu::back()

View File

@ -113,7 +113,7 @@ extern "C" void app_main()
lastStatsPush = now; lastStatsPush = now;
} }
if (battery::bootBatPercentage == -1) if (!battery::bootBatPercentage)
{ {
if(controllers.front.feedbackValid && controllers.back.feedbackValid) if(controllers.front.feedbackValid && controllers.back.feedbackValid)
{ {