mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
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/
|
||||
/Release/
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user