Skip to content

Debug Tapping Not Always Reliable #2

@ajlennon

Description

@ajlennon

Debug Tapping Not Always Reliable

Problem

The debug tap-to-navigate features (DEBUG_QR_TAP_TO_POUR, DEBUG_POURING_TAP_TO_FINISHED, DEBUG_FINISHED_TAP_TO_QR) are not always reliable. Tapping on screens sometimes doesn't trigger the expected transitions.

Affected Features

  • QR Code Screen → Pouring Screen: DEBUG_QR_TAP_TO_POUR
  • Pouring Screen → Finished Screen: DEBUG_POURING_TAP_TO_FINISHED
  • Finished Screen → QR Code Screen: DEBUG_FINISHED_TAP_TO_QR

Symptoms

  • Tapping on QR code doesn't always transition to pouring screen
  • Tapping on pouring screen doesn't always transition to finished screen
  • Tapping on finished screen doesn't always transition to QR code screen
  • Sometimes requires multiple taps to trigger transition
  • Touch events may be logged but transitions don't occur

Current Implementation

  • QR code screen uses lv_obj_hit_test() and fallback logic for content area clicks
  • Pouring screen uses screen-level touch handler
  • Finished screen uses screen-level touch handler
  • All use LV_EVENT_CLICKED event

Possible Causes

  1. Touch event timing: Events may be missed during screen transitions or LVGL rendering
  2. Object hierarchy: Touch events may be captured by child objects before reaching screen handler
  3. LVGL event propagation: Events may not propagate correctly through the object tree
  4. Coordinate space issues: Touch coordinates may not match object bounds correctly
  5. Race conditions: Screen cleanup/initialization may interfere with touch handling
  6. Event handler registration: Handlers may not be registered at the right time or on the right objects

Expected Behavior

  • Single tap should reliably trigger screen transition when debug option is enabled
  • Touch should work consistently across all debug-enabled screens
  • No need for multiple taps or specific tap locations

Steps to Reproduce

  1. Enable debug options via idf.py menuconfig:
    • DEBUG_QR_TAP_TO_POUR=y
    • DEBUG_POURING_TAP_TO_FINISHED=y
    • DEBUG_FINISHED_TAP_TO_QR=y
  2. Build and flash firmware
  3. Navigate to QR code screen
  4. Tap on QR code - may require multiple taps
  5. Navigate to pouring screen (via tap or MQTT)
  6. Tap on pouring screen - may require multiple taps
  7. Navigate to finished screen (via tap or max volume)
  8. Tap on finished screen - may require multiple taps

Investigation Needed

  • Review touch event handling in each screen
  • Check if touch events are being captured by child objects
  • Verify event handler registration timing
  • Test with different touch coordinates and pressures
  • Check for conflicts with base screen touch handling
  • Review LVGL event propagation behavior
  • Consider using LV_EVENT_PRESSED or LV_EVENT_RELEASED instead of LV_EVENT_CLICKED
  • Add more detailed logging for touch events
  • Test touch handling during screen transitions

Potential Solutions

  1. Use LV_EVENT_PRESSED instead of LV_EVENT_CLICKED for more immediate response
  2. Add touch event handlers to multiple objects (screen, content area, specific widgets)
  3. Implement touch debouncing or state tracking
  4. Ensure event handlers are registered after all objects are created
  5. Use lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE) explicitly on all touchable objects
  6. Add touch event forwarding from child objects to parent
  7. Implement a unified touch handler system for all debug screens

Related Code

  • src/qr_code_screen.cpp - QR code touch handler
  • src/pouring_screen.cpp - Pouring screen touch handler
  • src/finished_screen.cpp - Finished screen touch handler
  • src/base_screen.cpp - Base screen layout (may interfere with touch)

Priority

Medium - Debug feature, doesn't affect production functionality but impacts development/debugging workflow.

Labels

  • bug
  • debug
  • ui
  • touch
  • enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdebugDebugging and development featuresenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions