new layout + 200px status images
This commit is contained in:
@@ -19,9 +19,9 @@ static const char *TAG = "audio_client";
|
|||||||
#define WS_BUFFER_SIZE 8192
|
#define WS_BUFFER_SIZE 8192
|
||||||
|
|
||||||
/* Status image constants */
|
/* Status image constants */
|
||||||
#define STATUS_IMG_W 120
|
#define STATUS_IMG_W 200
|
||||||
#define STATUS_IMG_H 120
|
#define STATUS_IMG_H 200
|
||||||
#define STATUS_IMG_BYTES (STATUS_IMG_W * STATUS_IMG_H / 8) /* 1800 */
|
#define STATUS_IMG_BYTES (STATUS_IMG_W * STATUS_IMG_H / 8) /* 5000 */
|
||||||
|
|
||||||
static esp_websocket_client_handle_t s_client = NULL;
|
static esp_websocket_client_handle_t s_client = NULL;
|
||||||
static CodecPort *s_codec = NULL;
|
static CodecPort *s_codec = NULL;
|
||||||
|
|||||||
@@ -227,12 +227,12 @@ static void create_time_bar(lv_obj_t *parent)
|
|||||||
|
|
||||||
static void create_main_section(lv_obj_t *parent)
|
static void create_main_section(lv_obj_t *parent)
|
||||||
{
|
{
|
||||||
/* === Left column: Services === */
|
/* === Left column: Services + Pi Vitals === */
|
||||||
create_label(parent, 4, MAIN_Y + 2, &InziuIosevka_Slab_CC_12px, "SERVICES");
|
create_label(parent, 4, MAIN_Y + 2, &InziuIosevka_Slab_CC_12px, "SERVICES");
|
||||||
|
|
||||||
tbl_services = lv_table_create(parent);
|
tbl_services = lv_table_create(parent);
|
||||||
lv_obj_set_pos(tbl_services, 4, MAIN_Y + 16);
|
lv_obj_set_pos(tbl_services, 4, MAIN_Y + 16);
|
||||||
lv_obj_set_size(tbl_services, 190, 180);
|
lv_obj_set_size(tbl_services, 190, 68);
|
||||||
lv_table_set_col_cnt(tbl_services, 2);
|
lv_table_set_col_cnt(tbl_services, 2);
|
||||||
lv_table_set_col_width(tbl_services, 0, 110);
|
lv_table_set_col_width(tbl_services, 0, 110);
|
||||||
lv_table_set_col_width(tbl_services, 1, 65);
|
lv_table_set_col_width(tbl_services, 1, 65);
|
||||||
@@ -251,19 +251,19 @@ static void create_main_section(lv_obj_t *parent)
|
|||||||
/* Auto-scroll timer: 3 second period */
|
/* Auto-scroll timer: 3 second period */
|
||||||
s_scroll_timer = lv_timer_create(scroll_timer_cb, 3000, NULL);
|
s_scroll_timer = lv_timer_create(scroll_timer_cb, 3000, NULL);
|
||||||
|
|
||||||
/* === Right column: Pi Vitals + Local Sensors === */
|
/* === Left column: Pi Vitals (below services) === */
|
||||||
int rx = RIGHT_COL_X;
|
int rx = 0;
|
||||||
int row_h = 18; /* vertical spacing per stat row */
|
int row_h = 18; /* vertical spacing per stat row */
|
||||||
int lbl_w = 36; /* width reserved for "CPU " etc */
|
int lbl_w = 36; /* width reserved for "CPU " etc */
|
||||||
int bar_w = 82;
|
int bar_w = 82;
|
||||||
int bar_h = 12;
|
int bar_h = 12;
|
||||||
int val_x = rx + 4 + lbl_w + bar_w + 4; /* value label after bar */
|
int val_x = rx + 4 + lbl_w + bar_w + 4; /* value label after bar */
|
||||||
int temp_x = rx + 156; /* TEMP column, right of value labels */
|
int temp_x = rx + 160; /* TEMP column, right of value labels */
|
||||||
|
|
||||||
/* Pi Vitals header */
|
/* Pi Vitals header — Y=162 */
|
||||||
create_label(parent, rx + 4, MAIN_Y + 2, &InziuIosevka_Slab_CC_12px, "PI VITALS");
|
create_label(parent, rx + 4, 162, &InziuIosevka_Slab_CC_12px, "PI VITALS");
|
||||||
|
|
||||||
int ry = MAIN_Y + 18;
|
int ry = 176;
|
||||||
|
|
||||||
/* CPU [========] 12% TEMP */
|
/* CPU [========] 12% TEMP */
|
||||||
create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "CPU");
|
create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "CPU");
|
||||||
@@ -288,10 +288,10 @@ static void create_main_section(lv_obj_t *parent)
|
|||||||
ry += row_h;
|
ry += row_h;
|
||||||
lbl_uptime = create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "Uptime: --h");
|
lbl_uptime = create_label(parent, rx + 4, ry, &InziuIosevka_Slab_CC_12px, "Uptime: --h");
|
||||||
|
|
||||||
/* === Status image (120x120, bottom-right above bot bar) === */
|
/* === Right column: Status image (200x200) === */
|
||||||
img_status = lv_img_create(parent);
|
img_status = lv_img_create(parent);
|
||||||
lv_obj_set_pos(img_status, 280, 156);
|
lv_obj_set_pos(img_status, 200, MAIN_Y + 2);
|
||||||
lv_obj_set_size(img_status, 120, 120);
|
lv_obj_set_size(img_status, 200, 200);
|
||||||
lv_obj_set_style_bg_color(img_status, lv_color_white(), 0);
|
lv_obj_set_style_bg_color(img_status, lv_color_white(), 0);
|
||||||
lv_obj_set_style_bg_opa(img_status, LV_OPA_COVER, 0);
|
lv_obj_set_style_bg_opa(img_status, LV_OPA_COVER, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ connected ESP32 dashboard client on port 8766.
|
|||||||
|
|
||||||
Protocol:
|
Protocol:
|
||||||
Status image:
|
Status image:
|
||||||
1. Text frame: {"type":"status_image","width":120,"height":120}
|
1. Text frame: {"type":"status_image","width":200,"height":200}
|
||||||
2. Binary frame: 1-bit monochrome bitmap
|
2. Binary frame: 1-bit monochrome bitmap
|
||||||
|
|
||||||
Alarm audio:
|
Alarm audio:
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ from PIL import Image
|
|||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
IMG_DIR = Path(__file__).parent / "assets" / "img"
|
IMG_DIR = Path(__file__).parent / "assets" / "img"
|
||||||
STATUS_IMG_SIZE = 120
|
STATUS_IMG_SIZE = 200
|
||||||
MONOCHROME_THRESHOLD = 180
|
MONOCHROME_THRESHOLD = 180
|
||||||
|
|
||||||
|
|
||||||
def load_status_image(path: Path) -> bytes:
|
def load_status_image(path: Path) -> bytes:
|
||||||
"""Load a PNG, convert to 1-bit 120x120 monochrome bitmap (MSB-first, black=1).
|
"""Load a PNG, convert to 1-bit 200x200 monochrome bitmap (MSB-first, black=1).
|
||||||
|
|
||||||
Transparent pixels are composited onto white so they don't render as black.
|
Transparent pixels are composited onto white so they don't render as black.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user