Skip to content

Commit

Permalink
Fix #19
Browse files Browse the repository at this point in the history
Prevent skipping from cool straight to soldering without turning oled
back on.
  • Loading branch information
Ralim committed Jul 11, 2017
1 parent 16ecf48 commit 52e3247
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion workspace/ts100/inc/Oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void Init_Oled(uint8_t leftHanded);
u8* Data_Command(u8 len, u8* ptr);
void Clear_Screen(void);//Clear 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_DrawTwoNumber(uint8_t in, uint8_t x);
void OLED_BlankSlot(uint8_t xStart,uint8_t width);
Expand Down
24 changes: 19 additions & 5 deletions workspace/ts100/src/Modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ void ProcessUI() {
} else if (Buttons == BUT_A) {
//A key pressed so we are moving to soldering mode
operatingMode = SOLDERING;
Oled_DisplayOn();
} else if (Buttons == BUT_B) {
//B Button was pressed so we are moving to the Settings menu
operatingMode = SETTINGS;
Oled_DisplayOn();
}
break;
case SOLDERING:
Expand Down Expand Up @@ -217,12 +219,13 @@ void ProcessUI() {
operatingMode = SOLDERING;
Oled_DisplayOn();
return;
} else if (systemSettings.movementEnabled)
} else if (systemSettings.movementEnabled) {
if (millis() - getLastMovement() < 1000) {//moved in the last second
operatingMode = SOLDERING; //Goto active mode again
Oled_DisplayOn();
return;
}
}
if (systemSettings.movementEnabled) {
//Check if we should shutdown
if ((millis() - getLastMovement()
Expand All @@ -240,13 +243,23 @@ void ProcessUI() {
case COOLING: {
setIronTimer(0); //turn off heating
//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 (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
if (Buttons & (BUT_A | BUT_B)) { //we check if the user has pushed a button to exit
//Either button was pushed
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;
case UVLOWARN:
Expand Down Expand Up @@ -580,6 +593,7 @@ void DrawUI() {
case COOLING:
//We are warning the user the tip is cooling
OLED_DrawString("COOL ", 5);
temp = readIronTemp(0, 1, 0xFFFF);//force temp re-reading
drawTemp(temp, 5, systemSettings.temperatureRounding);
break;
case UVLOWARN:
Expand Down
2 changes: 1 addition & 1 deletion workspace/ts100/src/Oled.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void Clear_Screen(void) {
/*
* 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++) {
OLED_DrawChar(string[i], i);
}
Expand Down
2 changes: 1 addition & 1 deletion workspace/ts100/src/Settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void resetSettings() {
systemSettings.version = SETTINGSVERSION; //Store the version number to allow for easier upgrades
systemSettings.displayTempInF =0; //default to C
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.voltageDiv=144; //Default divider from schematic
systemSettings.ShutdownTime=30; //How many minutes until the unit turns itself off
Expand Down

0 comments on commit 52e3247

Please sign in to comment.