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

@@ -1,31 +1,14 @@
#include "OperatingModeUtilities.h"
#include "OperatingModes.h"
#include "TipThermoModel.h"
void gui_drawTipTemp(bool symbol, const FontStyle font) {
// Draw tip temp handling unit conversion & tolerance near setpoint
uint32_t Temp = 0;
if (getSettingValue(SettingsOptions::TemperatureInF)) {
Temp = TipThermoModel::getTipInF();
} else {
Temp = TipThermoModel::getTipInC();
}
uint16_t Temp = getTipTemp();
OLED::printNumber(Temp, 3, font); // Draw the tip temp out
if (symbol) {
if (font == FontStyle::LARGE) {
// Big font, can draw nice symbols
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
} else {
OLED::drawSymbol(1);
}
} else {
// Otherwise fall back to chars
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(SmallSymbolDegF, FontStyle::SMALL);
} else {
OLED::print(SmallSymbolDegC, FontStyle::SMALL);
}
}
// For big font, can draw nice symbols, otherwise fall back to chars
OLED::printSymbolDeg(font == FontStyle::LARGE ? FontStyle::EXTRAS : font);
}
}