mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Refactoring: trying to find a more suitable variable name to check status if swap buttons in menu is enabled
This commit is contained in:
@@ -45,7 +45,7 @@ OperatingMode guiHandleDraw(void) {
|
|||||||
OLED::clearScreen(); // Clear ready for render pass
|
OLED::clearScreen(); // Clear ready for render pass
|
||||||
bool d = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
bool d = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
bool e = getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled);
|
bool e = getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled);
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
bool f = currentOperatingMode == OperatingMode::TemperatureAdjust;
|
bool f = currentOperatingMode == OperatingMode::TemperatureAdjust;
|
||||||
// Read button state
|
// Read button state
|
||||||
ButtonState buttons = getButtonState((e && f) || (d && !e && !f) || (d && e && !f));
|
ButtonState buttons = getButtonState((e && f) || (d && !e && !f) || (d && e && !f));
|
||||||
@@ -117,7 +117,7 @@ OperatingMode guiHandleDraw(void) {
|
|||||||
newMode = gui_SolderingSleepingMode(buttons, &context);
|
newMode = gui_SolderingSleepingMode(buttons, &context);
|
||||||
break;
|
break;
|
||||||
case OperatingMode::TemperatureAdjust:
|
case OperatingMode::TemperatureAdjust:
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
newMode = gui_solderingTempAdjust(getButtonState(), &context);
|
newMode = gui_solderingTempAdjust(getButtonState(), &context);
|
||||||
#else
|
#else
|
||||||
newMode = gui_solderingTempAdjust(getButtonState(e), &context);
|
newMode = gui_solderingTempAdjust(getButtonState(e), &context);
|
||||||
@@ -130,7 +130,7 @@ OperatingMode guiHandleDraw(void) {
|
|||||||
newMode = performCJCC(buttons, &context);
|
newMode = performCJCC(buttons, &context);
|
||||||
break;
|
break;
|
||||||
case OperatingMode::SettingsMenu:
|
case OperatingMode::SettingsMenu:
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
newMode = gui_SettingsMenu(getButtonState(), &context);
|
newMode = gui_SettingsMenu(getButtonState(), &context);
|
||||||
#else
|
#else
|
||||||
newMode = gui_SettingsMenu(getButtonState(d), &context);
|
newMode = gui_SettingsMenu(getButtonState(d), &context);
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
|
|||||||
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
||||||
bool isFlipped = OLED::getRotation();
|
bool isFlipped = OLED::getRotation();
|
||||||
bool tipDisconnected = isTipDisconnected();
|
bool tipDisconnected = isTipDisconnected();
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
bool swapButtonMenu = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flip and switch buttons accordingly
|
// Flip and switch buttons accordingly
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? (isReverse ? buttonBF : buttonAF) : (isReverse ? buttonB : buttonA));
|
OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? (swapButtonMenu ? buttonBF : buttonAF) : (swapButtonMenu ? buttonB : buttonA));
|
||||||
OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? (isReverse ? buttonAF : buttonBF) : (isReverse ? buttonA : buttonB));
|
OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? (swapButtonMenu ? buttonAF : buttonBF) : (swapButtonMenu ? buttonA : buttonB));
|
||||||
#else
|
#else
|
||||||
OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? buttonAF : buttonA);
|
OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? buttonAF : buttonA);
|
||||||
OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? buttonBF : buttonB);
|
OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? buttonBF : buttonB);
|
||||||
@@ -26,9 +26,9 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
// draw temp over the start soldering button
|
// draw temp over the start soldering button
|
||||||
// Location changes on screen rotation and due to button swapping
|
// Location changes on screen rotation and due to button swapping
|
||||||
// in right handed mode we want to draw over the first part
|
// in right handed mode we want to draw over the first part
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
OLED::fillArea(isReverse ? (isFlipped ? 26 : 58) : (isFlipped ? 68 : 0), 0, 56, 32, 0); // clear the area
|
OLED::fillArea(swapButtonMenu ? (isFlipped ? 26 : 58) : (isFlipped ? 68 : 0), 0, 56, 32, 0); // clear the area
|
||||||
OLED::setCursor(isReverse ? (isFlipped ? 27 : 59) : (isFlipped ? 56 : 0), 0);
|
OLED::setCursor(swapButtonMenu ? (isFlipped ? 27 : 59) : (isFlipped ? 56 : 0), 0);
|
||||||
#else
|
#else
|
||||||
OLED::fillArea(isFlipped ? 68 : 0, 0, 56, 32, 0); // clear the area
|
OLED::fillArea(isFlipped ? 68 : 0, 0, 56, 32, 0); // clear the area
|
||||||
OLED::setCursor(isFlipped ? 56 : 0, 0);
|
OLED::setCursor(isFlipped ? 56 : 0, 0);
|
||||||
@@ -36,13 +36,13 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
// If tip is disconnected draw the notification, otherwise - the temp
|
// If tip is disconnected draw the notification, otherwise - the temp
|
||||||
if (tipDisconnected) {
|
if (tipDisconnected) {
|
||||||
// Draw-in the missing tip symbol
|
// Draw-in the missing tip symbol
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
if (isReverse) {
|
if (swapButtonMenu) {
|
||||||
OLED::drawArea(isFlipped ? 20 : 54, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
|
OLED::drawArea(isFlipped ? 20 : 54, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
OLED::drawArea(isFlipped ? 54 : 0, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
|
OLED::drawArea(isFlipped ? 54 : 0, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
|
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
|
|||||||
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
||||||
bool isFlipped = OLED::getRotation();
|
bool isFlipped = OLED::getRotation();
|
||||||
bool tipDisconnected = isTipDisconnected();
|
bool tipDisconnected = isTipDisconnected();
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
bool swapButtonMenu = getSettingValue(SettingsOptions::ReverseButtonMenu);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Flip and switch buttons accordingly
|
// Flip and switch buttons accordingly
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? (isReverse ? buttonBF : buttonAF) : (isReverse ? buttonB : buttonA));
|
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? (swapButtonMenu ? buttonBF : buttonAF) : (swapButtonMenu ? buttonB : buttonA));
|
||||||
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? (isReverse ? buttonAF : buttonBF) : (isReverse ? buttonA : buttonB));
|
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? (swapButtonMenu ? buttonAF : buttonBF) : (swapButtonMenu ? buttonA : buttonB));
|
||||||
#else
|
#else
|
||||||
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? buttonAF : buttonA);
|
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? buttonAF : buttonA);
|
||||||
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? buttonBF : buttonB);
|
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? buttonBF : buttonB);
|
||||||
@@ -25,9 +25,9 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
// draw temp over the start soldering button
|
// draw temp over the start soldering button
|
||||||
// Location changes on screen rotation and due to button swapping
|
// Location changes on screen rotation and due to button swapping
|
||||||
// in right handed mode we want to draw over the first part
|
// in right handed mode we want to draw over the first part
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
OLED::fillArea(isReverse ? (isFlipped ? 14 : 42) : (isFlipped ? 55 : 0), 0, 41, 16, 0); // clear the area
|
OLED::fillArea(swapButtonMenu ? (isFlipped ? 14 : 42) : (isFlipped ? 55 : 0), 0, 41, 16, 0); // clear the area
|
||||||
OLED::setCursor(isReverse ? (isFlipped ? 15 : 43) : (isFlipped ? 56 : 0), 0);
|
OLED::setCursor(swapButtonMenu ? (isFlipped ? 15 : 43) : (isFlipped ? 56 : 0), 0);
|
||||||
#else
|
#else
|
||||||
OLED::fillArea(isFlipped ? 55 : 0, 0, 41, 16, 0); // clear the area
|
OLED::fillArea(isFlipped ? 55 : 0, 0, 41, 16, 0); // clear the area
|
||||||
OLED::setCursor(isFlipped ? 56 : 0, 0);
|
OLED::setCursor(isFlipped ? 56 : 0, 0);
|
||||||
@@ -35,13 +35,13 @@ void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
|
|||||||
// If tip is disconnected draw the notification, otherwise - the temp
|
// If tip is disconnected draw the notification, otherwise - the temp
|
||||||
if (tipDisconnected) {
|
if (tipDisconnected) {
|
||||||
// Draw-in the missing tip symbol
|
// Draw-in the missing tip symbol
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
if (isReverse) {
|
if (swapButtonMenu) {
|
||||||
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
|
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
|
||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
|
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
|
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ bool shouldShutdown(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef REVERSE_NAV_EVERYWHERE
|
#ifdef OPT_FULL_BUTTON_REVERSE
|
||||||
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonMenu) == BUTTON_B_LONG) { // allow also if back button is pressed long
|
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonMenu) == BUTTON_B_LONG) { // allow also if back button is pressed long
|
||||||
#else
|
#else
|
||||||
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
|
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
|
||||||
|
|||||||
Reference in New Issue
Block a user