From 6a3ca968156408537a425eaae2843b1341d7066a Mon Sep 17 00:00:00 2001 From: David P Hilton Date: Sun, 28 Oct 2018 21:51:49 -0600 Subject: [PATCH] moved debugNumber into OLED class --- workspace/TS100/inc/OLED.hpp | 1 + workspace/TS100/src/OLED.cpp | 15 +++++++++++++++ workspace/TS100/src/main.cpp | 14 -------------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/workspace/TS100/inc/OLED.hpp b/workspace/TS100/inc/OLED.hpp index 095e17d4..5f902de2 100644 --- a/workspace/TS100/inc/OLED.hpp +++ b/workspace/TS100/inc/OLED.hpp @@ -82,6 +82,7 @@ public: static void drawCheckbox(bool state) { drawSymbol((state) ? 16 : 17); } + static void debugNumber(int32_t val); static void drawSymbol(uint8_t symbolID);//Used for drawing symbols of a predictable width static void drawArea(int16_t x, int8_t y, uint8_t wide, uint8_t height, const uint8_t* ptr); //Draw an area, but y must be aligned on 0/8 offset diff --git a/workspace/TS100/src/OLED.cpp b/workspace/TS100/src/OLED.cpp index 17067208..ac1924d2 100644 --- a/workspace/TS100/src/OLED.cpp +++ b/workspace/TS100/src/OLED.cpp @@ -7,6 +7,7 @@ #include #include +#include #include "Translation.h" #include "cmsis_os.h" @@ -231,6 +232,20 @@ void OLED::printNumber(uint16_t number, uint8_t places) { print(buffer); } +void OLED::debugNumber(int32_t val) { + if (abs(val) > 99999) { + OLED::print(" OoB"); // out of bounds + return; + } + if (val >= 0) { + OLED::drawChar(' '); + OLED::printNumber(val, 5); + } else { + OLED::drawChar('-'); + OLED::printNumber(-val, 5); + } +} + void OLED::drawSymbol(uint8_t symbolID) { // draw a symbol to the current cursor location setFont(2); diff --git a/workspace/TS100/src/main.cpp b/workspace/TS100/src/main.cpp index be365ab8..bce0d4a9 100644 --- a/workspace/TS100/src/main.cpp +++ b/workspace/TS100/src/main.cpp @@ -90,20 +90,6 @@ int main(void) { } } -void debugNumber(int32_t val) { - if (abs(val) > 99999) { - OLED::print(" OoB"); // out of bounds - return; - } - if (val >= 0) { - OLED::drawChar(' '); - OLED::printNumber(val, 5); - } else { - OLED::drawChar('-'); - OLED::printNumber(-val, 5); - } -} - void printVoltage() { OLED::printNumber(getInputVoltageX10(systemSettings.voltageDiv) / 10, 2); OLED::drawChar('.');