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:
@@ -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();