Calibrate touch from serial logs: invert physical X axis.
Bottom LVGL buttons were mapped to the top; add on-screen logic coordinate debug. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
19
src/ui.cpp
19
src/ui.cpp
@@ -13,6 +13,7 @@ static lv_obj_t *btn_speaker;
|
||||
static lv_obj_t *btn_play;
|
||||
static lv_obj_t *lbl_speaker;
|
||||
static lv_obj_t *lbl_play;
|
||||
static lv_obj_t *lbl_touch_dbg;
|
||||
|
||||
static lv_obj_t *make_row(lv_obj_t *parent, const char *title, lv_obj_t **value_out) {
|
||||
lv_obj_t *row = lv_obj_create(parent);
|
||||
@@ -149,9 +150,27 @@ void ui_create() {
|
||||
lv_obj_set_style_text_font(lbl_play, &lv_font_montserrat_14, 0);
|
||||
lv_obj_center(lbl_play);
|
||||
|
||||
lbl_touch_dbg = lv_label_create(col);
|
||||
lv_label_set_text(lbl_touch_dbg, "Touch: --");
|
||||
lv_obj_set_style_text_font(lbl_touch_dbg, &lv_font_montserrat_14, 0);
|
||||
lv_obj_set_style_text_color(lbl_touch_dbg, lv_color_hex(0xFFB74D), 0);
|
||||
|
||||
ui_refresh_audio_buttons();
|
||||
}
|
||||
|
||||
void ui_set_touch_debug(int16_t lx, int16_t ly, bool down) {
|
||||
if (!lbl_touch_dbg) {
|
||||
return;
|
||||
}
|
||||
if (!down) {
|
||||
lv_label_set_text(lbl_touch_dbg, "Touch: up");
|
||||
return;
|
||||
}
|
||||
char buf[40];
|
||||
snprintf(buf, sizeof(buf), "Touch L:%d,%d", (int)lx, (int)ly);
|
||||
lv_label_set_text(lbl_touch_dbg, buf);
|
||||
}
|
||||
|
||||
void ui_update(const SdCardInfo &info) {
|
||||
if (!info.mounted || !info.present) {
|
||||
lv_label_set_text(lbl_status, info.error.length() ? info.error.c_str() : "Fail");
|
||||
|
||||
Reference in New Issue
Block a user