mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Merge branch 'dev' into dev
This commit is contained in:
@@ -66,6 +66,7 @@ struct guiContext {
|
||||
uint32_t state4; // 32 bit state scratch
|
||||
uint16_t state5; // 16 bit state scratch
|
||||
uint16_t state6; // 16 bit state scratch
|
||||
uint32_t state7; // 32 bit state scratch
|
||||
|
||||
} scratch_state;
|
||||
};
|
||||
|
||||
@@ -9,26 +9,39 @@
|
||||
OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) {
|
||||
if (cxt->scratch_state.state1 >= 2) {
|
||||
// Buttons are currently locked
|
||||
switch (buttons) {
|
||||
case BUTTON_F_LONG:
|
||||
if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) {
|
||||
cxt->scratch_state.state2 = 1;
|
||||
}
|
||||
break;
|
||||
case BUTTON_BOTH_LONG:
|
||||
if (buttons == BUTTON_BOTH_LONG) {
|
||||
if (cxt->scratch_state.state1 == 3) {
|
||||
// Unlocking
|
||||
if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) {
|
||||
cxt->scratch_state.state1 = 1;
|
||||
cxt->scratch_state.state7 = 0;
|
||||
}
|
||||
} else {
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
warnUser(translatedString(Tr->LockingKeysString), buttons);
|
||||
}
|
||||
break;
|
||||
return OperatingMode::Soldering;
|
||||
}
|
||||
if (cxt->scratch_state.state7 != 0) {
|
||||
// show locked until timer is up
|
||||
if (xTaskGetTickCount() >= cxt->scratch_state.state7) {
|
||||
cxt->scratch_state.state7 = 0;
|
||||
} else {
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
return OperatingMode::Soldering;
|
||||
}
|
||||
}
|
||||
switch (buttons) {
|
||||
case BUTTON_NONE:
|
||||
cxt->scratch_state.state1 = 3;
|
||||
break;
|
||||
default: // Do nothing and display a lock warning
|
||||
case BUTTON_F_LONG:
|
||||
if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) {
|
||||
cxt->scratch_state.state2 = 1;
|
||||
break;
|
||||
}
|
||||
/*Fall through*/
|
||||
default: // Set timer for and display a lock warning
|
||||
cxt->scratch_state.state7 = xTaskGetTickCount() + TICKS_SECOND;
|
||||
warnUser(translatedString(Tr->WarningKeysLockedString), buttons);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
void GUIDelay(); //
|
||||
bool checkForUnderVoltage(void); //
|
||||
uint32_t getSleepTimeout(void); //
|
||||
uint32_t getHallEffectSleepTimeout(void); //
|
||||
bool shouldBeSleeping(); //
|
||||
bool shouldShutdown(void); //
|
||||
void printVoltage(void); //
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
|
||||
#ifndef NO_SLEEP_MODE
|
||||
#ifdef HALL_SENSOR
|
||||
uint32_t getHallEffectSleepTimeout(void) {
|
||||
if (getSettingValue(SettingsOptions::HallEffectSensitivity) && getSettingValue(SettingsOptions::HallEffectSleepTime)) {
|
||||
uint32_t sleepThres = getSettingValue(SettingsOptions::HallEffectSleepTime) * 5 * TICKS_SECOND;
|
||||
return sleepThres;
|
||||
}
|
||||
return TICKS_SECOND;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -32,7 +32,7 @@ bool shouldBeSleeping() {
|
||||
if (lastHallEffectSleepStart == 0) {
|
||||
lastHallEffectSleepStart = xTaskGetTickCount();
|
||||
}
|
||||
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > TICKS_SECOND) {
|
||||
if ((xTaskGetTickCount() - lastHallEffectSleepStart) > getHallEffectSleepTimeout()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user