From c2d69f91a60a549aad26efd2d2853a10d96a4392 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Mon, 23 Jan 2023 17:49:40 +1100 Subject: [PATCH] Drop decimal when > 99.9W --- .../Core/Threads/OperatingModes/Soldering.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/source/Core/Threads/OperatingModes/Soldering.cpp b/source/Core/Threads/OperatingModes/Soldering.cpp index 5e874f6c..0d997ee6 100644 --- a/source/Core/Threads/OperatingModes/Soldering.cpp +++ b/source/Core/Threads/OperatingModes/Soldering.cpp @@ -127,10 +127,20 @@ void gui_solderingMode(uint8_t jumpToSleep) { } else { OLED::setCursor(67, 0); } - OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL); - OLED::print(SmallSymbolDot, FontStyle::SMALL); - OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL); - OLED::print(SmallSymbolWatts, FontStyle::SMALL); + // Print wattage + { + uint32_t x10Watt = x10WattHistory.average(); + if (x10Watt > 999) { // If we exceed 99.9W we drop the decimal place to keep it all fitting + OLED::print(SmallSymbolSpace, FontStyle::SMALL); + OLED::printNumber(x10WattHistory.average() / 10, 3, FontStyle::SMALL); + OLED::print(SmallSymbolWatts, FontStyle::SMALL); + } else { + OLED::printNumber(x10WattHistory.average() / 10, 2, FontStyle::SMALL); + OLED::print(SmallSymbolDot, FontStyle::SMALL); + OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL); + OLED::print(SmallSymbolWatts, FontStyle::SMALL); + } + } if (OLED::getRotation()) { OLED::setCursor(0, 8);