Harden 3.5 CYD support: GT911 reset, larger UI, dual firmware export.

Align touch init with wifitest; scale fonts/bars for 480x320; refresh firmware/cyd and firmware/cyd_35r packages.
This commit is contained in:
2026-10-27 20:26:57 +08:00
parent f83df3fd39
commit 0679d84500
7 changed files with 43 additions and 24 deletions

View File

@@ -101,15 +101,15 @@ void touch_init() {
Wire.setTimeOut(50);
#endif
/* Always hw-reset: probe-only leaves some boards with stuck buffer / bad INT. */
Serial.println("GT911 hw reset 0x5D");
gt_hw_reset(false);
if (!gt_find_addr()) {
Serial.println("GT911 not found — hw reset 0x5D");
gt_hw_reset(false);
if (!gt_find_addr()) {
Serial.println("GT911 not found — hw reset 0x14");
gt_hw_reset(true);
gt_find_addr();
}
Serial.println("GT911 not found — hw reset 0x14");
gt_hw_reset(true);
gt_find_addr();
}
gt_write8(GT_POINT_INFO, 0);
Serial.printf("GT911 probe 0x5D=%s 0x14=%s using=0x%02X\n",
gt_probe(0x5D) ? "OK" : "no", gt_probe(0x14) ? "OK" : "no",

View File

@@ -17,6 +17,16 @@ static constexpr uint32_t COL_BAD = 0xE85D4C;
static constexpr uint32_t COL_ACCENT = 0x4FC3F7;
static constexpr uint32_t COL_BAR_BG = 0x162230;
#if defined(CYD_BOARD_3248S035)
static const lv_font_t *font_title = &lv_font_montserrat_20;
static const lv_font_t *font_body = &lv_font_montserrat_16;
static constexpr int BAR_H = 14;
#else
static const lv_font_t *font_title = &lv_font_montserrat_18;
static const lv_font_t *font_body = &lv_font_montserrat_14;
static constexpr int BAR_H = 10;
#endif
struct MetricRow {
lv_obj_t *lbl_tag;
lv_obj_t *lbl_name;
@@ -76,7 +86,7 @@ static MetricRow make_row(lv_obj_t *parent, const char *tag, int y) {
r.lbl_tag = lv_label_create(parent);
lv_label_set_text(r.lbl_tag, tag);
lv_obj_set_style_text_color(r.lbl_tag, lv_color_hex(COL_ACCENT), 0);
lv_obj_set_style_text_font(r.lbl_tag, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_font(r.lbl_tag, font_body, 0);
lv_obj_set_pos(r.lbl_tag, UX(8), UY(y));
r.lbl_name = lv_label_create(parent);
@@ -84,17 +94,17 @@ static MetricRow make_row(lv_obj_t *parent, const char *tag, int y) {
lv_label_set_long_mode(r.lbl_name, LV_LABEL_LONG_DOT);
lv_obj_set_width(r.lbl_name, UW(190));
lv_obj_set_style_text_color(r.lbl_name, lv_color_hex(COL_INK), 0);
lv_obj_set_style_text_font(r.lbl_name, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_font(r.lbl_name, font_body, 0);
lv_obj_set_pos(r.lbl_name, UX(52), UY(y));
r.lbl_pct = lv_label_create(parent);
lv_label_set_text(r.lbl_pct, "--%");
lv_obj_set_style_text_color(r.lbl_pct, lv_color_hex(COL_MUTED), 0);
lv_obj_set_style_text_font(r.lbl_pct, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_font(r.lbl_pct, font_body, 0);
lv_obj_align(r.lbl_pct, LV_ALIGN_TOP_RIGHT, UX(-8), UY(y));
r.bar = lv_bar_create(parent);
lv_obj_set_size(r.bar, UI_HOR_RES - UW(16), UH(10));
lv_obj_set_size(r.bar, UI_HOR_RES - UW(16), UH(BAR_H));
lv_obj_set_pos(r.bar, UX(8), UY(y + 18));
style_bar(r.bar);
@@ -126,21 +136,21 @@ void ui_create() {
lbl_title = lv_label_create(scr);
lv_label_set_text(lbl_title, "PC Monitor");
lv_obj_set_style_text_color(lbl_title, lv_color_hex(COL_INK), 0);
lv_obj_set_style_text_font(lbl_title, &lv_font_montserrat_18, 0);
lv_obj_set_style_text_font(lbl_title, font_title, 0);
lv_obj_set_pos(lbl_title, UX(8), UY(6));
lbl_status = lv_label_create(scr);
lv_label_set_text(lbl_status, "waiting");
lv_obj_set_style_text_color(lbl_status, lv_color_hex(COL_WARN), 0);
lv_obj_set_style_text_font(lbl_status, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_font(lbl_status, font_body, 0);
lv_obj_align(lbl_status, LV_ALIGN_TOP_RIGHT, UX(-8), UY(8));
lbl_host = lv_label_create(scr);
lv_label_set_text(lbl_host, "Connect USB + run host script");
lv_label_set_text(lbl_host, "Plug USB + host/run.bat");
lv_label_set_long_mode(lbl_host, LV_LABEL_LONG_DOT);
lv_obj_set_width(lbl_host, UI_HOR_RES - UW(16));
lv_obj_set_style_text_color(lbl_host, lv_color_hex(COL_MUTED), 0);
lv_obj_set_style_text_font(lbl_host, &lv_font_montserrat_14, 0);
lv_obj_set_style_text_font(lbl_host, font_body, 0);
lv_obj_set_pos(lbl_host, UX(8), UY(28));
lv_obj_t *line = lv_obj_create(scr);