Alternative solution with more code lines in different functions

This commit is contained in:
Ivan Zorin
2025-03-07 06:59:33 +03:00
parent 11d9f1ab1d
commit 42aeee1c0b
3 changed files with 9 additions and 11 deletions

View File

@@ -161,13 +161,6 @@ void guiRenderLoop(void) {
currentOperatingMode = newMode; currentOperatingMode = newMode;
} }
bool detailedView = getSettingValue(SettingsOptions::DetailedIDLE) && getSettingValue(SettingsOptions::DetailedSoldering);
if (detailedView &&
((newMode == OperatingMode::HomeScreen && context.previousMode == OperatingMode::Soldering) || (newMode == OperatingMode::Soldering && context.previousMode == OperatingMode::HomeScreen))) {
// Exclude side-slide-scroll animation if we do transition between soldering/home back and forth while detailed view setting for both modes is set
return OLED::refresh();
}
// If the transition marker is set, we need to make the next draw occur to the secondary buffer so we have something to transition to // If the transition marker is set, we need to make the next draw occur to the secondary buffer so we have something to transition to
if (context.transitionMode != TransitionAnimation::None) { if (context.transitionMode != TransitionAnimation::None) {
OLED::useSecondaryFramebuffer(true); OLED::useSecondaryFramebuffer(true);

View File

@@ -37,7 +37,8 @@ OperatingMode handleHomeButtons(const ButtonState buttons, guiContext *cxt) {
break; break;
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
if (!isTipDisconnected()) { if (!isTipDisconnected()) {
cxt->transitionMode = TransitionAnimation::Left; bool detailedView = getSettingValue(SettingsOptions::DetailedIDLE) && getSettingValue(SettingsOptions::DetailedSoldering);
cxt->transitionMode = detailedView ? TransitionAnimation::None : TransitionAnimation::Left;
return OperatingMode::Soldering; return OperatingMode::Soldering;
} }
break; break;

View File

@@ -47,6 +47,8 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
} }
return OperatingMode::Soldering; return OperatingMode::Soldering;
} }
bool detailedView = getSettingValue(SettingsOptions::DetailedIDLE) && getSettingValue(SettingsOptions::DetailedSoldering);
// otherwise we are unlocked // otherwise we are unlocked
switch (buttons) { switch (buttons) {
case BUTTON_NONE: case BUTTON_NONE:
@@ -56,7 +58,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
case BUTTON_BOTH: case BUTTON_BOTH:
/*Fall through*/ /*Fall through*/
case BUTTON_B_LONG: case BUTTON_B_LONG:
cxt->transitionMode = TransitionAnimation::Right; cxt->transitionMode = detailedView ? TransitionAnimation::None : TransitionAnimation::Right;
return OperatingMode::HomeScreen; return OperatingMode::HomeScreen;
case BUTTON_F_LONG: case BUTTON_F_LONG:
// if boost mode is enabled turn it on // if boost mode is enabled turn it on
@@ -142,10 +144,12 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
} else { } else {
ui_draw_soldering_basic_status(cxt->scratch_state.state2); ui_draw_soldering_basic_status(cxt->scratch_state.state2);
} }
bool detailedView = getSettingValue(SettingsOptions::DetailedIDLE) && getSettingValue(SettingsOptions::DetailedSoldering);
// Check if we should bail due to undervoltage for example // Check if we should bail due to undervoltage for example
if (checkExitSoldering()) { if (checkExitSoldering()) {
setBuzzer(false); setBuzzer(false);
cxt->transitionMode = TransitionAnimation::Right; cxt->transitionMode = detailedView ? TransitionAnimation::None : TransitionAnimation::Right;
return OperatingMode::HomeScreen; return OperatingMode::HomeScreen;
} }
#ifdef NO_SLEEP_MODE #ifdef NO_SLEEP_MODE
@@ -153,7 +157,7 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
if (shouldShutdown()) { if (shouldShutdown()) {
// shutdown // shutdown
currentTempTargetDegC = 0; currentTempTargetDegC = 0;
cxt->transitionMode = TransitionAnimation::Right; cxt->transitionMode = detailedView ? TransitionAnimation::None : TransitionAnimation::Right;
return OperatingMode::HomeScreen; return OperatingMode::HomeScreen;
} }
#endif #endif