Starting GUI render refactor to be more immediate mode
Update TemperatureAdjust.cpp . Cleanup Soldering Sleep SolderingProfiles Soldering Rework Rough pass GUI Temp Adjust Cleanup old OperatingMode Debug Menu
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
#ifndef OPERATING_MODE_UTILITIES_H_
|
||||
#define OPERATING_MODE_UTILITIES_H_
|
||||
#include "Buttons.hpp"
|
||||
#include "OLED.hpp"
|
||||
#include <stdbool.h>
|
||||
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
bool shouldBeSleeping(bool inAutoStart); //
|
||||
bool shouldShutdown(void); //
|
||||
void gui_drawTipTemp(bool symbol, const FontStyle font); //
|
||||
void printVoltage(void); //
|
||||
void warnUser(const char *warning, const TickType_t timeout); //
|
||||
void gui_drawBatteryIcon(void); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint16_t min(uint16_t a, uint16_t b); //
|
||||
void printCountdownUntilSleep(int sleepThres); //
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
bool shouldBeSleeping(); //
|
||||
bool shouldShutdown(void); //
|
||||
void gui_drawTipTemp(bool symbol, const FontStyle font); //
|
||||
void printVoltage(void); //
|
||||
bool warnUser(const char *warning, const ButtonState buttons); //
|
||||
void gui_drawBatteryIcon(void); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint16_t min(uint16_t a, uint16_t b); //
|
||||
void printCountdownUntilSleep(int sleepThres); //
|
||||
#endif
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "Buttons.hpp"
|
||||
#include "OperatingModeUtilities.h"
|
||||
void warnUser(const char *warning, const TickType_t timeout) {
|
||||
#include "OperatingModes.h"
|
||||
bool warnUser(const char *warning, const ButtonState buttons) {
|
||||
OLED::clearScreen();
|
||||
OLED::printWholeScreen(warning);
|
||||
OLED::refresh();
|
||||
waitForButtonPressOrTimeout(timeout);
|
||||
// TODO also timeout
|
||||
return buttons != BUTTON_NONE;
|
||||
}
|
||||
|
||||
@@ -106,30 +106,8 @@ bool checkExitSoldering(void) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef NO_SLEEP_MODE
|
||||
// No sleep mode, but still want shutdown timeout
|
||||
|
||||
if (shouldShutdown()) {
|
||||
// shutdown
|
||||
currentTempTargetDegC = 0;
|
||||
lastMovementTime = xTaskGetTickCount(); // We manually move the movement time to now such that shutdown timer is reset
|
||||
|
||||
return true; // we want to exit soldering mode
|
||||
}
|
||||
#endif
|
||||
if (shouldBeSleeping(false)) {
|
||||
if (gui_SolderingSleepingMode(false, false)) {
|
||||
return true; // If the function returns non-0 then exit
|
||||
}
|
||||
}
|
||||
|
||||
// If we have tripped thermal runaway, turn off heater and show warning
|
||||
if (heaterThermalRunaway) {
|
||||
currentTempTargetDegC = 0; // heater control off
|
||||
warnUser(translatedString(Tr->WarningThermalRunaway), 10 * TICKS_SECOND);
|
||||
heaterThermalRunaway = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
TickType_t lastHallEffectSleepStart = 0;
|
||||
extern TickType_t lastMovementTime;
|
||||
|
||||
bool shouldBeSleeping(bool inAutoStart) {
|
||||
bool shouldBeSleeping() {
|
||||
#ifndef NO_SLEEP_MODE
|
||||
// Return true if the iron should be in sleep mode
|
||||
if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) {
|
||||
if (inAutoStart) {
|
||||
// In auto start we are asleep until movement
|
||||
if (lastMovementTime == 0 && lastButtonTime == 0) {
|
||||
return true;
|
||||
}
|
||||
// In auto start we are asleep until movement
|
||||
if (lastMovementTime == 0 && lastButtonTime == 0) {
|
||||
return true;
|
||||
}
|
||||
if (lastMovementTime > 0 || lastButtonTime > 0) {
|
||||
if (((xTaskGetTickCount() - lastMovementTime) > getSleepTimeout()) && ((xTaskGetTickCount() - lastButtonTime) > getSleepTimeout())) {
|
||||
|
||||
Reference in New Issue
Block a user