aboutsummaryrefslogtreecommitdiffhomepage
path: root/workspace
diff options
context:
space:
mode:
Diffstat (limited to 'workspace')
-rw-r--r--workspace/ts100/inc/Modes.h1
-rw-r--r--workspace/ts100/inc/Settings.h7
-rw-r--r--workspace/ts100/src/Main.c2
-rw-r--r--workspace/ts100/src/Modes.c34
-rw-r--r--workspace/ts100/src/Settings.c1
5 files changed, 40 insertions, 5 deletions
diff --git a/workspace/ts100/inc/Modes.h b/workspace/ts100/inc/Modes.h
index 1503c54f..63478c7b 100644
--- a/workspace/ts100/inc/Modes.h
+++ b/workspace/ts100/inc/Modes.h
@@ -34,6 +34,7 @@ enum {
UVCO = 0,
SLEEP_TEMP,
SLEEP_TIME,
+ SHUTDOWN_TIME,
MOTIONDETECT,
MOTIONSENSITIVITY,
TEMPDISPLAY,
diff --git a/workspace/ts100/inc/Settings.h b/workspace/ts100/inc/Settings.h
index 16500bc8..53cf1eea 100644
--- a/workspace/ts100/inc/Settings.h
+++ b/workspace/ts100/inc/Settings.h
@@ -11,7 +11,7 @@
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f10x_flash.h"
-#define SETTINGSVERSION 0x04 /*Change this if you change the struct below to prevent people getting out of sync*/
+#define SETTINGSVERSION 0x05 /*Change this if you change the struct below to prevent people getting out of sync*/
#define SETTINGSOPTIONSCOUNT 6 /*Number of settings in the settings menu*/
#define MOTION_HIGH (0x00)
#define MOTION_MED (0x10)
@@ -20,15 +20,16 @@
* This struct must be a multiple of 2 bytes as it is saved / restored from flash in uint16_t chunks
*/
struct {
- uint32_t SolderingTemp; //current setpoint for the iron
+ uint32_t SolderingTemp; //current set point for the iron
uint32_t SleepTemp; //temp to drop to in sleep
uint8_t version; //Used to track if a reset is needed on firmware upgrade
uint8_t SleepTime; //minutes timeout to sleep
- uint8_t cutoutVoltage:5; //The voltage we cutout at for undervoltage
+ uint8_t cutoutVoltage:5; //The voltage we cut out at for under voltage
uint8_t movementEnabled:1; //If movement is enabled
uint8_t displayTempInF:1; //If we need to convert the C reading to F
uint8_t flipDisplay:1; //If true we want to invert the display for lefties
uint8_t sensitivity:7; //Sensitivity of accelerometer
+ uint8_t ShutdownTime:7; //Time until unit shuts down if left alone
uint16_t tempCalibration; //Temperature calibration value
uint16_t voltageDiv; //Voltage divisor factor
} systemSettings;
diff --git a/workspace/ts100/src/Main.c b/workspace/ts100/src/Main.c
index 1768e0c5..39336017 100644
--- a/workspace/ts100/src/Main.c
+++ b/workspace/ts100/src/Main.c
@@ -37,7 +37,7 @@ void setup() {
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
Init_Oled(systemSettings.flipDisplay); //Init the OLED display
- OLED_DrawString("VER 1.06", 8); //
+ OLED_DrawString("VER 1.07", 8); //
delayMs(800); //Pause to show version number
Start_Watchdog(1000); //start the system watch dog as 1 second timeout
}
diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c
index db1c64f2..429423a7 100644
--- a/workspace/ts100/src/Modes.c
+++ b/workspace/ts100/src/Modes.c
@@ -116,6 +116,11 @@ void ProcessUI() {
systemSettings.SleepTime = 1; //cant set time over 30 mins
//Remember that ^ is the time of no movement
break;
+ case SHUTDOWN_TIME:
+ ++systemSettings.ShutdownTime;
+ if (systemSettings.ShutdownTime > 60)
+ systemSettings.ShutdownTime = 0; //wrap to off
+ break;
case MOTIONDETECT:
systemSettings.movementEnabled =
!systemSettings.movementEnabled;
@@ -142,16 +147,29 @@ void ProcessUI() {
if (Buttons & BUT_A) {
//A Button was pressed so we are moving back to soldering
operatingMode = SOLDERING;
+ Oled_DisplayOn();
return;
} else if (Buttons & BUT_B) {
//B Button was pressed so we are moving back to soldering
operatingMode = SOLDERING;
+ Oled_DisplayOn();
return;
} else if (systemSettings.movementEnabled)
if (millis() - getLastMovement() < 1000) {//moved in the last second
operatingMode = SOLDERING; //Goto active mode again
+ Oled_DisplayOn();
return;
}
+ if (systemSettings.movementEnabled) {
+ //Check if we should shutdown
+ if ((millis() - getLastMovement()
+ > (systemSettings.ShutdownTime * 60000))
+ || (millis() - getLastButtonPress()
+ > systemSettings.ShutdownTime * 60000)) {
+ operatingMode = COOLING; //shutdown the tip
+ Oled_DisplayOn();
+ }
+ }
//else if nothing has been pushed we need to compute the PID to keep the iron at the sleep temp
int32_t newOutput = computePID(systemSettings.SleepTemp);
setIronTimer(newOutput);
@@ -333,9 +351,13 @@ void DrawUI() {
OLED_DrawThreeNumber(systemSettings.SleepTemp / 10, 5);
break;
case SLEEP_TIME:
- OLED_DrawString("STIME ", 6);
+ OLED_DrawString("SLTME ", 6);
OLED_DrawTwoNumber(systemSettings.SleepTime, 6);
break;
+ case SHUTDOWN_TIME:
+ OLED_DrawString("SHTME ", 6);
+ OLED_DrawTwoNumber(systemSettings.ShutdownTime, 6);
+ break;
case MOTIONDETECT:/*Toggle the mode*/
if (systemSettings.movementEnabled)
OLED_DrawString("MOTION T", 8);
@@ -373,6 +395,7 @@ void DrawUI() {
}
break;
+
default:
break;
}
@@ -382,6 +405,15 @@ void DrawUI() {
//Draw in temp and sleep
OLED_DrawString("SLP", 3);
drawTemp(temp, 4);
+
+ 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/Settings.c b/workspace/ts100/src/Settings.c
index 174c9968..e24601da 100644
--- a/workspace/ts100/src/Settings.c
+++ b/workspace/ts100/src/Settings.c
@@ -52,5 +52,6 @@ void resetSettings() {
systemSettings.sensitivity=0x00; //Default high sensitivity
systemSettings.tempCalibration=239; //Default to their calibration value
systemSettings.voltageDiv=144; //Default divider from schematic
+ systemSettings.ShutdownTime=30;
}