1
0
forked from me/IronOS

Compare commits

...

5 Commits

Author SHA1 Message Date
Ben V. Brown
b793b61bb6 V1.12 - decreased step size for sensitivity
Collapsed motion being enabled into the motion sensitivity menu. Fixing
#20
More options for the sensitivity as well.
2017-07-11 19:52:29 +10:00
Ben V. Brown
52e3247f7e Fix #19
Prevent skipping from cool straight to soldering without turning oled
back on.
2017-07-11 18:22:49 +10:00
Ben V. Brown
16ecf486c2 Update README.md 2017-07-10 19:51:55 +10:00
Ben V. Brown
aa2fe7b31b Update README.md 2017-07-10 19:41:13 +10:00
Ben V. Brown
a40ad665fe Bugfix sensitivity options typo + add more options
Changes sensitivity scale to be more precise.
Fixes #17
2017-07-10 19:31:48 +10:00
9 changed files with 43 additions and 67 deletions

View File

@@ -1,6 +1,6 @@
# TS100
This is a complete re-write of the open source software for the ts100 soldering iron.
This project is feature complete for use as a soldering iron, but is still open to ideas and suggestions.
This project is feature complete for use as a soldering iron, *but is still open to ideas and suggestions.*
This project was started to remove the need for USB for changing system settings.
In the latest official firmware they have also added a settings menu system, so it is still worth comparing the two firmwares to select your preferred option.
@@ -56,7 +56,7 @@ If you leave the unit alone (ie don't press any buttons) on a setting, after 3 s
* SLTME -> Sleep time, how long it takes before the unit goes to sleep
* SHTME -> Shutdown Time, how long the unit will wait after movement before shutting down completely
* MOTION -> Wether motion detection is enabled or not
* SENSE -> Motion Sensitivity, H is more sensitive. L is lowest sensitivity (ie takes more movement to trigger)
* MSENSE -> Motion Sensitivity,1-8, 8 is most sensitive, 1 is least sensitive (ie takes more movement to trigger)
* TMPUNIT -> Temperature unit, C or F
* TMPRND -> Temperature Rounding, {1,5,10}
* TMPSPD -> How fast the temperature should update in the soldering status screen.
@@ -77,6 +77,7 @@ The boost temperature is set in the settings menu.
# Version Changes:
V1.11
- Boost mode
- Change sensitivity options to be 1-8
V1.10
- Adds help text to settings
@@ -111,3 +112,5 @@ V1.03
V1.02
- Adds hold both buttons on IDLE to access the therometer mode.
- Changes the exit soldering mode to be holding both buttons (Like original firmware).
If you _really_ loved this firmware and want to continue my caffine addiction, you can do so here (or email me) : https://paypal.me/RalimTek

View File

@@ -36,7 +36,6 @@ enum {
SLEEP_TEMP,
SLEEP_TIME,
SHUTDOWN_TIME,
MOTIONDETECT,
MOTIONSENSITIVITY,
TEMPDISPLAY,
TEMPROUNDING,

View File

@@ -22,7 +22,7 @@ void Init_Oled(uint8_t leftHanded);
u8* Data_Command(u8 len, u8* ptr);
void Clear_Screen(void);//Clear the screen
/*Functions for writing to the screen*/
void OLED_DrawString(char* string, uint8_t length);
void OLED_DrawString(const char* string, const uint8_t length);
void OLED_DrawChar(char c, uint8_t x);
void OLED_DrawTwoNumber(uint8_t in, uint8_t x);
void OLED_BlankSlot(uint8_t xStart,uint8_t width);

View File

@@ -11,11 +11,7 @@
#define SETTINGS_H_
#include <stdint.h>
#include "stm32f10x_flash.h"
#define SETTINGSVERSION 10 /*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
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

View File

@@ -34,19 +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 =0x0F;
switch(sensitivity)
{
case 0:
sens=0x1A;
break;
case 1:
sens=0x20;
break;
case 2:
sens=0x2A;
break;
}
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

View File

@@ -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
}

View File

@@ -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", " Temperature Unit",
" Temperature Rounding Amount",
" 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, 24, 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
@@ -37,9 +37,11 @@ void ProcessUI() {
} else if (Buttons == BUT_A) {
//A key pressed so we are moving to soldering mode
operatingMode = SOLDERING;
Oled_DisplayOn();
} else if (Buttons == BUT_B) {
//B Button was pressed so we are moving to the Settings menu
operatingMode = SETTINGS;
Oled_DisplayOn();
}
break;
case SOLDERING:
@@ -82,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()
@@ -164,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;
@@ -177,7 +175,8 @@ void ProcessUI() {
break;
case MOTIONSENSITIVITY:
systemSettings.sensitivity++;
systemSettings.sensitivity = systemSettings.sensitivity % 3;
systemSettings.sensitivity = systemSettings.sensitivity
% 10;
break;
case TEMPROUNDING:
@@ -217,13 +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))
@@ -240,13 +240,22 @@ void ProcessUI() {
case COOLING: {
setIronTimer(0); //turn off heating
//This mode warns the user the iron is still cooling down
uint16_t temp = readIronTemp(0, 1, 0xFFFF); //take a new reading as the heater code is not taking new readings
if (temp < 400) { //if the temp is < 40C then we can go back to IDLE
operatingMode = STARTUP;
} else if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to ack
if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to exit
//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:
@@ -482,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)
@@ -503,21 +505,8 @@ void DrawUI() {
OLED_DrawString("FLPDSP F", 8);
break;
case MOTIONSENSITIVITY:
switch (systemSettings.sensitivity) {
case MOTION_HIGH:
OLED_DrawString("SENSE H ", 8);
break;
case MOTION_MED:
OLED_DrawString("SENSE M ", 8);
break;
case MOTION_LOW:
OLED_DrawString("SENSE L ", 8);
break;
default:
OLED_DrawString("SENSE ", 8);
break;
}
OLED_DrawString("MSENSE ", 7);
OLED_DrawChar('0' + systemSettings.sensitivity, 7);
break;
case TEMPROUNDING:
//We are prompting the user about their display mode preferences
@@ -593,6 +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
drawTemp(temp, 5, systemSettings.temperatureRounding);
break;
case UVLOWARN:

View File

@@ -174,7 +174,7 @@ void Clear_Screen(void) {
/*
* Draws a string onto the screen starting at the left
*/
void OLED_DrawString(char* string, uint8_t length) {
void OLED_DrawString(const char* string,const uint8_t length) {
for (uint8_t i = 0; i < length; i++) {
OLED_DrawChar(string[i], i);
}

View File

@@ -44,12 +44,11 @@ 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
systemSettings.flipDisplay=0; //Default to right handed mode
systemSettings.sensitivity=0x00; //Default high sensitivity
systemSettings.sensitivity=6; //Default high sensitivity
systemSettings.tempCalibration=239; //Default to their calibration value
systemSettings.voltageDiv=144; //Default divider from schematic
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off