Skip to content

Conversation

@oroderico
Copy link
Contributor

Summary

This PR fixes a Waveshare S3–specific UI regression where the touch navigation bar (H / J / I) becomes invisible or logically misaligned after toggling Flip Orientation.
All reviewer feedback has been fully addressed and incorporated, resulting in a cleaner, safer, and fully aligned implementation.

The solution remains strictly scoped to CONFIG_BOARD_TYPE_WS_TOUCH_LCD2, ensuring zero impact on all other Jade targets.


What’s fixed

  • Reliable redraw of the touch navbar (H / J / I)

    • display_touch_navbar_redraw() is now declared unconditionally in display.h, as requested.
    • Board-specific behavior is handled inside the function body (display.c) and gated by CONFIG_BOARD_TYPE_WS_TOUCH_LCD2.
    • The navbar is explicitly redrawn:
      • on display initialization
      • immediately after toggling Flip Orientation
        On non-Waveshare boards, the function safely compiles to a no-op.
  • Clean orientation handling without ifdefs in callers

    • gui_set_flipped_orientation() now follows the reviewer-suggested pattern:
      • compares against display_flip_orientation(flipped_orientation)
      • toggles the local orientation flag only when it changes
      • calls display_touch_navbar_redraw() unconditionally
        This removes preprocessor conditionals from the call site and keeps control flow clear.
  • Correct touch hit-zone on Waveshare S3

    • The navbar touch area is now defined as a const uint16_t inside the WS_TOUCH_LCD2 block, as requested.
    • Touch input logic respects orientation:
      • Normal orientation: navbar active zone at the bottom
      • Flipped orientation: navbar active zone at the top
        This keeps Prev / OK / Next perfectly aligned with the rendered navbar.
  • No behavioral change for other devices

    • Existing y > 200 touch logic is preserved for non-Waveshare boards
    • Shared helpers for T-Watch / M5 remain intact
    • No regressions or behavior changes outside WS_TOUCH_LCD2

Why this is needed

On Waveshare S3, flipping the display orientation correctly rotates the framebuffer, but:

  • the touch navbar was not being redrawn, causing it to disappear
  • the touch hit-zone remained fixed, leading to inverted or “ghost” navigation behavior

This PR resolves the visual and logical desynchronization between rendering and touch input, while also aligning the implementation with reviewer guidance on structure, visibility, and cleanliness.


Scope & Safety

  • Hard-scoped to CONFIG_BOARD_TYPE_WS_TOUCH_LCD2
  • Reviewer-requested structural changes applied:
    • unconditional symbol visibility
    • no ifdefs in GUI control flow
    • const-correct touch parameters
  • Other boards:
    • redraw helper is a no-op
    • touch logic remains untouched
  • No changes to shared rendering or generic touchscreen code paths

Files changed

  • main/display.c
  • main/display.h
  • main/gui.c
  • main/input/touchscreen.inc

Expected behavior

Waveshare ESP32-S3 LCD Touch (WS_TOUCH_LCD2)

  • Touch navbar is always visible:
    • on boot
    • after Flip Orientation
  • Touch regions match the rendered navbar:
    • Prev / OK / Next behave correctly in both orientations

All other devices

  • No visual or functional changes
  • Existing behavior preserved 100%

Notes

All reviewer comments were addressed and implemented in this revision.
The final solution preserves board isolation, improves code clarity, and avoids unnecessary preprocessor usage while fixing the original UI regression safely.

If future boards require similar behavior, they should opt-in via their own board-specific configuration rather than sharing this path implicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant