1
0
forked from me/IronOS
Prevent skipping from cool straight to soldering without turning oled
back on.
This commit is contained in:
Ben V. Brown
2017-07-11 18:22:44 +10:00
parent 16ecf486c2
commit 52e3247f7e
4 changed files with 22 additions and 8 deletions

View File

@@ -22,7 +22,7 @@ void Init_Oled(uint8_t leftHanded);
u8* Data_Command(u8 len, u8* ptr); u8* Data_Command(u8 len, u8* ptr);
void Clear_Screen(void);//Clear the screen void Clear_Screen(void);//Clear the screen
/*Functions for writing to the screen*/ /*Functions for writing to the screen*/
void OLED_DrawString(char* string, uint8_t length); void OLED_DrawString(const char* string, const uint8_t length);
void OLED_DrawChar(char c, uint8_t x); void OLED_DrawChar(char c, uint8_t x);
void OLED_DrawTwoNumber(uint8_t in, uint8_t x); void OLED_DrawTwoNumber(uint8_t in, uint8_t x);
void OLED_BlankSlot(uint8_t xStart,uint8_t width); void OLED_BlankSlot(uint8_t xStart,uint8_t width);

View File

@@ -37,9 +37,11 @@ void ProcessUI() {
} else if (Buttons == BUT_A) { } 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;
Oled_DisplayOn();
} 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;
Oled_DisplayOn();
} }
break; break;
case SOLDERING: case SOLDERING:
@@ -217,12 +219,13 @@ void ProcessUI() {
operatingMode = SOLDERING; operatingMode = SOLDERING;
Oled_DisplayOn(); Oled_DisplayOn();
return; return;
} else if (systemSettings.movementEnabled) } else if (systemSettings.movementEnabled) {
if (millis() - getLastMovement() < 1000) {//moved in the last second if (millis() - getLastMovement() < 1000) {//moved in the last second
operatingMode = SOLDERING; //Goto active mode again operatingMode = SOLDERING; //Goto active mode again
Oled_DisplayOn(); Oled_DisplayOn();
return; return;
} }
}
if (systemSettings.movementEnabled) { if (systemSettings.movementEnabled) {
//Check if we should shutdown //Check if we should shutdown
if ((millis() - getLastMovement() if ((millis() - getLastMovement()
@@ -240,13 +243,23 @@ void ProcessUI() {
case COOLING: { case COOLING: {
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, 0xFFFF); //take a new reading as the heater code is not taking new readings if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to exit
if (temp < 400) { //if the temp is < 40C then we can go back to IDLE
operatingMode = STARTUP;
} else if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to ack
//Either button was pushed //Either button was pushed
operatingMode = STARTUP; operatingMode = STARTUP;
} }
if (systemSettings.movementEnabled) {
if (millis() - getLastMovement()
> (systemSettings.ShutdownTime * 60000)) {
if ((millis() - getLastButtonPress()
> systemSettings.ShutdownTime * 60000)) {
Oled_DisplayOff();
}
} else {
Oled_DisplayOn();
}
}
else
Oled_DisplayOn();
} }
break; break;
case UVLOWARN: case UVLOWARN:
@@ -580,6 +593,7 @@ void DrawUI() {
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 ", 5); OLED_DrawString("COOL ", 5);
temp = readIronTemp(0, 1, 0xFFFF);//force temp re-reading
drawTemp(temp, 5, systemSettings.temperatureRounding); drawTemp(temp, 5, systemSettings.temperatureRounding);
break; break;
case UVLOWARN: case UVLOWARN:

View File

@@ -174,7 +174,7 @@ void Clear_Screen(void) {
/* /*
* Draws a string onto the screen starting at the left * Draws a string onto the screen starting at the left
*/ */
void OLED_DrawString(char* string, uint8_t length) { void OLED_DrawString(const char* string,const uint8_t length) {
for (uint8_t i = 0; i < length; i++) { for (uint8_t i = 0; i < length; i++) {
OLED_DrawChar(string[i], i); OLED_DrawChar(string[i], i);
} }

View File

@@ -49,7 +49,7 @@ void resetSettings() {
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
systemSettings.displayTempInF =0; //default to C systemSettings.displayTempInF =0; //default to C
systemSettings.flipDisplay=0; //Default to right handed mode systemSettings.flipDisplay=0; //Default to right handed mode
systemSettings.sensitivity=5; //Default high sensitivity systemSettings.sensitivity=6; //Default high sensitivity
systemSettings.tempCalibration=239; //Default to their calibration value systemSettings.tempCalibration=239; //Default to their calibration value
systemSettings.voltageDiv=144; //Default divider from schematic systemSettings.voltageDiv=144; //Default divider from schematic
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off