mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Implement printSymbolDeg() helper function as method for OLED class (#1743)
* implement printSymbolDeg() helper function as method for OLED class * Remove extra line added by mistake * OLED::printSymbolDeg - add drawSymbol calls * OLED: make comments more clear for implemented method * OLED::printSymbolDeg(): attempt to improve read-ability replacing if/else by switch/case * OLED::printSymbolDeg() - add comment for drawSymbol to clarify its underhood * get tipTemp using ?/: instead of if/else * Implement getTipTemp() helper * Add missing header --------- Co-authored-by: Ben V. Brown <5425387+Ralim@users.noreply.github.com>
This commit is contained in:
@@ -481,6 +481,23 @@ void OLED::printWholeScreen(const char *string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Print *F or *C - in font style of Small, Large (by default) or Extra based on input arg
|
||||
void OLED::printSymbolDeg(const FontStyle fontStyle) {
|
||||
switch (fontStyle) {
|
||||
case FontStyle::EXTRAS:
|
||||
// Picks *F or *C in ExtraFontChars[] from Font.h
|
||||
OLED::drawSymbol(getSettingValue(SettingsOptions::TemperatureInF) ? 0 : 1);
|
||||
break;
|
||||
case FontStyle::LARGE:
|
||||
OLED::print(getSettingValue(SettingsOptions::TemperatureInF) ? LargeSymbolDegF : LargeSymbolDegC, fontStyle);
|
||||
break;
|
||||
case FontStyle::SMALL:
|
||||
default:
|
||||
OLED::print(getSettingValue(SettingsOptions::TemperatureInF) ? SmallSymbolDegF : SmallSymbolDegC, fontStyle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void stripLeaderZeros(char *buffer, uint8_t places) {
|
||||
// Removing the leading zero's by swapping them to SymbolSpace
|
||||
// Stop 1 short so that we dont blank entire number if its zero
|
||||
|
||||
@@ -103,7 +103,8 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void setRotation(bool leftHanded); // Set the rotation for the screen
|
||||
// Set the rotation for the screen
|
||||
static void setRotation(bool leftHanded);
|
||||
// Get the current rotation of the LCD
|
||||
static bool getRotation() {
|
||||
#ifdef OLED_FLIP
|
||||
@@ -115,8 +116,11 @@ public:
|
||||
static void setBrightness(uint8_t contrast);
|
||||
static void setInverseDisplay(bool inverted);
|
||||
static int16_t getCursorX() { return cursor_x; }
|
||||
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255); // Draw a string to the current location, with selected font; optionally - with MAX length only
|
||||
// Draw a string to the current location, with selected font; optionally - with MAX length only
|
||||
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255);
|
||||
static void printWholeScreen(const char *string);
|
||||
// Print *F or *C - in font style of Small, Large (by default) or Extra based on input arg
|
||||
static void printSymbolDeg(FontStyle fontStyle = FontStyle::LARGE);
|
||||
// Set the cursor location by pixels
|
||||
static void setCursor(int16_t x, int16_t y) {
|
||||
cursor_x = x;
|
||||
|
||||
Reference in New Issue
Block a user