From ce86d6594da0bdf096157303618b66e376ea372b Mon Sep 17 00:00:00 2001 From: Leo Date: Tue, 28 Jan 2025 16:32:20 +0200 Subject: [PATCH] Update draw_homescreen_simplified (128x32) Drawer rework, should look ok but testing is required --- .../draw_homescreen_simplified.cpp | 79 +++++++------------ 1 file changed, 29 insertions(+), 50 deletions(-) diff --git a/source/Core/Threads/UI/drawing/mono_128x32/draw_homescreen_simplified.cpp b/source/Core/Threads/UI/drawing/mono_128x32/draw_homescreen_simplified.cpp index 3c8c1816..795f8a3b 100644 --- a/source/Core/Threads/UI/drawing/mono_128x32/draw_homescreen_simplified.cpp +++ b/source/Core/Threads/UI/drawing/mono_128x32/draw_homescreen_simplified.cpp @@ -7,56 +7,35 @@ extern uint8_t buttonBF[sizeof(buttonB)]; extern uint8_t disconnectedTipF[sizeof(disconnectedTip)]; void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) { - bool tempOnDisplay = false; - bool tipDisconnectedDisplay = false; - if (OLED::getRotation()) { - OLED::drawArea(68, 0, 56, 32, buttonAF); - OLED::drawArea(12, 0, 56, 32, buttonBF); - OLED::setCursor(0, 0); - ui_draw_power_source_icon(); - } else { - OLED::drawArea(0, 0, 56, 32, buttonA); // Needs to be flipped so button ends up - OLED::drawArea(58, 0, 56, 32, buttonB); // on right side of screen - OLED::setCursor(116, 0); - ui_draw_power_source_icon(); - } - tipDisconnectedDisplay = false; - if (tipTemp > 55) { - tempOnDisplay = true; - } else if (tipTemp < 45) { - tempOnDisplay = false; - } - if (isTipDisconnected()) { - tempOnDisplay = false; - tipDisconnectedDisplay = true; - } - if (tempOnDisplay || tipDisconnectedDisplay) { - // draw temp over the start soldering button - // Location changes on screen rotation - if (OLED::getRotation()) { - // in right handed mode we want to draw over the first part - OLED::fillArea(68, 0, 56, 32, 0); // clear the area for the temp - OLED::setCursor(56, 0); - } else { - OLED::fillArea(0, 0, 56, 32, 0); // clear the area - OLED::setCursor(0, 0); - } - // If we have a tip connected draw the temp, if not we leave it blank - if (!tipDisconnectedDisplay) { - // draw in the temp - if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) { - ui_draw_tip_temperature(false, FontStyle::LARGE); // draw in the temp - } - } else { - // Draw in missing tip symbol - if (OLED::getRotation()) { - // in right handed mode we want to draw over the first part - OLED::drawArea(54, 0, 56, 32, disconnectedTipF); - } else { - OLED::drawArea(0, 0, 56, 32, disconnectedTip); - } - } - } + bool tipDisconnected = isTipDisconnected(); + bool isFlipped = OLED::getRotation(); + bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled); + // Flip and switch buttons accordingly + OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? (isReverse ? buttonBF : buttonAF) : (isReverse ? buttonB : buttonA)); + OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? (isReverse ? buttonAF : buttonBF) : (isReverse ? buttonA : buttonB)); + + if ((tipTemp > 55) || tipDisconnected) { + // draw temp over the start soldering button + // Location changes on screen rotation + // in right handed mode we want to draw over the first part + OLED::fillArea(isReverse ? (isFlipped ? 26 : 58) : (isFlipped ? 68 : 0), 0, 56, 32, 0); // clear the area + OLED::setCursor(isReverse ? (isFlipped ? 27 : 59) : (isFlipped ? 56 : 0), 0); + // If tip is connected draw the temp, otherwise - the notification + if (tipDisconnected) { + // Draw-in the missing tip symbol + if (isReverse) { + OLED::drawArea(isFlipped ? 20 : 54, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip); + } else { + OLED::drawArea(isFlipped ? 54 : 0, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip); + }// Draw-in the temp + + + } else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) { + ui_draw_tip_temperature(false, FontStyle::LARGE); // Draw-in the temp + } + } + OLED::setCursor(isFlipped ? 0 : 116, 0); + ui_draw_power_source_icon(); } #endif \ No newline at end of file