diff options
author | Ben V. Brown <[email protected]> | 2022-02-05 10:52:41 +1100 |
---|---|---|
committer | Ben V. Brown <[email protected]> | 2022-02-05 12:23:51 +1100 |
commit | 15763dd55b1d8e0a26a8ca70cb4c0f67360e5908 (patch) | |
tree | 9f4896b103a0983270d8505f29ec4bf75098f617 /source | |
parent | 4f2179287e7aa5ad9e1c37fc70ce488715676d63 (diff) | |
download | IronOS-15763dd55b1d8e0a26a8ca70cb4c0f67360e5908.tar.gz IronOS-15763dd55b1d8e0a26a8ca70cb4c0f67360e5908.zip |
Cleanup OLED_FLIP logic
Update OLED.hpp
Update OLED.hpp
Update OLED.hpp
Diffstat (limited to 'source')
-rw-r--r-- | source/Core/Drivers/OLED.hpp | 12 | ||||
-rw-r--r-- | source/Core/Threads/GUIThread.cpp | 65 |
2 files changed, 9 insertions, 68 deletions
diff --git a/source/Core/Drivers/OLED.hpp b/source/Core/Drivers/OLED.hpp index a13e02a3..413a6690 100644 --- a/source/Core/Drivers/OLED.hpp +++ b/source/Core/Drivers/OLED.hpp @@ -61,7 +61,13 @@ public: static void setRotation(bool leftHanded); // Set the rotation for the screen
// Get the current rotation of the LCD
- static bool getRotation() { return inLeftHandedMode; }
+ static bool getRotation() {
+#ifdef OLED_FLIP
+ return !inLeftHandedMode;
+#else
+ return inLeftHandedMode;
+#endif
+ }
static void setBrightness(uint8_t contrast);
static void setInverseDisplay(bool inverted);
static int16_t getCursorX() { return cursor_x; }
@@ -98,8 +104,8 @@ public: private:
static void drawChar(uint16_t charCode, FontStyle fontStyle); // Draw a character to the current cursor location
static void setFramebuffer(uint8_t *buffer);
- static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
- static uint8_t * secondStripPtr; // Pointers to the strips
+ static uint8_t * firstStripPtr; // Pointers to the strips to allow for buffer having extra content
+ static uint8_t * secondStripPtr; // Pointers to the strips
static bool inLeftHandedMode; // Whether the screen is in left or not (used for offsets in GRAM)
static bool initDone;
static DisplayState displayState;
diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index b07e93bd..57efd38c 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -254,12 +254,7 @@ static void gui_solderingTempAdjust() { if (xTaskGetTickCount() - lastChange > (TICKS_SECOND * 2)) return; // exit if user just doesn't press anything for a bit -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif - OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE); } else { OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE); @@ -273,11 +268,7 @@ static void gui_solderingTempAdjust() { OLED::drawSymbol(1); } OLED::print(SymbolSpace, FontStyle::LARGE); -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolMinus : SymbolPlus, FontStyle::LARGE); } else { OLED::print(getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled) ? SymbolPlus : SymbolMinus, FontStyle::LARGE); @@ -548,11 +539,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) { } } // else we update the screen information -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(50, 0); } else { OLED::setCursor(-1, 0); @@ -564,11 +551,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) { #ifndef NO_SLEEP_MODE if (getSettingValue(SettingsOptions::Sensitivity) && getSettingValue(SettingsOptions::SleepTime)) { -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(32, 0); } else { OLED::setCursor(47, 0); @@ -578,11 +561,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) { #endif if (boostModeOn) { -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(38, 8); } else { OLED::setCursor(55, 8); @@ -590,11 +569,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) { OLED::print(SymbolPlus, FontStyle::SMALL); } -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(0, 0); } else { OLED::setCursor(67, 0); @@ -604,11 +579,7 @@ static void gui_solderingMode(uint8_t jumpToSleep) { OLED::printNumber(x10WattHistory.average() % 10, 1, FontStyle::SMALL); OLED::print(SymbolWatts, FontStyle::SMALL); -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(0, 8); } else { OLED::setCursor(67, 8); @@ -963,32 +934,20 @@ void startGUITask(void const *argument) { } // Clear the lcd buffer OLED::clearScreen(); -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(50, 0); } else { OLED::setCursor(-1, 0); } if (getSettingValue(SettingsOptions::DetailedIDLE)) { if (isTipDisconnected()) { -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif // in right handed mode we want to draw over the first part OLED::drawArea(54, 0, 42, 16, disconnectedTipF); } else { OLED::drawArea(0, 0, 42, 16, disconnectedTip); } -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(-1, 0); } else { OLED::setCursor(42, 0); @@ -997,11 +956,7 @@ void startGUITask(void const *argument) { OLED::printNumber(Vlt / 10, 2, FontStyle::LARGE); OLED::print(SymbolDot, FontStyle::LARGE); OLED::printNumber(Vlt % 10, 1, FontStyle::LARGE); -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(48, 8); } else { OLED::setCursor(91, 8); @@ -1013,11 +968,7 @@ void startGUITask(void const *argument) { // 1000 tick/sec // OFF 300ms ON 700ms gui_drawTipTemp(true, FontStyle::LARGE); // draw in the temp -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(6, 0); } else { OLED::setCursor(73, 0); // top right @@ -1027,11 +978,7 @@ void startGUITask(void const *argument) { OLED::print(SymbolDegF, FontStyle::SMALL); else OLED::print(SymbolDegC, FontStyle::SMALL); -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::setCursor(0, 8); } else { OLED::setCursor(67, 8); // bottom right @@ -1041,11 +988,7 @@ void startGUITask(void const *argument) { } } else { -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif OLED::drawArea(54, 0, 42, 16, buttonAF); OLED::drawArea(12, 0, 42, 16, buttonBF); OLED::setCursor(0, 0); @@ -1068,11 +1011,7 @@ void startGUITask(void const *argument) { if (tempOnDisplay || tipDisconnectedDisplay) { // draw temp over the start soldering button // Location changes on screen rotation -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif // in right handed mode we want to draw over the first part OLED::fillArea(55, 0, 41, 16, 0); // clear the area for the temp OLED::setCursor(56, 0); @@ -1088,11 +1027,7 @@ void startGUITask(void const *argument) { } else { // Draw in missing tip symbol -#ifdef OLED_FLIP - if (!OLED::getRotation()) { -#else if (OLED::getRotation()) { -#endif // in right handed mode we want to draw over the first part OLED::drawArea(54, 0, 42, 16, disconnectedTipF); } else { |