diff options
-rw-r--r-- | workspace/ts100/inc/Modes.h | 1 | ||||
-rw-r--r-- | workspace/ts100/inc/Settings.h | 9 | ||||
-rw-r--r-- | workspace/ts100/src/MMA8652FC.c | 5 | ||||
-rw-r--r-- | workspace/ts100/src/Main.c | 2 | ||||
-rw-r--r-- | workspace/ts100/src/Modes.c | 37 | ||||
-rw-r--r-- | workspace/ts100/src/Settings.c | 1 |
6 files changed, 19 insertions, 36 deletions
diff --git a/workspace/ts100/inc/Modes.h b/workspace/ts100/inc/Modes.h index 7721dd8a..106a757b 100644 --- a/workspace/ts100/inc/Modes.h +++ b/workspace/ts100/inc/Modes.h @@ -36,7 +36,6 @@ enum { SLEEP_TEMP, SLEEP_TIME, SHUTDOWN_TIME, - MOTIONDETECT, MOTIONSENSITIVITY, TEMPDISPLAY, TEMPROUNDING, diff --git a/workspace/ts100/inc/Settings.h b/workspace/ts100/inc/Settings.h index dbc614f1..cbbbed96 100644 --- a/workspace/ts100/inc/Settings.h +++ b/workspace/ts100/inc/Settings.h @@ -11,11 +11,7 @@ #define SETTINGS_H_ #include <stdint.h> #include "stm32f10x_flash.h" -#define SETTINGSVERSION 11 /*Change this if you change the struct below to prevent people getting out of sync*/ -//Motion Sensitivity -#define MOTION_HIGH (0x00) -#define MOTION_MED (0x01) -#define MOTION_LOW (0x02) +#define SETTINGSVERSION 12 /*Change this if you change the struct below to prevent people getting out of sync*/ //Display Speeds #define DISPLAYMODE_FAST (0x00) #define DISPLAYMODE_MEDIUM (0x01) @@ -34,10 +30,9 @@ struct { 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 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:5; //Sensitivity of accelerometer (4 bits) + uint8_t sensitivity:6; //Sensitivity of accelerometer (5 bits) uint8_t ShutdownTime:6; //Time until unit shuts down if left alone uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode uint8_t temperatureRounding:2; //Rounding mode for the temperature diff --git a/workspace/ts100/src/MMA8652FC.c b/workspace/ts100/src/MMA8652FC.c index df73a53c..98a55e20 100644 --- a/workspace/ts100/src/MMA8652FC.c +++ b/workspace/ts100/src/MMA8652FC.c @@ -34,8 +34,9 @@ void StartUp_Accelerometer(uint8_t sensitivity) { I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
delayMs(2); // ~1ms delay
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
- uint8_t sens = 0x3F;
- sens -= 0x08 * sensitivity;
+ uint8_t sens = 9*7+1;
+ sens -= 7 * sensitivity;
+
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
diff --git a/workspace/ts100/src/Main.c b/workspace/ts100/src/Main.c index cec1b157..3b159d7e 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.11", 8); //Version Number
+ OLED_DrawString("VER 1.12", 8); //Version Number
delayMs(500); //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 4efac5a1..87e22cee 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -7,15 +7,15 @@ #include "Modes.h" const char *SettingsLongNames[] = { " Undervoltage Cutout <V>", " Sleep Temperature <C>", " Sleep Timeout <Minutes>", - " Shutdown Timeout <Minutes>", " Motion Detection", - " Motion Sensitivity <1.least sensitive 8.most sensitive>", + " Shutdown Timeout <Minutes>", + " Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>", " Temperature Unit", " Temperature Rounding Amount", " Temperature Display Update Rate", " Flip Display for Left Hand", " Enable front key boost 450C mode when soldering", " Temperature when in boost mode" }; -const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 22, 61, 22, 33, 37, - 32, 53, 36 }; +const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 67, 22, 33, 37, 32, + 53, 36 }; uint8_t StatusFlags = 0; uint32_t temporaryTempStorage = 0; //This does the required processing and state changes @@ -84,7 +84,7 @@ void ProcessUI() { StatusFlags = 0; } //We need to check the timer for movement in case we need to goto idle - if (systemSettings.movementEnabled) + if (systemSettings.sensitivity) if (millis() - getLastMovement() > (systemSettings.SleepTime * 60000)) { if (millis() - getLastButtonPress() @@ -166,10 +166,6 @@ void ProcessUI() { if (systemSettings.ShutdownTime > 60) systemSettings.ShutdownTime = 0; //wrap to off break; - case MOTIONDETECT: - systemSettings.movementEnabled = - !systemSettings.movementEnabled; - break; case TEMPDISPLAY: systemSettings.displayTempInF = !systemSettings.displayTempInF; @@ -179,7 +175,8 @@ void ProcessUI() { break; case MOTIONSENSITIVITY: systemSettings.sensitivity++; - systemSettings.sensitivity = systemSettings.sensitivity % 8; + systemSettings.sensitivity = systemSettings.sensitivity + % 10; break; case TEMPROUNDING: @@ -219,14 +216,14 @@ void ProcessUI() { operatingMode = SOLDERING; Oled_DisplayOn(); return; - } else if (systemSettings.movementEnabled) { + } else if (systemSettings.sensitivity) { if (millis() - getLastMovement() < 1000) {//moved in the last second operatingMode = SOLDERING; //Goto active mode again Oled_DisplayOn(); return; } } - if (systemSettings.movementEnabled) { + if (systemSettings.sensitivity) { //Check if we should shutdown if ((millis() - getLastMovement() > (systemSettings.ShutdownTime * 60000)) @@ -247,7 +244,7 @@ void ProcessUI() { //Either button was pushed operatingMode = STARTUP; } - if (systemSettings.movementEnabled) { + if (systemSettings.sensitivity) { if (millis() - getLastMovement() > (systemSettings.ShutdownTime * 60000)) { if ((millis() - getLastButtonPress() @@ -257,8 +254,7 @@ void ProcessUI() { } else { Oled_DisplayOn(); } - } - else + } else Oled_DisplayOn(); } break; @@ -495,19 +491,12 @@ void DrawUI() { OLED_DrawString("SHTME ", 6); OLED_DrawTwoNumber(systemSettings.ShutdownTime, 6); break; - case MOTIONDETECT:/*Toggle the mode*/ - if (systemSettings.movementEnabled) - OLED_DrawString("MOTION T", 8); - else - OLED_DrawString("MOTION F", 8); - break; case TEMPDISPLAY:/*Are we showing in C or F ?*/ if (systemSettings.displayTempInF) OLED_DrawString("TMPUNT F", 8); else OLED_DrawString("TMPUNT C", 8); break; - case LEFTY: if (systemSettings.flipDisplay) @@ -517,7 +506,7 @@ void DrawUI() { break; case MOTIONSENSITIVITY: OLED_DrawString("MSENSE ", 7); - OLED_DrawChar('1' + systemSettings.sensitivity, 7); + OLED_DrawChar('0' + systemSettings.sensitivity, 7); break; case TEMPROUNDING: //We are prompting the user about their display mode preferences @@ -593,7 +582,7 @@ void DrawUI() { case COOLING: //We are warning the user the tip is cooling OLED_DrawString("COOL ", 5); - temp = readIronTemp(0, 1, 0xFFFF);//force temp re-reading + temp = readIronTemp(0, 1, 0xFFFF); //force temp re-reading drawTemp(temp, 5, systemSettings.temperatureRounding); break; case UVLOWARN: diff --git a/workspace/ts100/src/Settings.c b/workspace/ts100/src/Settings.c index b59e89e7..40fd4d46 100644 --- a/workspace/ts100/src/Settings.c +++ b/workspace/ts100/src/Settings.c @@ -44,7 +44,6 @@ void resetSettings() { systemSettings.SleepTemp = 1500; //Temperature the iron sleeps at - default 150.0 C systemSettings.SleepTime = 1; //How many minutes we wait until going to sleep - default 1 min systemSettings.SolderingTemp = 3200; //Default soldering temp is 320.0 C - systemSettings.movementEnabled = 1; //we use movement detection by default systemSettings.cutoutVoltage = 10; //10V is the minium cutout voltage as the unit V measurement is unstable below 9.5V systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades systemSettings.displayTempInF =0; //default to C |