Skip to content

Commit

Permalink
OLED::printSymbolDeg(): attempt to improve read-ability replacing if/…
Browse files Browse the repository at this point in the history
…else by switch/case
  • Loading branch information
ia committed Jul 17, 2023
1 parent 6104160 commit f26b868
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions source/Core/Drivers/OLED.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,17 @@ 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) {
if (FontStyle::EXTRAS == fontStyle) {
switch (fontStyle) {
case FontStyle::EXTRAS:
OLED::drawSymbol(getSettingValue(SettingsOptions::TemperatureInF) ? 0 : 1);
} else {
if (getSettingValue(SettingsOptions::TemperatureInF)) {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegF : SmallSymbolDegF, fontStyle);
} else {
OLED::print(fontStyle == FontStyle::LARGE ? LargeSymbolDegC : SmallSymbolDegC, fontStyle);
}
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;
}
}

Expand Down

0 comments on commit f26b868

Please sign in to comment.