Transitions

Update SolderingProfile.cpp

Hook in transistions
This commit is contained in:
Ben V. Brown
2023-07-20 21:19:39 +10:00
parent 5b86637e48
commit 4d1cfcf2e6
8 changed files with 65 additions and 39 deletions

View File

@@ -86,9 +86,10 @@ OperatingMode showDebugMenu(const ButtonState buttons, guiContext *cxt) {
break;
}
if (buttons == BUTTON_B_SHORT)
if (buttons == BUTTON_B_SHORT) {
cxt->transitionMode = TransitionAnimation::Up;
return OperatingMode::InitialisationDone;
else if (buttons == BUTTON_F_SHORT) {
} else if (buttons == BUTTON_F_SHORT) {
cxt->scratch_state.state1++;
#ifdef HALL_SENSOR
cxt->scratch_state.state1 = cxt->scratch_state.state1 % 17;

View File

@@ -34,9 +34,11 @@ OperatingMode handleHomeButtons(const ButtonState buttons, guiContext *cxt) {
break;
case BUTTON_B_LONG:
cxt->transitionMode = TransitionAnimation::Down;
return OperatingMode::DebugMenuReadout;
break;
case BUTTON_F_LONG:
cxt->transitionMode = TransitionAnimation::Left;
#ifdef PROFILE_SUPPORT
if (!isTipDisconnected()) {
return OperatingMode::SolderingProfile;
@@ -46,11 +48,13 @@ OperatingMode handleHomeButtons(const ButtonState buttons, guiContext *cxt) {
#endif
break;
case BUTTON_F_SHORT:
cxt->transitionMode = TransitionAnimation::Left;
if (!isTipDisconnected()) {
return OperatingMode::Soldering;
}
break;
case BUTTON_B_SHORT:
cxt->transitionMode = TransitionAnimation::Right;
return OperatingMode::SettingsMenu;
break;
default:

View File

@@ -41,7 +41,13 @@ enum class OperatingMode {
ThermalRunaway, // Thermal Runaway warning state.
};
enum class TransitionAnimation { None = 0, Right, Left, Down };
enum class TransitionAnimation {
None = 0,
Right = 1,
Left = 2,
Down = 3,
Up = 4,
};
// Generic context struct used for gui functions to be able to retain state
struct guiContext {

View File

@@ -1,6 +1,5 @@
#include "OperatingModes.h"
#include "ScrollMessage.hpp"
#include "bflb_platform.h"
#define HELP_TEXT_TIMEOUT_TICKS (TICKS_SECOND * 3)
/*
@@ -138,6 +137,7 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
currentMenu[currentScreen].incrementHandler();
} else {
(*subEntry) += 1;
cxt->transitionMode = TransitionAnimation::Right;
}
} else {
callIncrementHandler();
@@ -152,6 +152,7 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
// Scroll down
if (currentScreen < (*currentMenuLength) - 1) {
// We can increment freely
cxt->transitionMode = TransitionAnimation::Down;
if (*subEntry == 0) {
(*mainEntry) += 1;
} else {
@@ -161,11 +162,14 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
// We are at an end somewhere, increment as appropriate
if (*subEntry == 0) {
// This is end of the list
cxt->transitionMode = TransitionAnimation::Left;
return OperatingMode::HomeScreen;
} else {
(*subEntry) = 0;
(*mainEntry) += 1;
}
// When we exit a list we want to animate to the left
cxt->transitionMode = TransitionAnimation::Left;
}
}
break;

View File

@@ -30,6 +30,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
break;
case BUTTON_BOTH:
case BUTTON_B_LONG:
cxt->transitionMode = TransitionAnimation::Right;
return OperatingMode::HomeScreen;
case BUTTON_F_LONG:
// if boost mode is enabled turn it on
@@ -39,6 +40,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
break;
case BUTTON_F_SHORT:
case BUTTON_B_SHORT: {
cxt->transitionMode = TransitionAnimation::Left;
return OperatingMode::TemperatureAdjust;
case BUTTON_BOTH_LONG:
if (getSettingValue(SettingsOptions::LockingMode) != 0) {
@@ -80,6 +82,7 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
// Check if we should bail due to undervoltage for example
if (checkExitSoldering()) {
setBuzzer(false);
cxt->transitionMode = TransitionAnimation::Right;
return OperatingMode::HomeScreen;
}
#ifdef NO_SLEEP_MODE
@@ -175,4 +178,5 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
} else {
basicSolderingStatus(cxt->scratch_state.state2);
}
return OperatingMode::Soldering; // Stay put
}

View File

@@ -22,6 +22,7 @@ OperatingMode gui_solderingProfileMode(const ButtonState buttons, guiContext *cx
switch (buttons) {
case BUTTON_BOTH:
case BUTTON_B_LONG:
cxt->transitionMode = TransitionAnimation::Right;
return OperatingMode::HomeScreen; // exit on back long hold
case BUTTON_F_LONG:
case BUTTON_F_SHORT:
@@ -207,4 +208,5 @@ OperatingMode gui_solderingProfileMode(const ButtonState buttons, guiContext *cx
} else {
setStatusLED(LED_HOT);
}
return OperatingMode::SolderingProfile;
}

View File

@@ -77,6 +77,7 @@ OperatingMode gui_solderingTempAdjust(const ButtonState buttons, guiContext *cxt
setSettingValue(SettingsOptions::SolderingTemp, (uint16_t)newTemp);
}
if (xTaskGetTickCount() - cxt->viewEnterTime > (TICKS_SECOND * 2)) {
cxt->transitionMode = TransitionAnimation::Right;
return cxt->previousMode; // exit if user just doesn't press anything for a bit
}
if (OLED::getRotation()) {