mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update draw_homescreen_simplified.cpp
Rework of 96x12 drawer, in order to support swapping of setting/heating hints
This commit is contained in:
@@ -6,57 +6,38 @@ extern uint8_t buttonBF[sizeof(buttonB)];
|
|||||||
extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
|
extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
|
||||||
|
|
||||||
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
||||||
bool tempOnDisplay = false;
|
bool tipDisconnected = isTipDisconnected();
|
||||||
bool tipDisconnectedDisplay = false;
|
bool displayTemp = (tipTemp > 55) && !tipDisconnected;
|
||||||
if (OLED::getRotation()) {
|
bool isFlipped = OLED::getRotation();
|
||||||
OLED::drawArea(54, 0, 42, 16, buttonAF);
|
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
|
||||||
OLED::drawArea(12, 0, 42, 16, buttonBF);
|
|
||||||
OLED::setCursor(0, 0);
|
// Flip and switch buttons accordingly
|
||||||
ui_draw_power_source_icon();
|
OLED::drawArea(isFlipped ? 54: 0, 0, 42, 16, isFlipped ? (isReverse ? buttonBF:buttonAF) : (isReverse ? buttonB:buttonA) );
|
||||||
} else {
|
OLED::drawArea(isFlipped ? 12:42, 0, 42, 16, isFlipped ? (isReverse ? buttonAF:buttonBF) : (isReverse ? buttonA:buttonB) );
|
||||||
OLED::drawArea(0, 0, 42, 16, buttonA); // Needs to be flipped so button ends up
|
|
||||||
OLED::drawArea(42, 0, 42, 16, buttonB); // on right side of screen
|
if (displayTemp || tipDisconnected) {
|
||||||
OLED::setCursor(84, 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
|
// draw temp over the start soldering button
|
||||||
// Location changes on screen rotation
|
// Location changes on screen rotation
|
||||||
if (OLED::getRotation()) {
|
|
||||||
// in right handed mode we want to draw over the first part
|
// 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::fillArea(isReverse? (isFlipped?14:42):(isFlipped?55:0), 0, 41, 16, 0); // clear the area
|
||||||
OLED::setCursor(56, 0);
|
OLED::setCursor(isReverse? (isFlipped?15:43):(isFlipped?56:0), 0);
|
||||||
} else {
|
// If tip is connected draw the temp, otherwise - the notification
|
||||||
OLED::fillArea(0, 0, 41, 16, 0); // clear the area
|
if (!tipDisconnected) {
|
||||||
OLED::setCursor(0, 0);
|
// Draw-in the temp
|
||||||
}
|
|
||||||
// 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))) {
|
if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
|
||||||
ui_draw_tip_temperature(false, FontStyle::LARGE); // draw in the temp
|
ui_draw_tip_temperature(false, FontStyle::LARGE); // draw in the temp
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Draw in missing tip symbol
|
// Draw-in the missing tip symbol
|
||||||
|
if (isReverse) {
|
||||||
if (OLED::getRotation()) {
|
OLED::drawArea(isFlipped?12:42, 0, 42, 16, isFlipped?disconnectedTipF:disconnectedTip);
|
||||||
// in right handed mode we want to draw over the first part
|
|
||||||
OLED::drawArea(54, 0, 42, 16, disconnectedTipF);
|
|
||||||
} else {
|
} else {
|
||||||
OLED::drawArea(0, 0, 42, 16, disconnectedTip);
|
OLED::drawArea(isFlipped? 54:0, 0, 42, 16, isFlipped?disconnectedTipF:disconnectedTip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
OLED::setCursor(isFlipped ? 0:84, 0);
|
||||||
|
ui_draw_power_source_icon();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user