Requested change

Now it flips buttons only in menu by default, however i need the other option, so i've added definition "REVERSE_NAV_EVERYWHERE"
This commit is contained in:
resistancelion
2025-01-30 18:30:08 +02:00
parent 68116f7de2
commit e346a7793e
4 changed files with 51 additions and 3 deletions

View File

@@ -45,9 +45,13 @@ OperatingMode guiHandleDraw(void) {
OLED::clearScreen(); // Clear ready for render pass
bool d = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
bool e = getSettingValue(SettingsOptions::ReverseButtonTempChangeEnabled);
#ifdef REVERSE_NAV_EVERYWHERE
bool f = currentOperatingMode == OperatingMode::TemperatureAdjust;
// Read button state
ButtonState buttons = getButtonState((e && f) || (d && !e && !f) || (d && e && !f));
#else
ButtonState buttons = getButtonState();
#endif
// Enforce screen on if buttons pressed, movement, hot tip etc
if (buttons != BUTTON_NONE) {
OLED::setDisplayState(OLED::DisplayState::ON);
@@ -113,7 +117,11 @@ OperatingMode guiHandleDraw(void) {
newMode = gui_SolderingSleepingMode(buttons, &context);
break;
case OperatingMode::TemperatureAdjust:
newMode = gui_solderingTempAdjust(buttons, &context);
#ifdef REVERSE_NAV_EVERYWHERE
newMode = gui_solderingTempAdjust(getButtonState(), &context);
#else
newMode = gui_solderingTempAdjust(getButtonState(e), &context);
#endif
break;
case OperatingMode::DebugMenuReadout:
newMode = showDebugMenu(buttons, &context);
@@ -122,7 +130,11 @@ OperatingMode guiHandleDraw(void) {
newMode = performCJCC(buttons, &context);
break;
case OperatingMode::SettingsMenu:
newMode = gui_SettingsMenu(buttons, &context);
#ifdef REVERSE_NAV_EVERYWHERE
newMode = gui_SettingsMenu(getButtonState(), &context);
#else
newMode = gui_SettingsMenu(getButtonState(d), &context);
#endif
break;
case OperatingMode::InitialisationDone:
newMode = handle_post_init_state();

View File

@@ -8,27 +8,43 @@ extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
bool isFlipped = OLED::getRotation();
#ifdef REVERSE_NAV_EVERYWHERE
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
#endif
bool tipDisconnected = isTipDisconnected();
// Flip and switch buttons accordingly
#ifdef REVERSE_NAV_EVERYWHERE
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));
#else
OLED::drawArea(isFlipped ? 68 : 0, 0, 56, 32, isFlipped ? buttonAF : buttonA);
OLED::drawArea(isFlipped ? 12 : 58, 0, 56, 32, isFlipped ? buttonBF : buttonB);
#endif
if ((tipTemp > 55) || tipDisconnected) {
// draw temp over the start soldering button
// Location changes on screen rotation and due to button swapping
// in right handed mode we want to draw over the first part
#ifdef REVERSE_NAV_EVERYWHERE
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);
#else
OLED::fillArea(isFlipped ? 68 : 0, 0, 56, 32, 0); // clear the area
OLED::setCursor(isFlipped ? 56 : 0, 0);
#endif
// If tip is disconnected draw the notification, otherwise - the temp
if (tipDisconnected) {
// Draw-in the missing tip symbol
#ifdef REVERSE_NAV_EVERYWHERE
if (isReverse) {
OLED::drawArea(isFlipped ? 20 : 54, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
} else {
#endif
OLED::drawArea(isFlipped ? 54 : 0, 0, 56, 32, isFlipped ? disconnectedTipF : disconnectedTip);
#ifdef REVERSE_NAV_EVERYWHERE
}
#endif
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
ui_draw_tip_temperature(false, FontStyle::LARGE); // Draw-in the temp
}

View File

@@ -7,27 +7,43 @@ extern uint8_t disconnectedTipF[sizeof(disconnectedTip)];
void ui_draw_homescreen_simplified(TemperatureType_t tipTemp) {
bool isFlipped = OLED::getRotation();
#ifdef REVERSE_NAV_EVERYWHERE
bool isReverse = getSettingValue(SettingsOptions::ReverseButtonNavEnabled);
#endif
bool tipDisconnected = isTipDisconnected();
// Flip and switch buttons accordingly
#ifdef REVERSE_NAV_EVERYWHERE
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? (isReverse ? buttonBF : buttonAF) : (isReverse ? buttonB : buttonA));
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? (isReverse ? buttonAF : buttonBF) : (isReverse ? buttonA : buttonB));
#else
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? buttonAF : buttonA);
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? buttonBF : buttonB);
#endif
if ((tipTemp > 55) || tipDisconnected) {
// draw temp over the start soldering button
// Location changes on screen rotation and due to button swapping
// in right handed mode we want to draw over the first part
#ifdef REVERSE_NAV_EVERYWHERE
OLED::fillArea(isReverse ? (isFlipped ? 14 : 42) : (isFlipped ? 55 : 0), 0, 41, 16, 0); // clear the area
OLED::setCursor(isReverse ? (isFlipped ? 15 : 43) : (isFlipped ? 56 : 0), 0);
#else
OLED::fillArea(isFlipped ? 55 : 0, 0, 41, 16, 0); // clear the area
OLED::setCursor(isFlipped ? 56 : 0, 0);
#endif
// If tip is disconnected draw the notification, otherwise - the temp
if (tipDisconnected) {
// Draw-in the missing tip symbol
#ifdef REVERSE_NAV_EVERYWHERE
if (isReverse) {
OLED::drawArea(isFlipped ? 12 : 42, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
} else {
#endif
OLED::drawArea(isFlipped ? 54 : 0, 0, 42, 16, isFlipped ? disconnectedTipF : disconnectedTip);
#ifdef REVERSE_NAV_EVERYWHERE
}
#endif
} else if (!(getSettingValue(SettingsOptions::CoolingTempBlink) && (xTaskGetTickCount() % 1000 < 300))) {
ui_draw_tip_temperature(false, FontStyle::LARGE); // Draw-in the temp
}

View File

@@ -17,7 +17,11 @@ bool shouldShutdown(void) {
}
}
}
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonNavEnabled)) == BUTTON_B_LONG) { // allow also if back button is pressed long
#ifdef REVERSE_NAV_EVERYWHERE
if (getButtonState(getSettingValue(SettingsOptions::ReverseButtonNavEnabled) == BUTTON_B_LONG) { // allow also if back button is pressed long
#else
if (getButtonState() == BUTTON_B_LONG) { // allow also if back button is pressed long
#endif
return true;
}
return false;