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:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,4 @@ void printVoltage(void) {
|
||||
OLED::printNumber(volt / 10, 2, FontStyle::SMALL);
|
||||
OLED::print(SmallSymbolDot, FontStyle::SMALL);
|
||||
OLED::printNumber(volt % 10, 1, FontStyle::SMALL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,3 +160,6 @@ int8_t getPowerSourceNumber(void) {
|
||||
}
|
||||
return sourceNumber;
|
||||
}
|
||||
|
||||
// Returns temperature of the tip in *C/*F (based on user settings)
|
||||
uint16_t getTipTemp(void) { return getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC(); }
|
||||
|
||||
Reference in New Issue
Block a user