diff options
-rw-r--r-- | workspace/ts100/inc/Oled.h | 2 | ||||
-rw-r--r-- | workspace/ts100/src/Modes.c | 24 | ||||
-rw-r--r-- | workspace/ts100/src/Oled.c | 2 | ||||
-rw-r--r-- | workspace/ts100/src/Settings.c | 2 |
4 files changed, 22 insertions, 8 deletions
diff --git a/workspace/ts100/inc/Oled.h b/workspace/ts100/inc/Oled.h index 682faa6e..8b896d1e 100644 --- a/workspace/ts100/inc/Oled.h +++ b/workspace/ts100/inc/Oled.h @@ -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);
diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index 55e43d6a..4efac5a1 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -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: @@ -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() @@ -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: @@ -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: diff --git a/workspace/ts100/src/Oled.c b/workspace/ts100/src/Oled.c index 4f8ec045..c584a0d5 100644 --- a/workspace/ts100/src/Oled.c +++ b/workspace/ts100/src/Oled.c @@ -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);
}
diff --git a/workspace/ts100/src/Settings.c b/workspace/ts100/src/Settings.c index c115e066..b59e89e7 100644 --- a/workspace/ts100/src/Settings.c +++ b/workspace/ts100/src/Settings.c @@ -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 |