Skip to content

Commit

Permalink
OLED::printSymbolDeg - add drawSymbol calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ia committed Jul 17, 2023
1 parent b364be8 commit d670cfb
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 33 deletions.
11 changes: 8 additions & 3 deletions source/Core/Drivers/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,16 @@ void OLED::printWholeScreen(const char *string) {
}
}

// print *C or *F, large or small
void OLED::printSymbolDeg(const FontStyle fontStyle) {
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegF : SmallSymbolDegF, fontStyle);
if (FontStyle::EXTRAS == fontStyle) {
OLED::drawSymbol(getSettingValue(SettingsOptions::TemperatureInF) ? 0 : 1);
} else {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegC : SmallSymbolDegC, fontStyle);
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegF : SmallSymbolDegF, fontStyle);
} else {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegC : SmallSymbolDegC, fontStyle);
}
}
}

Expand Down
9 changes: 1 addition & 8 deletions source/Core/Threads/OperatingModes/Sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,14 @@ int gui_SolderingSleepingMode(bool stayOff, bool autoStarted) {
OLED::setCursor(0, 8);
OLED::print(translatedString(Tr->SleepingTipAdvancedString), FontStyle::SMALL);
OLED::printNumber(tipTemp, 3, FontStyle::SMALL);

OLED::printSymbolDeg(FontStyle::SMALL);

OLED::print(SmallSymbolSpace, FontStyle::SMALL);
printVoltage();
OLED::print(SmallSymbolVolts, FontStyle::SMALL);
} else {
OLED::print(translatedString(Tr->SleepingSimpleString), FontStyle::LARGE);
OLED::printNumber(tipTemp, 3, FontStyle::LARGE);

if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
} else {
OLED::drawSymbol(1);
}
OLED::printSymbolDeg(FontStyle::EXTRAS);
}

OLED::refresh();
Expand Down
6 changes: 1 addition & 5 deletions source/Core/Threads/OperatingModes/TemperatureAdjust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ void gui_solderingTempAdjust(void) {

OLED::print(LargeSymbolSpace, FontStyle::LARGE);
OLED::printNumber(getSettingValue(SettingsOptions::SolderingTemp), 3, FontStyle::LARGE);
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::drawSymbol(0);
} else {
OLED::drawSymbol(1);
}
OLED::printSymbolDeg(FontStyle::EXTRAS);
OLED::print(LargeSymbolSpace, FontStyle::LARGE);
if (OLED::getRotation()) {
OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? LargeSymbolMinus : LargeSymbolPlus, FontStyle::LARGE);
Expand Down
20 changes: 3 additions & 17 deletions source/Core/Threads/OperatingModes/utils/DrawTipTemperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,11 @@

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();
}
uint32_t Temp = getSettingValue(SettingsOptions::TemperatureInF) ? TipThermoModel::getTipInF() : TipThermoModel::getTipInC();

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
OLED::printSymbolDeg(font);
}
// For big font, can draw nice symbols, otherwise fall back to chars
OLED::printSymbolDeg(font == FontStyle::LARGE ? FontStyle::EXTRAS : font);
}
}

0 comments on commit d670cfb

Please sign in to comment.