diff options
author | Ben V. Brown <[email protected]> | 2017-01-22 21:19:26 +1100 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2017-01-22 21:19:26 +1100 |
commit | b7e4249d2ef34d63bb1108ce5e84681b7688f89f (patch) | |
tree | cefc721c113852fd549ae6c0e69de846cdce36e1 | |
parent | 0bbdda5b553556875901900f6295faab3182a986 (diff) | |
download | IronOS-b7e4249d2ef34d63bb1108ce5e84681b7688f89f.tar.gz IronOS-b7e4249d2ef34d63bb1108ce5e84681b7688f89f.zip |
Use both buttons to exit soldering instead of B
-rw-r--r-- | workspace/ts100/.gitignore | 1 | ||||
-rw-r--r-- | workspace/ts100/src/Modes.c | 28 | ||||
-rw-r--r-- | workspace/ts100/src/Oled.c | 6 |
3 files changed, 19 insertions, 16 deletions
diff --git a/workspace/ts100/.gitignore b/workspace/ts100/.gitignore index 3df573fe..ac01e665 100644 --- a/workspace/ts100/.gitignore +++ b/workspace/ts100/.gitignore @@ -1 +1,2 @@ /Debug/ +/Release/ diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index 3999f87f..b3f56a0d 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -32,16 +32,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,15 +170,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 { //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 + if ((millis() - getLastButtonPress() > 800) + && (millis() - getLastButtonPress() < 5000)) { + if (getButtons() & (BUT_A | BUT_B)) { + //Either button was pushed operatingMode = STARTUP; resetLastButtonPress(); resetButtons(); @@ -304,7 +306,7 @@ void DrawUI() { break; case COOLING: //We are warning the user the tip is cooling - OLED_DrawString("COOL", 3); + OLED_DrawString("COOL", 4); drawTemp(temp, 4); break; case UVLOWARN: diff --git a/workspace/ts100/src/Oled.c b/workspace/ts100/src/Oled.c index c6943788..639d1ec2 100644 --- a/workspace/ts100/src/Oled.c +++ b/workspace/ts100/src/Oled.c @@ -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);
}
|