mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
settingsGUI.cpp: remove duplicated calls (#2065)
settingsGUI.cpp: remove duplicated calls from if-else blocks
This commit is contained in:
@@ -579,7 +579,6 @@ static void setBoostTemp(void) {
|
|||||||
if (value >= MAX_TEMP_F) {
|
if (value >= MAX_TEMP_F) {
|
||||||
value = 0; // jump to off
|
value = 0; // jump to off
|
||||||
}
|
}
|
||||||
setSettingValue(SettingsOptions::BoostTemp, value);
|
|
||||||
} else {
|
} else {
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
value = MIN_BOOST_TEMP_C; // loop back at 250
|
value = MIN_BOOST_TEMP_C; // loop back at 250
|
||||||
@@ -654,14 +653,13 @@ static void setProfileTemp(const enum SettingsOptions option) {
|
|||||||
if (temp > MAX_TEMP_F) {
|
if (temp > MAX_TEMP_F) {
|
||||||
temp = MIN_TEMP_F;
|
temp = MIN_TEMP_F;
|
||||||
}
|
}
|
||||||
setSettingValue(option, temp);
|
|
||||||
} else {
|
} else {
|
||||||
temp += 5;
|
temp += 5;
|
||||||
if (temp > MAX_TEMP_C) {
|
if (temp > MAX_TEMP_C) {
|
||||||
temp = MIN_TEMP_C;
|
temp = MIN_TEMP_C;
|
||||||
}
|
}
|
||||||
setSettingValue(option, temp);
|
|
||||||
}
|
}
|
||||||
|
setSettingValue(option, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setProfilePreheatTemp(void) { return setProfileTemp(SettingsOptions::ProfilePreheatTemp); }
|
static void setProfilePreheatTemp(void) { return setProfileTemp(SettingsOptions::ProfilePreheatTemp); }
|
||||||
@@ -712,14 +710,13 @@ static void setSleepTemp(void) {
|
|||||||
if (temp > 580) {
|
if (temp > 580) {
|
||||||
temp = 60;
|
temp = 60;
|
||||||
}
|
}
|
||||||
setSettingValue(SettingsOptions::SleepTemp, temp);
|
|
||||||
} else {
|
} else {
|
||||||
temp += 10;
|
temp += 10;
|
||||||
if (temp > 300) {
|
if (temp > 300) {
|
||||||
temp = 10;
|
temp = 10;
|
||||||
}
|
}
|
||||||
setSettingValue(SettingsOptions::SleepTemp, temp);
|
|
||||||
}
|
}
|
||||||
|
setSettingValue(SettingsOptions::SleepTemp, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void displaySleepTemp(void) { OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE); }
|
static void displaySleepTemp(void) { OLED::printNumber(getSettingValue(SettingsOptions::SleepTemp), 3, FontStyle::LARGE); }
|
||||||
@@ -759,12 +756,11 @@ static bool showHallEffect(void) { return getHallSensorFitted(); }
|
|||||||
static void displayHallEffectSleepTime(void) {
|
static void displayHallEffectSleepTime(void) {
|
||||||
if (getSettingValue(SettingsOptions::HallEffectSleepTime)) {
|
if (getSettingValue(SettingsOptions::HallEffectSleepTime)) {
|
||||||
OLED::printNumber(getSettingValue(SettingsOptions::HallEffectSleepTime) * 5, 2, FontStyle::LARGE, false);
|
OLED::printNumber(getSettingValue(SettingsOptions::HallEffectSleepTime) * 5, 2, FontStyle::LARGE, false);
|
||||||
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
|
|
||||||
} else {
|
} else {
|
||||||
// When sleep time is set to zero, we sleep for 1 second anyways. This is the default.
|
// When sleep time is set to zero, we sleep for 1 second anyways. This is the default.
|
||||||
OLED::printNumber(1, 2, FontStyle::LARGE, false);
|
OLED::printNumber(1, 2, FontStyle::LARGE, false);
|
||||||
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
|
|
||||||
}
|
}
|
||||||
|
OLED::print(LargeSymbolSeconds, FontStyle::LARGE);
|
||||||
}
|
}
|
||||||
#endif /* HALL_SENSOR */
|
#endif /* HALL_SENSOR */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user