bmsdisplay removed string concats
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// Arduino includes
|
// 3rdparty lib includes
|
||||||
#include <Arduino.h>
|
#include <fmt/core.h>
|
||||||
|
|
||||||
// local includes
|
// local includes
|
||||||
#include "display.h"
|
#include "display.h"
|
||||||
@ -95,11 +95,11 @@ void BmsDisplay::redraw()
|
|||||||
|
|
||||||
if (bluetoothSerial.hasClient())
|
if (bluetoothSerial.hasClient())
|
||||||
{
|
{
|
||||||
m_voltageLabel.redraw(std::to_string(bms::voltage) + 'V');
|
m_voltageLabel.redraw(fmt::format("{:.02f}V", bms::voltage));
|
||||||
m_capacityLabel.redraw(std::to_string(int(bms::capacity)) + "mAh");
|
m_capacityLabel.redraw(fmt::format("{:.02f} mAh", bms::capacity));
|
||||||
m_socLabel.redraw(std::to_string(bms::soc) + '%');
|
m_socLabel.redraw(fmt::format("{:.02f}%", bms::soc));
|
||||||
m_powerLabel.redraw(std::to_string(bms::power) + 'W');
|
m_powerLabel.redraw(fmt::format("{:.02f}W", bms::power));
|
||||||
m_currentLabel.redraw(std::to_string(bms::current) + 'A');
|
m_currentLabel.redraw(fmt::format("{:.02f}A", bms::current));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -110,18 +110,18 @@ void BmsDisplay::redraw()
|
|||||||
m_currentLabel.clear();
|
m_currentLabel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_speedLabel.redraw(std::to_string(avgSpeedKmh) + "kmh");
|
m_speedLabel.redraw(fmt::format("{:.02f}kmh", avgSpeedKmh));
|
||||||
|
|
||||||
if (bluetoothSerial.hasClient())
|
if (bluetoothSerial.hasClient())
|
||||||
m_powerPerSpeedLabel.redraw(std::to_string(avgSpeedKmh < 1 ? 0 : bms::power / avgSpeedKmh) + "W/kmh");
|
m_powerPerSpeedLabel.redraw(fmt::format("{:.02f}W/kmh", avgSpeedKmh < 1 ? 0 : bms::power / avgSpeedKmh));
|
||||||
else
|
else
|
||||||
m_powerPerSpeedLabel.clear();
|
m_powerPerSpeedLabel.clear();
|
||||||
|
|
||||||
for (int i = 0; i < 12; i++)
|
for (int i = 0; i < 12; i++)
|
||||||
m_battLabels[i].redraw(std::to_string(bms::batt[i]));
|
m_battLabels[i].redraw(fmt::format("{:.02f}", bms::batt[i]));
|
||||||
|
|
||||||
if (bluetoothSerial.hasClient())
|
if (bluetoothSerial.hasClient())
|
||||||
m_cycleLabel.redraw(std::to_string(bms::cycle) + "AH");
|
m_cycleLabel.redraw(fmt::format("{:.02f}AH", bms::cycle));
|
||||||
else
|
else
|
||||||
m_cycleLabel.clear();
|
m_cycleLabel.clear();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user