Add CYD host PC info panel with serial SI protocol and LVGL bars.
ESP32 shows CPU/GPU/RAM/disk from host/send_sysinfo.ps1 over USB; firmware packages for 2.8 and 3.5 included. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
29
include/host_info.h
Normal file
29
include/host_info.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** Max chars for hostname / CPU / GPU name shown on UI. */
|
||||
static constexpr int HOST_NAME_MAX = 40;
|
||||
static constexpr int HOST_CPU_MAX = 48;
|
||||
static constexpr int HOST_GPU_MAX = 48;
|
||||
|
||||
struct HostInfo {
|
||||
char host[HOST_NAME_MAX];
|
||||
char cpu[HOST_CPU_MAX];
|
||||
char gpu[HOST_GPU_MAX];
|
||||
float cpu_pct; // 0..100
|
||||
float gpu_pct; // 0..100, -1 if unknown
|
||||
float ram_used_gb;
|
||||
float ram_total_gb;
|
||||
float disk_used_gb;
|
||||
float disk_total_gb;
|
||||
bool valid;
|
||||
uint32_t updated_ms;
|
||||
};
|
||||
|
||||
void host_info_begin();
|
||||
/** Poll USB Serial for SI|... lines; return true if a packet was applied. */
|
||||
bool host_info_poll();
|
||||
const HostInfo &host_info_get();
|
||||
/** True if last packet is fresher than stale_ms. */
|
||||
bool host_info_is_live(uint32_t stale_ms = 5000);
|
||||
1127
include/lv_conf.h
Normal file
1127
include/lv_conf.h
Normal file
File diff suppressed because it is too large
Load Diff
42
include/pins.h
Normal file
42
include/pins.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
// Board pins — 2.8" default; 3.5" when CYD_BOARD_3248S035 is set (env:cyd_35r)
|
||||
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define TFT_BL_PIN 27
|
||||
#define SCREEN_WIDTH 320
|
||||
#define SCREEN_HEIGHT 480
|
||||
#define UI_HOR_RES 480
|
||||
#define UI_VER_RES 320
|
||||
/* 3.5C capacitive GT911 (ESP32-3248S035C). GPIO33 is I2C SDA, not TOUCH_CS.
|
||||
* Backlight is GPIO27; INT is GPIO21 — they are NOT the same pin. */
|
||||
#define CYD_GT911_SDA 33
|
||||
#define CYD_GT911_SCL 32
|
||||
#define CYD_GT911_INT 21
|
||||
#define CYD_GT911_RST 25
|
||||
#else
|
||||
#define TFT_BL_PIN 21
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
#define UI_HOR_RES 320
|
||||
#define UI_VER_RES 240
|
||||
/* 2.8" CYD: dedicated SoftSPI touch bus. */
|
||||
#define CYD_TOUCH_IRQ 36
|
||||
#define CYD_TOUCH_MOSI 32
|
||||
#define CYD_TOUCH_MISO 39
|
||||
#define CYD_TOUCH_CLK 25
|
||||
#define CYD_TOUCH_CS 33
|
||||
#endif
|
||||
|
||||
/* Map 320x240 design coordinates onto the active UI resolution (identity on 2.8"). */
|
||||
#define UX(x) ((int)(((long)(x) * (UI_HOR_RES)) / 320))
|
||||
#define UY(y) ((int)(((long)(y) * (UI_VER_RES)) / 240))
|
||||
#define UW(w) UX(w)
|
||||
#define UH(h) UY(h)
|
||||
|
||||
/* Partial frame buffer: 3.5 needs smaller ratio to fit DRAM. */
|
||||
#if defined(CYD_BOARD_3248S035)
|
||||
#define DRAW_BUF_DIV 20
|
||||
#else
|
||||
#define DRAW_BUF_DIV 10
|
||||
#endif
|
||||
7
include/touch.h
Normal file
7
include/touch.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
#include <stdint.h>
|
||||
|
||||
void touch_init();
|
||||
void touch_read_cb(lv_indev_t *indev, lv_indev_data_t *data);
|
||||
4
include/ui.h
Normal file
4
include/ui.h
Normal file
@@ -0,0 +1,4 @@
|
||||
#pragma once
|
||||
|
||||
void ui_create();
|
||||
void ui_tick();
|
||||
Reference in New Issue
Block a user