Added voltage field
This commit is contained in:
@@ -448,9 +448,13 @@ void send_information()
|
|||||||
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
if (const auto avgVoltage = controllers.getAvgVoltage(); avgVoltage)
|
||||||
{
|
{
|
||||||
infoObject["percentage"] = fmt::format("{:.1f}%", getBatteryPercentage(*avgVoltage, BatteryCellType(configs.battery.cellType.value())));
|
infoObject["percentage"] = fmt::format("{:.1f}%", getBatteryPercentage(*avgVoltage, BatteryCellType(configs.battery.cellType.value())));
|
||||||
|
infoObject["voltage"] = *avgVoltage;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
infoObject["percentage"] = nullptr;
|
infoObject["percentage"] = nullptr;
|
||||||
|
infoObject["voltage"] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
std::string body;
|
std::string body;
|
||||||
serializeJson(doc, body);
|
serializeJson(doc, body);
|
||||||
|
Reference in New Issue
Block a user