1
0
forked from me/IronOS

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:
Ivan Zorin
2023-07-18 13:38:14 +03:00
committed by GitHub
parent 1d820acbee
commit c7574c4d0c
11 changed files with 43 additions and 61 deletions

View File

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