Compare commits

..

3 Commits
v1.01 ... v1.02

Author SHA1 Message Date
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
6 changed files with 49 additions and 30 deletions

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

@@ -36,7 +36,7 @@ void setup() {
restoreSettings(); //Load settings restoreSettings(); //Load settings
if (systemSettings.flipDisplay) if (systemSettings.flipDisplay)
Oled_DisplayFlip(); Oled_DisplayFlip();
OLED_DrawString("VER 1.01",8); OLED_DrawString("VER 1.02",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,7 +13,7 @@
#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*/
@@ -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);
} }
@@ -161,7 +161,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);
} }