Use both buttons to exit soldering instead of B
This commit is contained in:
1
workspace/ts100/.gitignore
vendored
1
workspace/ts100/.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
/Debug/
|
/Debug/
|
||||||
|
/Release/
|
||||||
|
|||||||
@@ -32,16 +32,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,15 +170,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;
|
operatingMode = STARTUP;
|
||||||
resetLastButtonPress();
|
resetLastButtonPress();
|
||||||
resetButtons();
|
resetButtons();
|
||||||
} else { //we check if the user has pushed a button to ack
|
} else { //we check if the user has pushed a button to ack
|
||||||
if ((millis() - getLastButtonPress() > 200)
|
if ((millis() - getLastButtonPress() > 800)
|
||||||
&& (millis() - getLastButtonPress() < 2000)) {
|
&& (millis() - getLastButtonPress() < 5000)) {
|
||||||
if (getButtons() && (BUT_A | BUT_B)) {
|
if (getButtons() & (BUT_A | BUT_B)) {
|
||||||
//A button was pushed
|
//Either button was pushed
|
||||||
operatingMode = STARTUP;
|
operatingMode = STARTUP;
|
||||||
resetLastButtonPress();
|
resetLastButtonPress();
|
||||||
resetButtons();
|
resetButtons();
|
||||||
@@ -304,7 +306,7 @@ void DrawUI() {
|
|||||||
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, 4);
|
||||||
break;
|
break;
|
||||||
case UVLOWARN:
|
case UVLOWARN:
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user