Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b793b61bb6 |
@@ -36,7 +36,6 @@ enum {
|
|||||||
SLEEP_TEMP,
|
SLEEP_TEMP,
|
||||||
SLEEP_TIME,
|
SLEEP_TIME,
|
||||||
SHUTDOWN_TIME,
|
SHUTDOWN_TIME,
|
||||||
MOTIONDETECT,
|
|
||||||
MOTIONSENSITIVITY,
|
MOTIONSENSITIVITY,
|
||||||
TEMPDISPLAY,
|
TEMPDISPLAY,
|
||||||
TEMPROUNDING,
|
TEMPROUNDING,
|
||||||
|
|||||||
@@ -11,11 +11,7 @@
|
|||||||
#define SETTINGS_H_
|
#define SETTINGS_H_
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "stm32f10x_flash.h"
|
#include "stm32f10x_flash.h"
|
||||||
#define SETTINGSVERSION 11 /*Change this if you change the struct below to prevent people getting out of sync*/
|
#define SETTINGSVERSION 12 /*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)
|
|
||||||
//Display Speeds
|
//Display Speeds
|
||||||
#define DISPLAYMODE_FAST (0x00)
|
#define DISPLAYMODE_FAST (0x00)
|
||||||
#define DISPLAYMODE_MEDIUM (0x01)
|
#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 version; //Used to track if a reset is needed on firmware upgrade
|
||||||
uint8_t SleepTime; //minutes timeout to sleep
|
uint8_t SleepTime; //minutes timeout to sleep
|
||||||
uint8_t cutoutVoltage:5; //The voltage we cut out at for under voltage
|
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 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 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 ShutdownTime:6; //Time until unit shuts down if left alone
|
||||||
uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode
|
uint8_t displayUpdateSpeed:2; //How fast the display updates / temp showing mode
|
||||||
uint8_t temperatureRounding:2; //Rounding mode for the temperature
|
uint8_t temperatureRounding:2; //Rounding mode for the temperature
|
||||||
|
|||||||
@@ -34,8 +34,9 @@ void StartUp_Accelerometer(uint8_t sensitivity) {
|
|||||||
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
I2C_RegisterWrite( CTRL_REG2, 0x40); // Reset all registers to POR values
|
||||||
delayMs(2); // ~1ms delay
|
delayMs(2); // ~1ms delay
|
||||||
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
I2C_RegisterWrite(FF_MT_CFG_REG, 0x78); // Enable motion detection for X and Y axis, latch enabled
|
||||||
uint8_t sens = 0x3F;
|
uint8_t sens = 9*7+1;
|
||||||
sens -= 0x08 * sensitivity;
|
sens -= 7 * sensitivity;
|
||||||
|
|
||||||
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold
|
I2C_RegisterWrite(FF_MT_THS_REG, sens); // Set threshold
|
||||||
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
|
I2C_RegisterWrite(FF_MT_COUNT_REG, 0x01); // Set debounce to 100ms
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ void setup() {
|
|||||||
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
|
readIronTemp(systemSettings.tempCalibration, 0,0); //load the default calibration value
|
||||||
Init_Oled(systemSettings.flipDisplay); //Init the OLED display
|
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
|
delayMs(500); //Pause to show version number
|
||||||
Start_Watchdog(1000); //start the system watch dog as 1 second timeout
|
Start_Watchdog(1000); //start the system watch dog as 1 second timeout
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,15 +7,15 @@
|
|||||||
#include "Modes.h"
|
#include "Modes.h"
|
||||||
const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
const char *SettingsLongNames[] = { " Undervoltage Cutout <V>",
|
||||||
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
" Sleep Temperature <C>", " Sleep Timeout <Minutes>",
|
||||||
" Shutdown Timeout <Minutes>", " Motion Detection",
|
" Shutdown Timeout <Minutes>",
|
||||||
" Motion Sensitivity <1.least sensitive 8.most sensitive>",
|
" Motion Sensitivity <0.Off 1.least sensitive 9.most sensitive>",
|
||||||
" Temperature Unit", " Temperature Rounding Amount",
|
" Temperature Unit", " Temperature Rounding Amount",
|
||||||
" Temperature Display Update Rate",
|
" Temperature Display Update Rate",
|
||||||
" Flip Display for Left Hand",
|
" Flip Display for Left Hand",
|
||||||
" Enable front key boost 450C mode when soldering",
|
" Enable front key boost 450C mode when soldering",
|
||||||
" Temperature when in boost mode" };
|
" Temperature when in boost mode" };
|
||||||
const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 22, 61, 22, 33, 37,
|
const uint8_t SettingsLongNamesLengths[] = { 29, 27, 29, 32, 67, 22, 33, 37, 32,
|
||||||
32, 53, 36 };
|
53, 36 };
|
||||||
uint8_t StatusFlags = 0;
|
uint8_t StatusFlags = 0;
|
||||||
uint32_t temporaryTempStorage = 0;
|
uint32_t temporaryTempStorage = 0;
|
||||||
//This does the required processing and state changes
|
//This does the required processing and state changes
|
||||||
@@ -84,7 +84,7 @@ void ProcessUI() {
|
|||||||
StatusFlags = 0;
|
StatusFlags = 0;
|
||||||
}
|
}
|
||||||
//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.sensitivity)
|
||||||
if (millis() - getLastMovement()
|
if (millis() - getLastMovement()
|
||||||
> (systemSettings.SleepTime * 60000)) {
|
> (systemSettings.SleepTime * 60000)) {
|
||||||
if (millis() - getLastButtonPress()
|
if (millis() - getLastButtonPress()
|
||||||
@@ -166,10 +166,6 @@ void ProcessUI() {
|
|||||||
if (systemSettings.ShutdownTime > 60)
|
if (systemSettings.ShutdownTime > 60)
|
||||||
systemSettings.ShutdownTime = 0; //wrap to off
|
systemSettings.ShutdownTime = 0; //wrap to off
|
||||||
break;
|
break;
|
||||||
case MOTIONDETECT:
|
|
||||||
systemSettings.movementEnabled =
|
|
||||||
!systemSettings.movementEnabled;
|
|
||||||
break;
|
|
||||||
case TEMPDISPLAY:
|
case TEMPDISPLAY:
|
||||||
systemSettings.displayTempInF =
|
systemSettings.displayTempInF =
|
||||||
!systemSettings.displayTempInF;
|
!systemSettings.displayTempInF;
|
||||||
@@ -179,7 +175,8 @@ void ProcessUI() {
|
|||||||
break;
|
break;
|
||||||
case MOTIONSENSITIVITY:
|
case MOTIONSENSITIVITY:
|
||||||
systemSettings.sensitivity++;
|
systemSettings.sensitivity++;
|
||||||
systemSettings.sensitivity = systemSettings.sensitivity % 8;
|
systemSettings.sensitivity = systemSettings.sensitivity
|
||||||
|
% 10;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TEMPROUNDING:
|
case TEMPROUNDING:
|
||||||
@@ -219,14 +216,14 @@ void ProcessUI() {
|
|||||||
operatingMode = SOLDERING;
|
operatingMode = SOLDERING;
|
||||||
Oled_DisplayOn();
|
Oled_DisplayOn();
|
||||||
return;
|
return;
|
||||||
} else if (systemSettings.movementEnabled) {
|
} else if (systemSettings.sensitivity) {
|
||||||
if (millis() - getLastMovement() < 1000) {//moved in the last second
|
if (millis() - getLastMovement() < 1000) {//moved in the last second
|
||||||
operatingMode = SOLDERING; //Goto active mode again
|
operatingMode = SOLDERING; //Goto active mode again
|
||||||
Oled_DisplayOn();
|
Oled_DisplayOn();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (systemSettings.movementEnabled) {
|
if (systemSettings.sensitivity) {
|
||||||
//Check if we should shutdown
|
//Check if we should shutdown
|
||||||
if ((millis() - getLastMovement()
|
if ((millis() - getLastMovement()
|
||||||
> (systemSettings.ShutdownTime * 60000))
|
> (systemSettings.ShutdownTime * 60000))
|
||||||
@@ -247,7 +244,7 @@ void ProcessUI() {
|
|||||||
//Either button was pushed
|
//Either button was pushed
|
||||||
operatingMode = STARTUP;
|
operatingMode = STARTUP;
|
||||||
}
|
}
|
||||||
if (systemSettings.movementEnabled) {
|
if (systemSettings.sensitivity) {
|
||||||
if (millis() - getLastMovement()
|
if (millis() - getLastMovement()
|
||||||
> (systemSettings.ShutdownTime * 60000)) {
|
> (systemSettings.ShutdownTime * 60000)) {
|
||||||
if ((millis() - getLastButtonPress()
|
if ((millis() - getLastButtonPress()
|
||||||
@@ -257,8 +254,7 @@ void ProcessUI() {
|
|||||||
} else {
|
} else {
|
||||||
Oled_DisplayOn();
|
Oled_DisplayOn();
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
Oled_DisplayOn();
|
Oled_DisplayOn();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -495,19 +491,12 @@ void DrawUI() {
|
|||||||
OLED_DrawString("SHTME ", 6);
|
OLED_DrawString("SHTME ", 6);
|
||||||
OLED_DrawTwoNumber(systemSettings.ShutdownTime, 6);
|
OLED_DrawTwoNumber(systemSettings.ShutdownTime, 6);
|
||||||
break;
|
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 ?*/
|
case TEMPDISPLAY:/*Are we showing in C or F ?*/
|
||||||
if (systemSettings.displayTempInF)
|
if (systemSettings.displayTempInF)
|
||||||
OLED_DrawString("TMPUNT F", 8);
|
OLED_DrawString("TMPUNT F", 8);
|
||||||
else
|
else
|
||||||
OLED_DrawString("TMPUNT C", 8);
|
OLED_DrawString("TMPUNT C", 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LEFTY:
|
case LEFTY:
|
||||||
|
|
||||||
if (systemSettings.flipDisplay)
|
if (systemSettings.flipDisplay)
|
||||||
@@ -517,7 +506,7 @@ void DrawUI() {
|
|||||||
break;
|
break;
|
||||||
case MOTIONSENSITIVITY:
|
case MOTIONSENSITIVITY:
|
||||||
OLED_DrawString("MSENSE ", 7);
|
OLED_DrawString("MSENSE ", 7);
|
||||||
OLED_DrawChar('1' + systemSettings.sensitivity, 7);
|
OLED_DrawChar('0' + systemSettings.sensitivity, 7);
|
||||||
break;
|
break;
|
||||||
case TEMPROUNDING:
|
case TEMPROUNDING:
|
||||||
//We are prompting the user about their display mode preferences
|
//We are prompting the user about their display mode preferences
|
||||||
@@ -593,7 +582,7 @@ void DrawUI() {
|
|||||||
case COOLING:
|
case COOLING:
|
||||||
//We are warning the user the tip is cooling
|
//We are warning the user the tip is cooling
|
||||||
OLED_DrawString("COOL ", 5);
|
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);
|
drawTemp(temp, 5, systemSettings.temperatureRounding);
|
||||||
break;
|
break;
|
||||||
case UVLOWARN:
|
case UVLOWARN:
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ void resetSettings() {
|
|||||||
systemSettings.SleepTemp = 1500; //Temperature the iron sleeps at - default 150.0 C
|
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.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.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.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.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
|
||||||
systemSettings.displayTempInF =0; //default to C
|
systemSettings.displayTempInF =0; //default to C
|
||||||
|
|||||||
Reference in New Issue
Block a user