1
0
forked from me/IronOS

moved debugNumber into OLED class

This commit is contained in:
David P Hilton
2018-10-28 21:51:49 -06:00
parent 76b460cd77
commit 6a3ca96815
3 changed files with 16 additions and 14 deletions

View File

@@ -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

View File

@@ -7,6 +7,7 @@
#include <string.h>
#include <OLED.hpp>
#include <stdlib.h>
#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);

View File

@@ -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('.');