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

@@ -2,12 +2,21 @@
在 **2.8" / 3.5" CYD** 上显示当前电脑的 **CPU、GPU、内存、磁盘** 等主要信息。显示/触控骨架对齐 [tftest](../tftest) / [wifitest](../wifitest);板型差异按 [CYD_PROJECT_GUIDE.md](../CYD_PROJECT_GUIDE.md)。
| 板型 | env | 屏 / 触控 | 背光 |
|------|-----|-----------|------|
| **2.8" · 2432S028R** | `cyd`(默认) | ILI9341 + XPT2046 SoftSPI | GPIO**21** |
| **3.5" · 3248S035C** | `cyd_35r` | ST7796 + GT911 I2C | GPIO**27** |
| 板型 | env | 屏 / 触控 | 背光 | 刷写目录 |
|------|-----|-----------|------|----------|
| **2.8" · 2432S028R** | `cyd`(默认) | ILI9341 + XPT2046 SoftSPI · UI 320×240 | GPIO**21** | [`firmware/cyd/`](firmware/cyd/) |
| **3.5" · 3248S035C** | `cyd_35r` | ST7796 + GT911 I2C · UI 480×320(`UX/UY` 缩放) | GPIO**27** | [`firmware/cyd_35r/`](firmware/cyd_35r/) |
本工程**无外设接线**(只吃 USB 供电 + 串口)。
本工程**无外设接线**(只吃 USB 供电 + 串口)。主机 `send_sysinfo` **与板型无关**(同一 SI 协议)。
**认板再刷**:2.8 / 3.5 固件不可互刷(BL / 屏驱 / 触控全不同)。3.5:
```powershell
pio run -e cyd_35r -t upload
# 或
cd firmware\cyd_35r
.\flash.ps1
```
## 原理

View File

@@ -1,5 +1,5 @@
name: CYD serverinfotest (cyd)
git: 683d0f2
git: f83df3f
date: 2026-10-27
board: ESP32-2432S028R (ILI9341)
flash_size: 4MB
@@ -11,5 +11,5 @@ offsets:
sha256:
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
firmware.bin 85838702F4062A3679CAE17D0365B1E14DDBB4C3BA235A0A6500FDDB84A56B6A
firmware.bin C37191D2A95FDA84053DDB2F6BF3EE42ADF1C7C1527495284DD071EB9E7B1863
partitions.bin 148B959CBFF1C38AA8E1D5C0BA9D612C54997B945E56A63F41223EEF650653A1

Binary file not shown.

View File

@@ -1,5 +1,5 @@
name: CYD serverinfotest (cyd_35r)
git: unknown
git: f83df3f
date: 2026-10-27
board: ESP32-3248S035 (ST7796)
flash_size: 4MB
@@ -11,5 +11,5 @@ offsets:
sha256:
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
firmware.bin 93C0D8E2A7C31848960C2DBA2894DE9D18BF21D3D94B47DDD5406CF18A1FD1B3
firmware.bin 8B3BA7D83EE4180FE18E8E3E78EFCB88906B1DCDD86043D3A807E6C8A4B40460
partitions.bin 148B959CBFF1C38AA8E1D5C0BA9D612C54997B945E56A63F41223EEF650653A1

Binary file not shown.

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);