Fixes for some animations not running
Dont bail on animations if keypress is still held
This commit is contained in:
@@ -262,7 +262,8 @@ void OLED::maskScrollIndicatorOnOLED() {
|
||||
* If forward is true, this displays a forward navigation to the second framebuffer contents.
|
||||
* Otherwise a rewinding navigation animation is shown to the second framebuffer contents.
|
||||
*/
|
||||
void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
|
||||
void OLED::transitionSecondaryFramebuffer(const bool forwardNavigation, const TickType_t viewEnterTime) {
|
||||
bool buttonsReleased = getButtonState() == BUTTON_NONE;
|
||||
uint8_t *stripBackPointers[4];
|
||||
stripBackPointers[0] = &secondFrameBuffer[FRAMEBUFFER_START + 0];
|
||||
stripBackPointers[1] = &secondFrameBuffer[FRAMEBUFFER_START + OLED_WIDTH];
|
||||
@@ -317,7 +318,8 @@ void OLED::transitionSecondaryFramebuffer(bool forwardNavigation) {
|
||||
|
||||
refresh(); // Now refresh to write out the contents to the new page
|
||||
vTaskDelayUntil(&startDraw, TICKS_100MS / 7);
|
||||
if (getButtonState() != BUTTON_NONE) {
|
||||
buttonsReleased |= getButtonState() == BUTTON_NONE;
|
||||
if (getButtonState() != BUTTON_NONE && buttonsReleased) {
|
||||
memcpy(screenBuffer + FRAMEBUFFER_START, secondFrameBuffer + FRAMEBUFFER_START, sizeof(screenBuffer) - FRAMEBUFFER_START);
|
||||
refresh(); // Now refresh to write out the contents to the new page
|
||||
return;
|
||||
@@ -340,8 +342,9 @@ void OLED::useSecondaryFramebuffer(bool useSecondary) {
|
||||
*
|
||||
* **This function blocks until the transition has completed or user presses button**
|
||||
*/
|
||||
void OLED::transitionScrollDown() {
|
||||
TickType_t startDraw = xTaskGetTickCount();
|
||||
void OLED::transitionScrollDown(const TickType_t viewEnterTime) {
|
||||
TickType_t startDraw = xTaskGetTickCount();
|
||||
bool buttonsReleased = getButtonState() == BUTTON_NONE;
|
||||
|
||||
for (uint8_t heightPos = 0; heightPos < OLED_HEIGHT; heightPos++) {
|
||||
// For each line, we shuffle all bits up a row
|
||||
@@ -378,7 +381,8 @@ void OLED::transitionScrollDown() {
|
||||
secondFrameBuffer[secondStripPos] >>= 1;
|
||||
#endif /* OLED_128x32 */
|
||||
}
|
||||
if (getButtonState() != BUTTON_NONE) {
|
||||
buttonsReleased |= getButtonState() == BUTTON_NONE;
|
||||
if (getButtonState() != BUTTON_NONE && buttonsReleased) {
|
||||
// Exit early, but have to transition whole buffer
|
||||
memcpy(screenBuffer + FRAMEBUFFER_START, secondFrameBuffer + FRAMEBUFFER_START, sizeof(screenBuffer) - FRAMEBUFFER_START);
|
||||
refresh(); // Now refresh to write out the contents to the new page
|
||||
|
||||
@@ -46,9 +46,9 @@ extern "C" {
|
||||
#define OLED_GRAM_START_FLIP 0
|
||||
#define OLED_GRAM_END_FLIP 0x7F
|
||||
|
||||
#define OLED_VCOM_LAYOUT 0x12
|
||||
#define OLED_VCOM_LAYOUT 0x12
|
||||
#define OLED_SEGMENT_MAP_REVERSED
|
||||
#define OLED_DIVIDER 0xD3
|
||||
#define OLED_DIVIDER 0xD3
|
||||
|
||||
#else
|
||||
|
||||
@@ -59,14 +59,14 @@ extern "C" {
|
||||
#define OLED_GRAM_START_FLIP 0
|
||||
#define OLED_GRAM_END_FLIP 95
|
||||
|
||||
#define OLED_VCOM_LAYOUT 0x02
|
||||
#define OLED_SEGMENT_MAP 0xA0
|
||||
#define OLED_DIVIDER 0xD5
|
||||
#define OLED_VCOM_LAYOUT 0x02
|
||||
#define OLED_SEGMENT_MAP 0xA0
|
||||
#define OLED_DIVIDER 0xD5
|
||||
|
||||
#endif /* OLED_128x32 */
|
||||
|
||||
#define OLED_ON 0xAF
|
||||
#define OLED_OFF 0xAE
|
||||
#define OLED_ON 0xAF
|
||||
#define OLED_OFF 0xAE
|
||||
|
||||
#define FRAMEBUFFER_START 17
|
||||
|
||||
@@ -78,7 +78,10 @@ enum class FontStyle {
|
||||
|
||||
class OLED {
|
||||
public:
|
||||
enum DisplayState : bool { OFF = false, ON = true };
|
||||
enum DisplayState : bool {
|
||||
OFF = false,
|
||||
ON = true
|
||||
};
|
||||
|
||||
static void initialize(); // Startup the I2C coms (brings screen out of reset etc)
|
||||
static bool isInitDone();
|
||||
@@ -117,10 +120,10 @@ public:
|
||||
static void setInverseDisplay(bool inverted);
|
||||
static int16_t getCursorX() { return cursor_x; }
|
||||
// Draw a string to the current location, with selected font; optionally - with MAX length only
|
||||
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255);
|
||||
static void printWholeScreen(const char *string);
|
||||
static void print(const char *string, FontStyle fontStyle, uint8_t length = 255);
|
||||
static void printWholeScreen(const char *string);
|
||||
// Print *F or *C - in font style of Small, Large (by default) or Extra based on input arg
|
||||
static void printSymbolDeg(FontStyle fontStyle = FontStyle::LARGE);
|
||||
static void printSymbolDeg(FontStyle fontStyle = FontStyle::LARGE);
|
||||
// Set the cursor location by pixels
|
||||
static void setCursor(int16_t x, int16_t y) {
|
||||
cursor_x = x;
|
||||
@@ -146,9 +149,9 @@ public:
|
||||
static void drawHeatSymbol(uint8_t state);
|
||||
static void drawScrollIndicator(uint8_t p, uint8_t h); // Draws a scrolling position indicator
|
||||
static void maskScrollIndicatorOnOLED();
|
||||
static void transitionSecondaryFramebuffer(bool forwardNavigation);
|
||||
static void transitionSecondaryFramebuffer(const bool forwardNavigation, const TickType_t viewEnterTime);
|
||||
static void useSecondaryFramebuffer(bool useSecondary);
|
||||
static void transitionScrollDown();
|
||||
static void transitionScrollDown(const TickType_t viewEnterTime);
|
||||
|
||||
private:
|
||||
static bool checkDisplayBufferChecksum() {
|
||||
|
||||
@@ -116,8 +116,10 @@ OperatingMode guiHandleDraw(void) {
|
||||
newMode = handle_post_init_state();
|
||||
break;
|
||||
case OperatingMode::Hibernating:
|
||||
newMode = OperatingMode::HomeScreen;
|
||||
break;
|
||||
case OperatingMode::ThermalRunaway:
|
||||
newMode = OperatingMode::HomeScreen;
|
||||
break;
|
||||
};
|
||||
return newMode;
|
||||
@@ -142,13 +144,13 @@ void guiRenderLoop(void) {
|
||||
// Now dispatch the transition
|
||||
switch (context.transitionMode) {
|
||||
case TransitionAnimation::Down:
|
||||
OLED::transitionScrollDown();
|
||||
OLED::transitionScrollDown(context.viewEnterTime);
|
||||
break;
|
||||
case TransitionAnimation::Left:
|
||||
OLED::transitionSecondaryFramebuffer(false);
|
||||
OLED::transitionSecondaryFramebuffer(false, context.viewEnterTime);
|
||||
break;
|
||||
case TransitionAnimation::Right:
|
||||
OLED::transitionSecondaryFramebuffer(true);
|
||||
OLED::transitionSecondaryFramebuffer(true, context.viewEnterTime);
|
||||
break;
|
||||
case TransitionAnimation::None:
|
||||
default:
|
||||
|
||||
@@ -29,6 +29,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
|
||||
cxt->scratch_state.state2 = 0;
|
||||
break;
|
||||
case BUTTON_BOTH:
|
||||
/*Fall through*/
|
||||
case BUTTON_B_LONG:
|
||||
cxt->transitionMode = TransitionAnimation::Right;
|
||||
return OperatingMode::HomeScreen;
|
||||
@@ -39,13 +40,12 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
|
||||
}
|
||||
break;
|
||||
case BUTTON_F_SHORT:
|
||||
case BUTTON_B_SHORT: {
|
||||
case BUTTON_B_SHORT:
|
||||
cxt->transitionMode = TransitionAnimation::Left;
|
||||
return OperatingMode::TemperatureAdjust;
|
||||
case BUTTON_BOTH_LONG:
|
||||
if (getSettingValue(SettingsOptions::LockingMode) != 0) {
|
||||
// Lock buttons
|
||||
|
||||
if (warnUser(translatedString(Tr->LockingKeysString), buttons)) {
|
||||
cxt->scratch_state.state1 = 1;
|
||||
}
|
||||
@@ -54,7 +54,6 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return OperatingMode::Soldering;
|
||||
}
|
||||
OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
|
||||
@@ -73,36 +72,6 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
|
||||
* --> Long hold double button to toggle key lock
|
||||
*/
|
||||
|
||||
// First check for button locking & dispatch buttons
|
||||
|
||||
OperatingMode newMode = handleSolderingButtons(buttons, cxt);
|
||||
if (newMode != OperatingMode::Soldering) {
|
||||
return newMode;
|
||||
}
|
||||
// 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
|
||||
|
||||
if (shouldShutdown()) {
|
||||
// shutdown
|
||||
currentTempTargetDegC = 0;
|
||||
return OperatingMode::HomeScreen;
|
||||
}
|
||||
#endif
|
||||
if (shouldBeSleeping()) {
|
||||
return OperatingMode::Sleeping;
|
||||
}
|
||||
|
||||
if (heaterThermalRunaway) {
|
||||
currentTempTargetDegC = 0; // heater control off
|
||||
heaterThermalRunaway = false;
|
||||
return OperatingMode::ThermalRunaway;
|
||||
}
|
||||
|
||||
// Update the setpoints for the temperature
|
||||
if (cxt->scratch_state.state2) {
|
||||
if (getSettingValue(SettingsOptions::TemperatureInF)) {
|
||||
@@ -178,5 +147,30 @@ OperatingMode gui_solderingMode(const ButtonState buttons, guiContext *cxt) {
|
||||
} else {
|
||||
basicSolderingStatus(cxt->scratch_state.state2);
|
||||
}
|
||||
return OperatingMode::Soldering; // Stay put
|
||||
// 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
|
||||
|
||||
if (shouldShutdown()) {
|
||||
// shutdown
|
||||
currentTempTargetDegC = 0;
|
||||
cxt->transitionMode = TransitionAnimation::Right;
|
||||
return OperatingMode::HomeScreen;
|
||||
}
|
||||
#endif
|
||||
if (shouldBeSleeping()) {
|
||||
return OperatingMode::Sleeping;
|
||||
}
|
||||
|
||||
if (heaterThermalRunaway) {
|
||||
currentTempTargetDegC = 0; // heater control off
|
||||
heaterThermalRunaway = false;
|
||||
cxt->transitionMode = TransitionAnimation::Right;
|
||||
return OperatingMode::ThermalRunaway;
|
||||
}
|
||||
return handleSolderingButtons(buttons, cxt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user