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>
</storageModule>
<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="">
<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"/>

View File

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

View File

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

View File

@@ -36,7 +36,7 @@ void setup() {
restoreSettings(); //Load settings
if (systemSettings.flipDisplay)
Oled_DisplayFlip();
OLED_DrawString("VER 1.01",8);
OLED_DrawString("VER 1.02",8);
delayMs(800);
Start_Watchdog(1000); //start the system watchdog as 1 seconds timeout
}

View File

@@ -16,12 +16,16 @@ void ProcessUI() {
switch (operatingMode) {
case STARTUP:
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
operatingMode = SOLDERING;
resetLastButtonPress();
resetButtons();
} else if (Buttons & BUT_B) {
} else if (Buttons == BUT_B) {
//B Button was pressed so we are moving to the Settings menu
operatingMode = SETTINGS;
resetLastButtonPress();
@@ -32,16 +36,18 @@ void ProcessUI() {
break;
case SOLDERING:
//We need to check the buttons if we need to jump out
if (Buttons & BUT_A) {
//A key pressed so we are moving to temp set
if (Buttons == BUT_A || Buttons == BUT_B) {
//A or B key pressed so we are moving to temp set
operatingMode = TEMP_ADJ;
resetLastButtonPress();
resetButtons();
} else if (Buttons & BUT_B) {
//B Button was pressed so we are moving back to idle
operatingMode = COOLING;
resetLastButtonPress();
resetButtons();
} else if (Buttons == (BUT_A | BUT_B)) {
if (millis() - getLastButtonPress() > 1000) {
//Both buttons were pressed, exit back to the cooling screen
operatingMode = COOLING;
resetLastButtonPress();
resetButtons();
}
} else {
//We need to check the timer for movement in case we need to goto idle
if (systemSettings.movementEnabled)
@@ -168,20 +174,15 @@ void ProcessUI() {
setIronTimer(0); //turn off heating
//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
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;
resetLastButtonPress();
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;
@@ -192,6 +193,17 @@ void ProcessUI() {
operatingMode = STARTUP; //jump back to idle mode
}
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:
break;
}
@@ -229,7 +241,7 @@ void DrawUI() {
if (getIronTimer() == 0) {
OLED_DrawChar('C', 5);
} else {
if (getIronTimer() < 500) {
if (getIronTimer() < 900) {
OLED_DrawChar(' ', 5);
} else { //we are heating
OLED_DrawChar('H', 5);
@@ -300,16 +312,21 @@ void DrawUI() {
//The iron is in sleep temp mode
//Draw in temp and sleep
OLED_DrawString("SLP", 3);
drawTemp(temp, 3);
drawTemp(temp, 4);
break;
case COOLING:
//We are warning the user the tip is cooling
OLED_DrawString("COOL", 3);
drawTemp(temp, 4);
OLED_DrawString("COOL", 4);
drawTemp(temp, 5);
break;
case UVLOWARN:
OLED_DrawString("LOW VOLT", 8);
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:
break;
}

View File

@@ -13,7 +13,7 @@
#include "I2C.h"
#include "Font.h"
u8 displayOffset = 32;
int8_t displayOffset = 32;
/*Setup params for the OLED screen*/
/*http://www.displayfuture.com/Display/datasheet/controller/SSD1307.pdf*/
/*All commands are prefixed with 0x80*/
@@ -96,7 +96,7 @@ u8* Data_Command(u8 length, u8* data) {
void Set_ShowPos(u8 x, u8 y) {
u8 pos_param[8] = { 0x80, 0xB0, 0x80, 0x21, 0x80, 0x00, 0x80, 0x7F };
//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;
I2C_PageWrite(pos_param, 8, DEVICEADDR_OLED);
}
@@ -161,7 +161,7 @@ void Init_Oled(void) {
*******************************************************************************/
void Clear_Screen(void) {
u8 tx_data[128];
memset(&tx_data[0], 0, 128);
memset(tx_data, 0, 128);
for (u8 i = 0; i < 2; i++) {
Oled_DrawArea(0, i * 8, 128, 8, tx_data);
}