diff --git a/workspace/TS100/Core/Inc/OLED.hpp b/workspace/TS100/Core/Inc/OLED.hpp index 56f14b2e..2ceacb21 100644 --- a/workspace/TS100/Core/Inc/OLED.hpp +++ b/workspace/TS100/Core/Inc/OLED.hpp @@ -74,7 +74,7 @@ public: drawArea(x, 0, width, 16, buffer); } // Draws an image to the buffer, at x offset from top to bottom (fixed height renders) - static void printNumber(uint16_t number, uint8_t places); + static void printNumber(uint16_t number, uint8_t places,bool noLeaderZeros=true); // Draws a number at the current cursor location // Clears the buffer static void clearScreen() { diff --git a/workspace/TS100/Core/Src/OLED.cpp b/workspace/TS100/Core/Src/OLED.cpp index 71c06f16..7506dd50 100644 --- a/workspace/TS100/Core/Src/OLED.cpp +++ b/workspace/TS100/Core/Src/OLED.cpp @@ -175,7 +175,7 @@ inline void stripLeaderZeros(char *buffer) { } } // maximum places is 5 -void OLED::printNumber(uint16_t number, uint8_t places) { +void OLED::printNumber(uint16_t number, uint8_t places, bool noLeaderZeros) { char buffer[7] = { 0 }; if (places >= 5) { @@ -203,7 +203,8 @@ void OLED::printNumber(uint16_t number, uint8_t places) { } buffer[0] = 2 + number % 10; - stripLeaderZeros(buffer); + if (noLeaderZeros) + stripLeaderZeros(buffer); print(buffer); }