lilygo_t_display_s3: fix keyboard handling

This commit is contained in:
Thomas Farstrike
2026-02-24 00:10:09 +01:00
parent 51056eaad9
commit 29a5465992
2 changed files with 22 additions and 5 deletions
@@ -121,14 +121,29 @@ def keypad_read_cb(indev, data):
dt_b = time.ticks_diff(current_time, last_b_down_time) if last_b_down_time else None
print(f"combo guard: a={btn_a_pressed} b={btn_b_pressed} near={near_simul} wait={single_press_wait} dt_a={dt_a} dt_b={dt_b}")
# While in an on-screen keyboard, PREV button is LEFT and NEXT button is RIGHT
focus_group = lv.group_get_default()
focus_keyboard = False
if focus_group:
current_focused = focus_group.get_focused()
if isinstance(current_focused, lv.keyboard):
#print("focus is on a keyboard")
focus_keyboard = True
if near_simul:
current_key = lv.KEY.ENTER
elif single_press_wait:
current_key = None
elif btn_a_pressed:
current_key = lv.KEY.PREV
if focus_keyboard:
current_key = lv.KEY.LEFT
else:
current_key = lv.KEY.PREV
elif btn_b_pressed:
current_key = lv.KEY.NEXT
if focus_keyboard:
current_key = lv.KEY.RIGHT
else:
current_key = lv.KEY.NEXT
else:
current_key = None
+5 -3
View File
@@ -184,9 +184,11 @@ def custom_exception_handler(e):
sys.print_exception(e) # NOQA
# No need to deinit() and re-init LVGL:
#mpos.ui.task_handler.deinit() # default task handler does this, but then things hang
# otherwise it does focus_next and then crashes while doing lv.deinit()
#focusgroup.remove_all_objs()
#focusgroup.delete()
#focusgroup = lv.group_get_default()
#if focusgroup: # on esp32 this may not be set
# otherwise it does focus_next and then crashes while doing lv.deinit()
#focusgroup.remove_all_objs()
#focusgroup.delete()
#lv.deinit()
import sys