1
0
forked from me/IronOS

Compare commits

...

5 Commits

Author SHA1 Message Date
Ben V. Brown
fceb81287e Patch to fix left handed screen 2017-01-23 20:52:46 +11:00
Ben V. Brown
c3d8d246dc Update readme 2017-01-23 19:45:23 +11:00
Ben V. Brown
1f7cdf9694 For temperature mode force reading 2017-01-23 19:39:56 +11:00
Ben V. Brown
b2db129ab8 V1.02 Add Thermometer Mode 2017-01-23 19:33:03 +11:00
Ben V. Brown
b7e4249d2e Use both buttons to exit soldering instead of B 2017-01-22 21:19:26 +11:00
9 changed files with 75 additions and 45 deletions

View File

@@ -31,8 +31,15 @@ This is completely safe, if it goes wrong just put the .hex file from the offici
6. If it ends with .RDY your done! Otherwise something went wrong. 6. If it ends with .RDY your done! Otherwise something went wrong.
7. If it went wrong try on a windows computer, some Mac / Linux machines do not play well with their boot loader. 7. If it went wrong try on a windows computer, some Mac / Linux machines do not play well with their boot loader.
There is also a complete device flash backup included in this repository. (Note this includes the bootloader, so will need a SWD programmer to load onto the unit).
# New Menu System # New Menu System
This new firmware uses a new menu system to allow access to the settings on the device. This new firmware uses a new menu system to allow access to the settings on the device.
This menu can be accessed as shown in following flow chart, in the settings numbers roll over from top to bottom. This menu can be accessed as shown in following flow chart, in the settings numbers roll over from top to bottom.
![TS100: Software Menu](http://ralimtek.com/images/TS100.png "Fairly easy to learn") ![TS100: Software Menu](TS100.png "Fairly easy to learn")
# Version Changes:
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).

BIN
TS100.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@@ -103,7 +103,7 @@
</extensions> </extensions>
</storageModule> </storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0"> <storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1113492345" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot;"> <configuration artifactExtension="elf" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1113492345" name="Release" parent="fr.ac6.managedbuild.config.gnu.cross.exe.release" postannouncebuildStep="Generating binary and Printing size information:" postbuildStep="arm-none-eabi-objcopy -O binary &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.bin&quot;; arm-none-eabi-size -B &quot;${BuildArtifactFileName}&quot;;arm-none-eabi-objcopy -O ihex &quot;${BuildArtifactFileBaseName}.elf&quot; &quot;${BuildArtifactFileBaseName}.hex&quot;">
<folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1113492345." name="/" resourcePath=""> <folderInfo id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1113492345." name="/" resourcePath="">
<toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.668479481" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release"> <toolChain id="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release.668479481" name="Ac6 STM32 MCU GCC" superClass="fr.ac6.managedbuild.toolchain.gnu.cross.exe.release">
<option id="fr.ac6.managedbuild.option.gnu.cross.mcu.302274410" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F103T8Ux" valueType="string"/> <option id="fr.ac6.managedbuild.option.gnu.cross.mcu.302274410" name="Mcu" superClass="fr.ac6.managedbuild.option.gnu.cross.mcu" value="STM32F103T8Ux" valueType="string"/>

View File

@@ -1 +1,2 @@
/Debug/ /Debug/
/Release/

View File

@@ -24,10 +24,11 @@ enum {
SLEEP, SLEEP,
COOLING, COOLING,
UVLOWARN, UVLOWARN,
THERMOMETER,
} operatingMode; } operatingMode;
enum { enum {
UVCO = 0, SLEEP_TEMP, SLEEP_TIME, MOTIONDETECT, TEMPDISPLAY,LEFTY UVCO = 0, SLEEP_TEMP, SLEEP_TIME, MOTIONDETECT, TEMPDISPLAY, LEFTY
} settingsPage; } settingsPage;

View File

@@ -18,7 +18,7 @@ u8* Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 high, u8* ptr);
void Set_ShowPos(u8 x, u8 y); void Set_ShowPos(u8 x, u8 y);
void Oled_DisplayFlip(); void Oled_DisplayFlip();
void GPIO_Init_OLED(void); void GPIO_Init_OLED(void);
void Init_Oled(void); void Init_Oled(uint8_t leftHanded);
u8* Data_Command(u8 len, u8* ptr); u8* Data_Command(u8 len, u8* ptr);
void Clear_Screen(void);//Clear the screen void Clear_Screen(void);//Clear the screen
/*Functions for writing to the screen*/ /*Functions for writing to the screen*/

