Added calculation of megajoules
This commit is contained in:
@ -155,6 +155,11 @@ float getPercentageByWh(float wh)
|
||||
return maxWh / wh;
|
||||
}
|
||||
|
||||
float getBatteryWattHours()
|
||||
{
|
||||
return (getTarget_mAh() / 1000.f) * 3.7 * configs.battery.cellsParallel.value * configs.battery.cellsSeries.value;
|
||||
}
|
||||
|
||||
float getTarget_mAh()
|
||||
{
|
||||
float target_mah = 2000; //default
|
||||
|
@ -19,6 +19,8 @@ float getBatteryPercentage(float batVoltage, BatteryCellType cellType);
|
||||
|
||||
float getRemainingWattHours();
|
||||
|
||||
float getBatteryWattHours();
|
||||
|
||||
std::string getBatteryPercentageString();
|
||||
|
||||
std::string getBatteryRemainingWattHoursString();
|
||||
|
@ -14,6 +14,11 @@
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
float calculateMegaJoules()
|
||||
{
|
||||
return getBatteryWattHours() * 0.0036;
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::start()
|
||||
{
|
||||
Base::start();
|
||||
@ -46,7 +51,7 @@ void ConfiscationDisplay::initScreen()
|
||||
espgui::tft.drawString("Bei erneuter, widerrechtlicher", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Beschlagnahmung wird die Selbst-", 10, y+=lineheight);
|
||||
espgui::tft.drawString("Vernichtung durch Kurzschluss", 10, y+=lineheight);
|
||||
espgui::tft.drawString("der Batterie eingeleitet (ca 4.31MJ)", 10, y+=lineheight);
|
||||
espgui::tft.drawString(fmt::format("der Batterie eingeleitet (ca {:.2f}MJ)", calculateMegaJoules()), 10, y+=lineheight);
|
||||
}
|
||||
|
||||
void ConfiscationDisplay::redraw()
|
||||
@ -74,7 +79,7 @@ void ConfiscationDisplay::update()
|
||||
{
|
||||
m_progress = 500;
|
||||
const auto timeout = cpputils::randomNumber(3, 7, espcpputils::esp_random_device{});
|
||||
ESP_LOGI("BOBBY", "agian in %i", timeout);
|
||||
ESP_LOGI("BOBBY", "again in %i", timeout);
|
||||
m_nextRestart = espchrono::millis_clock::now() + std::chrono::seconds{timeout};
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user