From 1d602bd9a191c5e85cd08142792ffb5fc06b527a Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Sun, 13 Aug 2017 12:48:16 +1000 Subject: [PATCH] Add display inversion for cooling --- workspace/ts100/inc/Oled.h | 1 + workspace/ts100/src/Modes.c | 20 +++++++++++--------- workspace/ts100/src/Oled.c | 5 ++++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/workspace/ts100/inc/Oled.h b/workspace/ts100/inc/Oled.h index fd57f13b..62888581 100644 --- a/workspace/ts100/inc/Oled.h +++ b/workspace/ts100/inc/Oled.h @@ -17,6 +17,7 @@ void OLED_Sync(); void Oled_DrawArea(u8 x0, u8 y0, u8 wide, u8 height, const u8* ptr); void Set_ShowPos(u8 x, u8 y); void Oled_DisplayFlip(); +void OLED_InvertBuffer(); void GPIO_Init_OLED(void); void Init_Oled(uint8_t leftHanded); const u8* Data_Command(u8 len, const u8* ptr); diff --git a/workspace/ts100/src/Modes.c b/workspace/ts100/src/Modes.c index fae4bb82..9c87ed87 100644 --- a/workspace/ts100/src/Modes.c +++ b/workspace/ts100/src/Modes.c @@ -269,14 +269,14 @@ void ProcessUI() { operatingMode = SOLDERING; Oled_DisplayOn(); return; - } else if (systemSettings.sensitivity&& !InterruptMask) { + } else if (systemSettings.sensitivity && !InterruptMask) { if (millis() - getLastMovement() < 1000) {//moved in the last second operatingMode = SOLDERING; //Goto active mode again Oled_DisplayOn(); return; } } - if (systemSettings.sensitivity ) { + if (systemSettings.sensitivity) { //Check if we should shutdown if ((millis() - getLastMovement() > (systemSettings.ShutdownTime * 60000)) @@ -459,7 +459,7 @@ void DrawUI() { //Now draw symbols if (StatusFlags == 8) - OLED_DrawExtraFontChars(2,4); + OLED_DrawExtraFontChars(2, 4); else { OLED_DrawChar(' ', 4); } @@ -482,10 +482,10 @@ void DrawUI() { if (systemSettings.displayTempInF) { //OLED_DrawChar(SettingTempFChar, 3); - OLED_DrawExtraFontChars(0,3); + OLED_DrawExtraFontChars(0, 3); } else { //OLED_DrawChar(SettingTempCChar, 3); - OLED_DrawExtraFontChars(1,3); + OLED_DrawExtraFontChars(1, 3); } //Optionally draw the arrows, or draw the power instead if (systemSettings.powerDisplay) { @@ -731,11 +731,13 @@ void DrawUI() { Clear_Screen(); OLED_DrawString(CoolingPromptString, 5); temp = readIronTemp(0, 1, 0xFFFF); //force temp re-reading - if (temp < 500 || ((millis() % 1000) > 500) - || (!systemSettings.coolingTempBlink)) - drawTemp(temp, 5, systemSettings.temperatureRounding); - if(temp>300) + + drawTemp(temp, 5, systemSettings.temperatureRounding); + if (temp > 300) Oled_DisplayOn(); + if (temp > 500 && systemSettings.coolingTempBlink + && (millis() % 600) > 300) + OLED_InvertBuffer(); break; case UVLOWARN: OLED_DrawString(UVLOWarningString, 8); diff --git a/workspace/ts100/src/Oled.c b/workspace/ts100/src/Oled.c index 91ce97c2..4e3bf159 100644 --- a/workspace/ts100/src/Oled.c +++ b/workspace/ts100/src/Oled.c @@ -136,7 +136,10 @@ void Oled_DrawArea(u8 x, u8 y, u8 wide, u8 height, const u8* ptr) { } } - +void OLED_InvertBuffer() { + for (uint16_t i = 0; i < (2 * 96); i++) + displayBuffer[i] = ~displayBuffer[i]; +} /******************************************************************************* Function:GPIO_Init_OLED Description:Init the outputs as needed for the OLED (in this case the RST line)