Sleep mode bugfix and better display

This commit is contained in:
Ben V. Brown
2016-09-29 13:39:46 +10:00
parent bbb758fd4c
commit 5a581b7a9f

View File

@@ -48,15 +48,14 @@ void ProcessUI() {
//We need to check the timer for movement in case we need to goto idle //We need to check the timer for movement in case we need to goto idle
if (systemSettings.movementEnabled) if (systemSettings.movementEnabled)
if (millis() - getLastMovement() if (millis() - getLastMovement()
> (systemSettings.SleepTime * 60000)) { > (systemSettings.SleepTime * 10000)) {
operatingMode = SLEEP; //Goto Sleep Mode
return;
}
if (millis() - getLastButtonPress() if (millis() - getLastButtonPress()
> (systemSettings.SleepTime * 60000)) { > (systemSettings.SleepTime * 10000)) {
operatingMode = SLEEP; operatingMode = SLEEP;
return; return;
} }
}
//If no buttons pushed we need to perform the PID loop for the iron temp //If no buttons pushed we need to perform the PID loop for the iron temp
int32_t newOutput = computePID(systemSettings.SolderingTemp); int32_t newOutput = computePID(systemSettings.SolderingTemp);
if (newOutput >= 0) { if (newOutput >= 0) {
@@ -141,7 +140,7 @@ void ProcessUI() {
resetButtons(); resetButtons();
return; return;
} else if (systemSettings.movementEnabled) } else if (systemSettings.movementEnabled)
if (millis() - getLastMovement() > 100) { if (millis() - getLastMovement() < 1000) {//moved in the last second
operatingMode = SOLDERING; //Goto active mode again operatingMode = SOLDERING; //Goto active mode again
return; return;
} }
@@ -185,7 +184,7 @@ void DrawUI() {
} }
OLED_DrawThreeNumber(temp / 10, 0); OLED_DrawThreeNumber(temp / 10, 0);
OLED_DrawChar('C', 14 * 3); OLED_DrawChar(' ', 14 * 3);
OLED_DrawChar(' ', 14 * 5); OLED_DrawChar(' ', 14 * 5);
OLED_DrawChar(' ', 14 * 6); OLED_DrawChar(' ', 14 * 6);
@@ -227,7 +226,10 @@ void DrawUI() {
case SLEEP: case SLEEP:
//The iron is in sleep temp mode //The iron is in sleep temp mode
//Draw in temp and sleep //Draw in temp and sleep
OLED_DrawString("SLEP ", 6); OLED_DrawString("SLP", 3);
uint16_t temp = readIronTemp(0, 0);
OLED_DrawThreeNumber(temp / 10, 14 * 3);
break; break;
default: default:
break; break;