Update GUI thread to use POW_DC rather than model check

This commit is contained in:
Ben V. Brown
2020-11-01 14:45:10 +11:00
parent f5644a090f
commit 57b2505ad6

View File

@@ -88,15 +88,18 @@ void gui_drawTipTemp(bool symbol) {
} }
} }
#ifdef MODEL_TS100 #ifdef POW_DC
// returns true if undervoltage has occured // returns true if undervoltage has occured
static bool checkVoltageForExit() { static bool checkVoltageForExit() {
if (!getIsPoweredByDCIN()) {
return false;
}
uint16_t v = getInputVoltageX10(systemSettings.voltageDiv, 0); uint16_t v = getInputVoltageX10(systemSettings.voltageDiv, 0);
// Dont check for first 1.5 seconds while the ADC stabilizes and the DMA fills the buffer // Dont check for first 2 seconds while the ADC stabilizes and the DMA fills the buffer
if (xTaskGetTickCount() > 150) { if (xTaskGetTickCount() > (TICKS_SECOND * 2)) {
if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) { if ((v < lookupVoltageLevel())) {
GUIDelay(); currentTempTargetDegC = 0;
OLED::clearScreen(); OLED::clearScreen();
OLED::setCursor(0, 0); OLED::setCursor(0, 0);
if (systemSettings.detailedSoldering) { if (systemSettings.detailedSoldering) {
@@ -106,14 +109,13 @@ static bool checkVoltageForExit() {
OLED::print(InputVoltageString); OLED::print(InputVoltageString);
printVoltage(); printVoltage();
OLED::print(SymbolVolts); OLED::print(SymbolVolts);
} else { } else {
OLED::setFont(0); OLED::setFont(0);
OLED::print(UVLOWarningString); OLED::print(UVLOWarningString);
} }
OLED::refresh(); OLED::refresh();
currentTempTargetDegC = 0; GUIDelay();
waitForButtonPress(); waitForButtonPress();
return true; return true;
} }
@@ -466,7 +468,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
if (systemSettings.BoostTemp && (systemSettings.lockingMode == 1)) { if (systemSettings.BoostTemp && (systemSettings.lockingMode == 1)) {
boostModeOn = true; boostModeOn = true;
break; break;
}; }
;
// fall through // fall through
case BUTTON_BOTH: case BUTTON_BOTH:
case BUTTON_B_LONG: case BUTTON_B_LONG:
@@ -485,44 +488,44 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
} }
} else { // Button not locked } else { // Button not locked
switch (buttons) { switch (buttons) {
case BUTTON_NONE: case BUTTON_NONE:
// stay // stay
boostModeOn = false; boostModeOn = false;
break; break;
case BUTTON_BOTH: case BUTTON_BOTH:
// exit // exit
return; return;
break; break;
case BUTTON_B_LONG: case BUTTON_B_LONG:
return; // exit on back long hold return; // exit on back long hold
break; break;
case BUTTON_F_LONG: case BUTTON_F_LONG:
// if boost mode is enabled turn it on // if boost mode is enabled turn it on
if (systemSettings.BoostTemp) if (systemSettings.BoostTemp)
boostModeOn = true; boostModeOn = true;
break; break;
case BUTTON_F_SHORT: case BUTTON_F_SHORT:
case BUTTON_B_SHORT: { case BUTTON_B_SHORT: {
uint16_t oldTemp = systemSettings.SolderingTemp; uint16_t oldTemp = systemSettings.SolderingTemp;
gui_solderingTempAdjust(); // goto adjust temp mode gui_solderingTempAdjust(); // goto adjust temp mode
if (oldTemp != systemSettings.SolderingTemp) { if (oldTemp != systemSettings.SolderingTemp) {
saveSettings(); // only save on change saveSettings(); // only save on change
} }
}
break;
case BUTTON_BOTH_LONG:
if (systemSettings.lockingMode != 0) {
// Lock buttons
buttonsLocked = true;
OLED::setCursor(0, 0);
OLED::clearScreen();
OLED::setFont(0);
OLED::print(LockingKeysString);
OLED::refresh();
waitForButtonPressOrTimeout(1000);
} }
break; break;
case BUTTON_BOTH_LONG: default:
if (systemSettings.lockingMode != 0) {
// Lock buttons
buttonsLocked = true;
OLED::setCursor(0, 0);
OLED::clearScreen();
OLED::setFont(0);
OLED::print(LockingKeysString);
OLED::refresh();
waitForButtonPressOrTimeout(1000);
}
break;
default:
break; break;
} }
} }
@@ -607,7 +610,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
} }
} }
#ifdef MODEL_TS100 #ifdef POW_DC
// Undervoltage test // Undervoltage test
if (checkVoltageForExit()) { if (checkVoltageForExit()) {
lastButtonTime = xTaskGetTickCount(); lastButtonTime = xTaskGetTickCount();