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);
|
||||
Reference in New Issue
Block a user