Files
serverinfotest/include/host_info.h
DESKTOP-PUHFO60\dsx2016 f724796359 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>
2026-10-27 20:13:09 +08:00

30 lines
784 B
C

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