View File

@@ -30,13 +30,13 @@ void setup() {
I2C_Configuration(); //Start the I2C hardware I2C_Configuration(); //Start the I2C hardware
GPIO_Init_OLED(); //Init the GPIO ports for the OLED GPIO_Init_OLED(); //Init the GPIO ports for the OLED
StartUp_Accelerometer(); //start the accelerometer StartUp_Accelerometer(); //start the accelerometer
Init_Oled(); //init the OLED display
setupPID(); //init the PID values setupPID(); //init the PID values
readIronTemp(239, 0); //load the default calibration value readIronTemp(239, 0); //load the default calibration value
restoreSettings(); //Load settings restoreSettings(); //Load settings
if (systemSettings.flipDisplay) Init_Oled(systemSettings.flipDisplay);//init the OLED display
Oled_DisplayFlip();
OLED_DrawString("VER 1.01",8); OLED_DrawString("VER 1.03",8);
delayMs(800); delayMs(800);
Start_Watchdog(1000); //start the system watchdog as 1 seconds timeout Start_Watchdog(1000); //start the system watchdog as 1 seconds timeout
} }

View File

@@ -16,12 +16,16 @@ void ProcessUI() {
switch (operatingMode) { switch (operatingMode) {
case STARTUP: case STARTUP:
if ((millis() - getLastButtonPress() > 1000)) { if ((millis() - getLastButtonPress() > 1000)) {
if (Buttons & BUT_A) { if (Buttons == (BUT_A | BUT_B)) {
operatingMode = THERMOMETER;
resetLastButtonPress();
resetButtons();
} else if (Buttons == BUT_A) {
//A key pressed so we are moving to soldering mode //A key pressed so we are moving to soldering mode
operatingMode = SOLDERING; operatingMode = SOLDERING;
resetLastButtonPress(); resetLastButtonPress();
resetButtons(); resetButtons();
} else if (Buttons & BUT_B) { } else if (Buttons == BUT_B) {
//B Button was pressed so we are moving to the Settings menu //B Button was pressed so we are moving to the Settings menu
operatingMode = SETTINGS; operatingMode = SETTINGS;
resetLastButtonPress(); resetLastButtonPress();
@@ -32,16 +36,18 @@ void ProcessUI() {
break; break;
case SOLDERING: case SOLDERING:
//We need to check the buttons if we need to jump out //We need to check the buttons if we need to jump out
if (Buttons & BUT_A) { if (Buttons == BUT_A || Buttons == BUT_B) {
//A key pressed so we are moving to temp set //A or B key pressed so we are moving to temp set
operatingMode = TEMP_ADJ; operatingMode = TEMP_ADJ;
resetLastButtonPress(); resetLastButtonPress();
resetButtons(); resetButtons();
} else if (Buttons & BUT_B) { } else if (Buttons == (BUT_A | BUT_B)) {
//B Button was pressed so we are moving back to idle if (millis() - getLastButtonPress() > 1000) {
operatingMode = COOLING; //Both buttons were pressed, exit back to the cooling screen
resetLastButtonPress(); operatingMode = COOLING;
resetButtons(); resetLastButtonPress();
resetButtons();
}
} else { } else {
//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.movementEnabled)
@@ -168,20 +174,15 @@ void ProcessUI() {
setIronTimer(0); //turn off heating setIronTimer(0); //turn off heating
//This mode warns the user the iron is still cooling down //This mode warns the user the iron is still cooling down
uint16_t temp = readIronTemp(0, 1); //take a new reading as the heater code is not taking new readings uint16_t temp = readIronTemp(0, 1); //take a new reading as the heater code is not taking new readings
if (temp < 500) { //if the temp is < 50C then we can go back to IDLE if (temp < 400) { //if the temp is < 40C then we can go back to IDLE
operatingMode = STARTUP;
resetLastButtonPress();
resetButtons();
} else if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to ack
//Either button was pushed
operatingMode = STARTUP; operatingMode = STARTUP;
resetLastButtonPress(); resetLastButtonPress();
resetButtons(); resetButtons();
} else { //we check if the user has pushed a button to ack
if ((millis() - getLastButtonPress() > 200)
&& (millis() - getLastButtonPress() < 2000)) {
if (getButtons() && (BUT_A | BUT_B)) {
//A button was pushed
operatingMode = STARTUP;
resetLastButtonPress();
resetButtons();
}
}
} }
} }
break; break;
@@ -192,6 +193,17 @@ void ProcessUI() {
operatingMode = STARTUP; //jump back to idle mode operatingMode = STARTUP; //jump back to idle mode
} }
break; break;
case THERMOMETER: {
//This lets the user check the tip temp without heating the iron.. And eventually calibration will be added here
if ((millis() - getLastButtonPress() > 1000))
if (Buttons == (BUT_A | BUT_B)) {
//If the user is holding both button, exit the temp screen
operatingMode = STARTUP;
resetLastButtonPress();
resetButtons();
}
}
break;
default: default:
break; break;
} }
@@ -229,7 +241,7 @@ void DrawUI() {
if (getIronTimer() == 0) { if (getIronTimer() == 0) {
OLED_DrawChar('C', 5); OLED_DrawChar('C', 5);
} else { } else {
if (getIronTimer() < 500) { if (getIronTimer() < 900) {
OLED_DrawChar(' ', 5); OLED_DrawChar(' ', 5);
} else { //we are heating } else { //we are heating
OLED_DrawChar('H', 5); OLED_DrawChar('H', 5);
@@ -300,16 +312,21 @@ void DrawUI() {
//The iron is in sleep temp mode //The iron is in sleep temp mode
//Draw in temp and sleep //Draw in temp and sleep
OLED_DrawString("SLP", 3); OLED_DrawString("SLP", 3);
drawTemp(temp, 3); drawTemp(temp, 4);
break; break;
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", 3); OLED_DrawString("COOL", 4);
drawTemp(temp, 4); drawTemp(temp, 5);
break; break;
case UVLOWARN: case UVLOWARN:
OLED_DrawString("LOW VOLT", 8); OLED_DrawString("LOW VOLT", 8);
break; break;
case THERMOMETER:
temp = readIronTemp(0, 1);//Force a reading as heater is off
OLED_DrawString("TEMP ", 5);//extra one to it clears the leftover 'L' from IDLE
drawTemp(temp, 5);
break;
default: default:
break; break;
} }

View File

@@ -13,15 +13,15 @@
#include "I2C.h" #include "I2C.h"
#include "Font.h" #include "Font.h"
u8 displayOffset = 32; int8_t displayOffset = 32;
/*Setup params for the OLED screen*/ /*Setup params for the OLED screen*/
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/ /*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
/*All commands are prefixed with 0x80*/ /*All commands are prefixed with 0x80*/
u8 OLED_Setup_Array[46] = { 0x80, 0xAE,/*Display off*/ u8 OLED_Setup_Array[46] = { 0x80, 0xAE,/*Display off*/
0x80, 0xD5,/*Set display clock divide ratio / osc freq*/ 0x80, 0xD5,/*Set display clock divide ratio / osc freq*/
0x80, 0b01010001,/**/ 0x80, 0x52,/**/
0x80, 0xA8,/*Set Multiplex Ratio*/ 0x80, 0xA8,/*Set Multiplex Ratio*/
0x80, 16, /*16 == max brightness,39==dimmest*/ 0x80, 0x0F, /*16 == max brightness,39==dimmest*/
0x80, 0xC0,/*Set COM Scan direction*/ 0x80, 0xC0,/*Set COM Scan direction*/
0x80, 0xD3,/*Set Display offset*/ 0x80, 0xD3,/*Set Display offset*/
0x80, 0x00,/*0 Offset*/ 0x80, 0x00,/*0 Offset*/
@@ -69,7 +69,7 @@ void Oled_DisplayFlip() {
I2C_PageWrite(data, 2, DEVICEADDR_OLED); I2C_PageWrite(data, 2, DEVICEADDR_OLED);
data[1] = 0xA1; data[1] = 0xA1;
I2C_PageWrite(data, 2, DEVICEADDR_OLED); I2C_PageWrite(data, 2, DEVICEADDR_OLED);
displayOffset=0; displayOffset = 0;
} }
/* /*
@@ -79,10 +79,10 @@ void Oled_DisplayFlip() {
*/ */
u8* Data_Command(u8 length, u8* data) { u8* Data_Command(u8 length, u8* data) {
int i; int i;
u8 tx_data[128]; u8 tx_data[129];
//here are are inserting the data write command at the beginning //here are are inserting the data write command at the beginning
tx_data[0] = 0x40; tx_data[0] = 0x40;
length += 1; length++;
for (i = 1; i < length; i++) //Loop through the array of data for (i = 1; i < length; i++) //Loop through the array of data
tx_data[i] = *data++; tx_data[i] = *data++;
I2C_PageWrite(tx_data, length, DEVICEADDR_OLED); //write out the buffer I2C_PageWrite(tx_data, length, DEVICEADDR_OLED); //write out the buffer
@@ -96,7 +96,7 @@ u8* Data_Command(u8 length, u8* data) {
void Set_ShowPos(u8 x, u8 y) { void Set_ShowPos(u8 x, u8 y) {
u8 pos_param[8] = { 0x80, 0xB0, 0x80, 0x21, 0x80, 0x00, 0x80, 0x7F }; u8 pos_param[8] = { 0x80, 0xB0, 0x80, 0x21, 0x80, 0x00, 0x80, 0x7F };
//page 0, start add = x(below) through to 0x7F (aka 127) //page 0, start add = x(below) through to 0x7F (aka 127)
pos_param[5] = x + displayOffset;/*Display offset ==0 for Lefty, == 32 fo righty*/ pos_param[5] = x + displayOffset;/*Display offset ==0 for Lefty, == 32 for righty*/
pos_param[1] += y; pos_param[1] += y;
I2C_PageWrite(pos_param, 8, DEVICEADDR_OLED); I2C_PageWrite(pos_param, 8, DEVICEADDR_OLED);
} }
@@ -144,14 +144,19 @@ void GPIO_Init_OLED(void) {
Function: Init_Oled Function: Init_Oled
Description: Initalizes the Oled screen Description: Initalizes the Oled screen
*******************************************************************************/ *******************************************************************************/
void Init_Oled(void) { void Init_Oled(uint8_t leftHanded) {
u8 param_len; u8 param_len;
OLED_RST(); OLED_RST();
delayMs(2); delayMs(5);
OLED_ACT(); //Toggling reset to reset the oled OLED_ACT(); //Toggling reset to reset the oled
delayMs(2); delayMs(5);
param_len = 46; param_len = 46;
if (leftHanded) {
OLED_Setup_Array[11] = 0xC8;
OLED_Setup_Array[19] = 0xA1;
displayOffset = 0;
}
I2C_PageWrite((u8 *) OLED_Setup_Array, param_len, DEVICEADDR_OLED); I2C_PageWrite((u8 *) OLED_Setup_Array, param_len, DEVICEADDR_OLED);
} }
@@ -161,7 +166,7 @@ void Init_Oled(void) {
*******************************************************************************/ *******************************************************************************/
void Clear_Screen(void) { void Clear_Screen(void) {
u8 tx_data[128]; u8 tx_data[128];
memset(&tx_data[0], 0, 128); memset(tx_data, 0, 128);
for (u8 i = 0; i < 2; i++) { for (u8 i = 0; i < 2; i++) {
Oled_DrawArea(0, i * 8, 128, 8, tx_data); Oled_DrawArea(0, i * 8, 128, 8, tx_data);
} }
@@ -196,8 +201,7 @@ void OLED_DrawChar(char c, uint8_t x) {
ptr += (37) * (FONT_WIDTH * 2); ptr += (37) * (FONT_WIDTH * 2);
} else if (c == '>') { } else if (c == '>') {
ptr += (38) * (FONT_WIDTH * 2); ptr += (38) * (FONT_WIDTH * 2);
}else if (c=='.') } else if (c == '.') {
{
ptr += (39) * (FONT_WIDTH * 2); ptr += (39) * (FONT_WIDTH * 2);
} }