From f0e1498e92a8e8353c13f1b29529d10a223f67b0 Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Thu, 10 Aug 2017 17:34:01 +1000 Subject: [PATCH] Fix screen blink Fixes #56 --- workspace/ts100/src/Main.c | 1 + workspace/ts100/src/Modes.c | 42 +++++++++-------------------------- workspace/ts100/src/Strings.c | 6 +++-- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/workspace/ts100/src/Main.c b/workspace/ts100/src/Main.c index 81943559..712e8266 100644 --- a/workspace/ts100/src/Main.c +++ b/workspace/ts100/src/Main.c @@ -76,6 +76,7 @@ void setup() { resetSettings(); } } + Start_Watchdog(5000); //start the system watch dog as 5 second timeout } diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index 530225b4..32ae3693 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -297,18 +297,7 @@ void ProcessUI() { //Either button was pushed operatingMode = STARTUP; } - if (systemSettings.sensitivity) { - if (millis() - getLastMovement() - > (systemSettings.ShutdownTime * 60000)) { - if ((millis() - getLastButtonPress() - > systemSettings.ShutdownTime * 60000)) { - Oled_DisplayOff(); - } - } else { - Oled_DisplayOn(); - } - } else - Oled_DisplayOn(); + } break; case UVLOWARN: @@ -430,25 +419,22 @@ void DrawUI() { static uint16_t lastSolderingDrawnTemp2 = 0; static uint8_t settingsLongTestScrollPos = 0; uint16_t temp = readIronTemp(0, 0, 0xFFFF); - if (millis() - getLastMovement() > (5 * 60 * 1000) - && (millis() - getLastButtonPress() > (5 * 60 * 1000))) { - //OLED off - Oled_DisplayOff(); - } else { - Oled_DisplayOn(); - } - switch (operatingMode) { - case STARTUP: - //We are chilling in the idle mode - //Check if movement in the last 5 minutes , if not sleep OLED + if (systemSettings.sensitivity) { if (millis() - getLastMovement() > (5 * 60 * 1000) && (millis() - getLastButtonPress() > (5 * 60 * 1000))) { //OLED off Oled_DisplayOff(); } else { Oled_DisplayOn(); - OLED_DrawIDLELogo(); //Draw the icons for prompting the user } + } + switch (operatingMode) { + case STARTUP: + //We are chilling in the idle mode + //Check if movement in the last 5 minutes , if not sleep OLED + + OLED_DrawIDLELogo(); //Draw the icons for prompting the user + break; case SOLDERING: //The user is soldering @@ -737,14 +723,6 @@ void DrawUI() { OLED_DrawString("SLP ", 4); drawTemp(temp, 4, systemSettings.temperatureRounding); - if (millis() - getLastMovement() > (10 * 60 * 1000) - && (millis() - getLastButtonPress() > (10 * 60 * 1000))) { - //OLED off - Oled_DisplayOff(); - } else { - Oled_DisplayOn(); - } - break; case COOLING: //We are warning the user the tip is cooling diff --git a/workspace/ts100/src/Strings.c b/workspace/ts100/src/Strings.c index dba5cbaf..ba5915ff 100644 --- a/workspace/ts100/src/Strings.c +++ b/workspace/ts100/src/Strings.c @@ -46,10 +46,12 @@ const char* SettingsLongNames[14] = /*These are all the help text for all the settings.*/ /*All must start with 6 spaces so they come on screen nicely.*/ " Fuente de energía. Ajusta el límite inferior de voltaje. ", - " Temperatura en reposo. ", " Tiempo hasta activar reposo. ", + " Temperatura en reposo. ", + " Tiempo hasta activar reposo. ", " Tiempo hasta apagado. ", " Sensibilidad del movimiento. <0. Apagado, 1. El menos sensible, 9. El más sensible>", - " Unidad de temperatura.", " Redondeo de la temperatura.", + " Unidad de temperatura.", + " Redondeo de la temperatura.", " Tasa de actualización de la temperatura.", " Orientación de la pantalla ", " Activar el botón \"Boost\" en modo soldadura.",