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
static bool checkVoltageForExit() {
if (!getIsPoweredByDCIN()) {
return false;
}
uint16_t v = getInputVoltageX10(systemSettings.voltageDiv, 0);
// Dont check for first 1.5 seconds while the ADC stabilizes and the DMA fills the buffer
if (xTaskGetTickCount() > 150) {
if ((v < lookupVoltageLevel(systemSettings.cutoutSetting))) {
GUIDelay();
// Dont check for first 2 seconds while the ADC stabilizes and the DMA fills the buffer
if (xTaskGetTickCount() > (TICKS_SECOND * 2)) {
if ((v < lookupVoltageLevel())) {
currentTempTargetDegC = 0;
OLED::clearScreen();
OLED::setCursor(0, 0);
if (systemSettings.detailedSoldering) {
@@ -106,14 +109,13 @@ static bool checkVoltageForExit() {
OLED::print(InputVoltageString);
printVoltage();
OLED::print(SymbolVolts);
} else {
OLED::setFont(0);
OLED::print(UVLOWarningString);
}
OLED::refresh();
currentTempTargetDegC = 0;
GUIDelay();
waitForButtonPress();
return true;
}
@@ -466,7 +468,8 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
if (systemSettings.BoostTemp && (systemSettings.lockingMode == 1)) {
boostModeOn = true;
break;
};
}
;
// fall through
case BUTTON_BOTH:
case BUTTON_B_LONG:
@@ -607,7 +610,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) {
}
}
#ifdef MODEL_TS100
#ifdef POW_DC
// Undervoltage test
if (checkVoltageForExit()) {
lastButtonTime = xTaskGetTickCount();