From c1c095b55570371dfed684ff5c3b7113a729b3de Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:02 -0500 Subject: [PATCH 01/55] Files: Improve Files with readable dark styling and larger touch targets --- main/main.c | 74 ++++++++++++++++++++++++++++++------ tests/files_directory_test.c | 11 ++++-- 2 files changed, 71 insertions(+), 14 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..4dd02a5 100644 --- a/main/main.c +++ b/main/main.c @@ -4290,6 +4290,53 @@ static void file_clicked(lv_event_t *event) else open_file(path); } +/* Files owns these styles; do not change the shared list/button defaults. */ +static void files_style_heading(lv_obj_t *heading) +{ + lv_obj_set_width(heading, 640); + lv_label_set_long_mode(heading, LV_LABEL_LONG_DOT); + lv_obj_set_style_text_color(heading, lv_color_hex(0xffffff), 0); +} + +static void files_style_list(lv_obj_t *list) +{ + lv_obj_set_style_bg_color(list, lv_color_hex(0x10141f), 0); + lv_obj_set_style_bg_opa(list, LV_OPA_COVER, 0); + lv_obj_set_style_border_width(list, 0, 0); + lv_obj_set_style_pad_all(list, 0, 0); + lv_obj_set_style_pad_row(list, 12, 0); + lv_obj_set_style_text_font(list, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(list, lv_color_hex(0xffffff), 0); +} + +static lv_obj_t *files_add_button(lv_obj_t *list, const char *icon, const char *text) +{ + lv_obj_t *row = lv_list_add_button(list, icon, text); + lv_obj_set_style_min_height(row, 80, 0); + lv_obj_set_style_pad_all(row, 20, 0); + lv_obj_set_style_pad_column(row, 20, 0); + lv_obj_set_style_radius(row, 16, 0); + lv_obj_set_style_border_width(row, 0, 0); + lv_obj_set_style_bg_color(row, lv_color_hex(0x20283a), 0); + lv_obj_set_style_bg_opa(row, LV_OPA_COVER, 0); + lv_obj_set_style_bg_color(row, lv_color_hex(0x1565c0), LV_STATE_PRESSED); + lv_obj_set_style_text_color(row, lv_color_hex(0xffffff), 0); + lv_obj_set_style_text_font(row, &lv_font_montserrat_28, 0); + lv_obj_t *label = lv_obj_get_child(row, -1); + lv_label_set_long_mode(label, LV_LABEL_LONG_DOT); + return row; +} + +static void files_add_text(lv_obj_t *list, const char *text) +{ + lv_obj_t *message = lv_list_add_text(list, text); + lv_obj_set_style_bg_opa(message, LV_OPA_TRANSP, 0); + lv_obj_set_style_text_color(message, lv_color_hex(0xffffff), 0); + lv_obj_set_style_text_font(message, &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_all(message, 20, 0); + lv_label_set_long_mode(message, LV_LABEL_LONG_WRAP); +} + static void show_files(const char *path) { if (path) { @@ -4300,24 +4347,26 @@ static void show_files(const char *path) file_path_count = 0; lv_obj_t *title = lv_label_create(content); - lv_label_set_text_fmt(title, "Files %s", path ? path : ""); + lv_label_set_text_fmt(title, "%s", path ? path : "Files"); + files_style_heading(title); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); lv_obj_t *list = lv_list_create(content); lv_obj_set_size(list, 640, 940); + files_style_list(list); if (!path) { - lv_obj_t *back = lv_list_add_button(list, LV_SYMBOL_LEFT, "Back to apps"); + lv_obj_t *back = files_add_button(list, LV_SYMBOL_LEFT, "Back to apps"); lv_obj_add_event_cb(back, home_clicked, LV_EVENT_CLICKED, NULL); if (internal_ready) { - lv_obj_t *item = lv_list_add_button(list, LV_SYMBOL_DIRECTORY, "Internal storage"); + lv_obj_t *item = files_add_button(list, LV_SYMBOL_DIRECTORY, "Internal storage"); lv_obj_add_event_cb(item, file_clicked, LV_EVENT_CLICKED, INTERNAL_PATH); } if (sd_ready) { - lv_obj_t *item = lv_list_add_button(list, LV_SYMBOL_SD_CARD, "SD card"); + lv_obj_t *item = files_add_button(list, LV_SYMBOL_SD_CARD, "SD card"); lv_obj_add_event_cb(item, file_clicked, LV_EVENT_CLICKED, SD_PATH); } - if (!internal_ready && !sd_ready) lv_list_add_text(list, "No storage mounted"); + if (!internal_ready && !sd_ready) files_add_text(list, "No storage mounted"); return; } @@ -4326,7 +4375,7 @@ static void show_files(const char *path) char *slash = strrchr(parent, '/'); if (slash && slash != parent) *slash = '\0'; else parent[0] = '\0'; - lv_obj_t *up = lv_list_add_button(list, LV_SYMBOL_UP, ".."); + lv_obj_t *up = files_add_button(list, LV_SYMBOL_UP, "Up"); if (parent[0]) { snprintf(file_paths[file_path_count], sizeof(file_paths[0]), "%s", parent); lv_obj_add_event_cb(up, file_clicked, LV_EVENT_CLICKED, file_paths[file_path_count++]); @@ -4342,9 +4391,10 @@ static void show_files(const char *path) if (sd_directory) sd_record_error(error); char message[96]; snprintf(message, sizeof(message), "Could not open directory: %s", strerror(error)); - lv_list_add_text(list, message); + files_add_text(list, message); return; } + size_t first_entry = file_path_count; int error = 0; size_t skipped = 0; while (file_path_count < sizeof(file_paths) / sizeof(file_paths[0])) { @@ -4368,7 +4418,7 @@ static void show_files(const char *path) memcpy(full + path_len + 1, entry->d_name, name_len + 1); struct stat info; bool is_dir = stat(full, &info) == 0 && S_ISDIR(info.st_mode); - lv_obj_t *item = lv_list_add_button(list, is_dir ? LV_SYMBOL_DIRECTORY : LV_SYMBOL_FILE, entry->d_name); + lv_obj_t *item = files_add_button(list, is_dir ? LV_SYMBOL_DIRECTORY : LV_SYMBOL_FILE, entry->d_name); lv_obj_add_event_cb(item, file_clicked, LV_EVENT_CLICKED, full); } errno = 0; @@ -4377,14 +4427,16 @@ static void show_files(const char *path) if (sd_directory) sd_record_error(error); char message[96]; snprintf(message, sizeof(message), "Directory listing incomplete: %s", strerror(error)); - lv_list_add_text(list, message); + files_add_text(list, message); } + if (!error && !skipped && file_path_count == first_entry) + files_add_text(list, "Empty folder"); if (file_path_count == sizeof(file_paths) / sizeof(file_paths[0])) - lv_list_add_text(list, "Directory entry limit reached"); + files_add_text(list, "Directory entry limit reached"); if (skipped) { char message[96]; snprintf(message, sizeof(message), "Skipped %u paths that exceed the path limit", (unsigned)skipped); - lv_list_add_text(list, message); + files_add_text(list, message); } } diff --git a/tests/files_directory_test.c b/tests/files_directory_test.c index 7ba5e05..9b5cc5c 100644 --- a/tests/files_directory_test.c +++ b/tests/files_directory_test.c @@ -149,6 +149,11 @@ static lv_obj_t *lv_list_add_button(lv_obj_t *parent, const char *symbol, const static void lv_list_add_text(lv_obj_t *parent, const char *text) { (void)lv_list_add_button(parent, NULL, text); } static void lv_obj_add_event_cb(lv_obj_t *object, lv_event_cb_t callback, int event, void *data) { assert(object >= rows && object < rows + row_count && event == LV_EVENT_CLICKED); object->callback = callback; object->path = data; } +/* Rendering is controlled here; the firmware build checks the LVGL styles. */ +static void files_style_heading(lv_obj_t *object) { assert(object == &title); } +static void files_style_list(lv_obj_t *object) { assert(object == &list); } +#define files_add_button lv_list_add_button +#define files_add_text lv_list_add_text #define DIR fixture_dir_t #define dirent fixture_dirent #define opendir fixture_open @@ -197,7 +202,7 @@ static bool unchanged(void) static bool text_contains(const char *text) { for (unsigned i = 0; i < row_count; i++) if (strstr(rows[i].text, text)) return true; return false; } static unsigned entries(void) -{ unsigned count = 0; for (unsigned i = 0; i < row_count; i++) if (rows[i].symbol && strcmp(rows[i].text, "..")) count++; return count; } +{ unsigned count = 0; for (unsigned i = 0; i < row_count; i++) if (rows[i].symbol && strcmp(rows[i].text, "Up")) count++; return count; } static bool paths_valid(void) { for (unsigned i = 0; i < row_count; i++) { @@ -206,7 +211,7 @@ static bool paths_valid(void) bool owned = false; for (size_t j = 0; j < file_path_count; j++) if (row->path == file_paths[j]) owned = true; if (!owned || strlen(row->path) >= FILES_PATH_BYTES) return false; - if (strcmp(row->text, "..")) { + if (strcmp(row->text, "Up")) { const char *name = strrchr(row->path, '/'); if (!name || strcmp(name + 1, row->text)) return false; } } @@ -250,7 +255,7 @@ int main(void) snprintf(physical, sizeof(physical), ".files_directory_%d", fixture_pid()); struct stat existing; assert(stat(physical, &existing) != 0 && errno == ENOENT); assert(make_directory(physical) == 0); owns_directory = true; - ordinary_case("empty", 0, false, NORMAL); ordinary_case("files-and-directory", 2, true, NORMAL); + ordinary_case("empty", 0, false, NORMAL); assert(text_contains("Empty folder")); ordinary_case("files-and-directory", 2, true, NORMAL); bool found_child = false; for (unsigned i = 0; i < row_count; i++) if (!strcmp(rows[i].text, "CHILD") && rows[i].symbol && !strcmp(rows[i].symbol, LV_SYMBOL_DIRECTORY)) found_child = true; assert(found_child); From 97dd244f28877d8f0e04394b44dcfc9e08b41fb9 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:08 -0500 Subject: [PATCH 02/55] Notes: Improve Notes readability and touch controls --- main/main.c | 22 +++++++++++++++++++--- tests/notes_io_test.c | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..173d92e 100644 --- a/main/main.c +++ b/main/main.c @@ -4907,12 +4907,21 @@ static void notes_clicked(lv_event_t *event) lv_obj_set_flex_flow(content, LV_FLEX_FLOW_COLUMN); lv_obj_t *row = lv_obj_create(content); - lv_obj_set_size(row, 640, 70); + lv_obj_remove_style_all(row); + lv_obj_set_size(row, 640, 140); + lv_obj_remove_flag(row, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); + lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_column(row, 20, 0); lv_obj_t *status = lv_label_create(row); lv_label_set_text(status, sd_ready ? "Notes" : "SD card unavailable"); + lv_obj_set_width(status, 480); + lv_obj_set_style_text_font(status, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(status, lv_color_hex(0xFFFFFF), 0); lv_obj_set_flex_grow(status, 1); lv_obj_t *save = lv_button_create(row); + lv_obj_set_size(save, 140, 72); + lv_obj_set_style_text_font(save, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(save, save_note, LV_EVENT_CLICKED, status); lv_obj_t *save_label = lv_label_create(save); lv_label_set_text(save_label, "Save"); @@ -4935,12 +4944,19 @@ static void notes_clicked(lv_event_t *event) } note_area = lv_textarea_create(content); - lv_obj_set_size(note_area, 640, 420); + lv_obj_set_size(note_area, 640, 440); + lv_obj_set_style_text_font(note_area, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(note_area, 8, 0); + lv_obj_set_style_pad_all(note_area, 20, 0); lv_textarea_set_text(note_area, note_can_save ? note : ""); lv_textarea_set_max_length(note_area, NOTE_MAX_BYTES); heap_caps_free(note); lv_obj_t *keyboard = lv_keyboard_create(content); - lv_obj_set_size(keyboard, 640, 500); + lv_obj_set_size(keyboard, 640, 440); + lv_obj_set_style_pad_all(keyboard, 2, 0); + lv_obj_set_style_pad_column(keyboard, 1, 0); + lv_obj_set_style_pad_row(keyboard, 8, 0); + lv_obj_set_style_text_font(keyboard, &lv_font_montserrat_28, LV_PART_ITEMS); lv_keyboard_set_textarea(keyboard, note_area); if (!note_can_save) { lv_obj_add_state(save, LV_STATE_DISABLED); diff --git a/tests/notes_io_test.c b/tests/notes_io_test.c index 179fe61..c5b84fa 100644 --- a/tests/notes_io_test.c +++ b/tests/notes_io_test.c @@ -220,6 +220,30 @@ lv_obj_t *lv_label_create(lv_obj_t *parent) { return lv_obj_create(parent); } lv_obj_t *lv_button_create(lv_obj_t *parent) { return lv_obj_create(parent); } lv_obj_t *lv_textarea_create(lv_obj_t *parent) { return lv_obj_create(parent); } lv_obj_t *lv_keyboard_create(lv_obj_t *parent) { return lv_obj_create(parent); } +/* Presentation APIs used by the Notes layout; storage cases use controlled UI. */ +#define LV_FLEX_ALIGN_START 0 +#define LV_FLEX_ALIGN_CENTER 1 +#define LV_OBJ_FLAG_SCROLLABLE 1 +#define LV_PART_ITEMS 1 +static const int lv_font_montserrat_28 = 28; +void lv_obj_remove_style_all(lv_obj_t *object) { assert(object); } +void lv_obj_remove_flag(lv_obj_t *object, int flag) { assert(object && flag); } +void lv_obj_set_width(lv_obj_t *object, int width) { assert(object && width > 0); } +void lv_obj_set_flex_align(lv_obj_t *object, int main, int cross, int track) +{ assert(object); (void)main; (void)cross; (void)track; } +void lv_obj_set_style_text_font(lv_obj_t *object, const int *font, int selector) +{ assert(object && font); (void)selector; } +unsigned lv_color_hex(unsigned color) { return color; } +void lv_obj_set_style_text_color(lv_obj_t *object, unsigned color, int selector) +{ assert(object); (void)color; (void)selector; } +#define NOTES_STYLE_STUB(name) \ +void name(lv_obj_t *object, int value, int selector) \ +{ assert(object && value >= 0); (void)selector; } +NOTES_STYLE_STUB(lv_obj_set_style_pad_column) +NOTES_STYLE_STUB(lv_obj_set_style_pad_row) +NOTES_STYLE_STUB(lv_obj_set_style_pad_all) +NOTES_STYLE_STUB(lv_obj_set_style_text_line_space) +#undef NOTES_STYLE_STUB void lv_obj_set_size(lv_obj_t *object, int width, int height) { assert(object && width > 0 && height > 0); } void lv_obj_set_flex_flow(lv_obj_t *object, int flow) { assert(object && flow); } void lv_obj_set_flex_grow(lv_obj_t *object, int grow) { assert(object && grow == 1); } From 65ce7970398da7e290179db80161d16ee9a3494e Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:12 -0500 Subject: [PATCH 03/55] Counter: Improve Counter layout with prominent value and larger controls --- main/main.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..5e7b013 100644 --- a/main/main.c +++ b/main/main.c @@ -4971,14 +4971,53 @@ static void counter_clicked(lv_event_t *event) { (void)event; clear_content(); - counter_label = lv_label_create(content); + lv_obj_t *panel = lv_obj_create(content); + lv_obj_remove_style_all(panel); + lv_obj_remove_flag(panel, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_size(panel, LV_PCT(100), LV_PCT(100)); + lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(panel, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_row(panel, 24, 0); + + lv_obj_t *title = lv_label_create(panel); + lv_label_set_text(title, "Counter"); + lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + + lv_obj_t *value = lv_obj_create(panel); + lv_obj_set_size(value, LV_PCT(100), 240); + lv_obj_remove_flag(value, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(value, lv_color_hex(0x20283a), 0); + lv_obj_set_style_border_width(value, 0, 0); + lv_obj_set_style_radius(value, 24, 0); + counter_label = lv_label_create(value); + lv_obj_set_width(counter_label, LV_PCT(100)); + lv_obj_set_style_text_align(counter_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_font(counter_label, &lv_font_montserrat_48, 0); update_counter(); - lv_obj_t *minus = button(content, "-1", NULL); + lv_obj_center(counter_label); + + lv_obj_t *actions = lv_obj_create(panel); + lv_obj_remove_style_all(actions); + lv_obj_remove_flag(actions, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_size(actions, LV_PCT(100), 180); + lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW); + lv_obj_set_style_pad_column(actions, 24, 0); + lv_obj_t *minus = button(actions, "-1", NULL); + lv_obj_set_height(minus, LV_PCT(100)); + lv_obj_set_flex_grow(minus, 1); + lv_obj_set_style_radius(minus, 24, 0); + lv_obj_set_style_text_font(lv_obj_get_child(minus, 0), &lv_font_montserrat_48, 0); lv_obj_add_event_cb(minus, counter_change, LV_EVENT_CLICKED, (void *)(intptr_t)-1); - lv_obj_t *plus = button(content, "+1", NULL); + lv_obj_t *plus = button(actions, "+1", NULL); + lv_obj_set_height(plus, LV_PCT(100)); + lv_obj_set_flex_grow(plus, 1); + lv_obj_set_style_radius(plus, 24, 0); + lv_obj_set_style_text_font(lv_obj_get_child(plus, 0), &lv_font_montserrat_48, 0); lv_obj_add_event_cb(plus, counter_change, LV_EVENT_CLICKED, (void *)(intptr_t)1); - button(content, "Reset", counter_reset); + lv_obj_t *reset = button(panel, "Reset", counter_reset); + lv_obj_set_size(reset, LV_PCT(100), 80); + lv_obj_set_style_bg_color(reset, lv_color_hex(0x20283a), 0); + lv_obj_set_style_radius(reset, 20, 0); } static void wifi_scan_task(void *argument) From 165cf8a02f6e47fd476beed9a08b2c63fe25e07d Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:16 -0500 Subject: [PATCH 04/55] GPIO: Improve GPIO readability with grouped pins and larger touch controls --- main/main.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..5102637 100644 --- a/main/main.c +++ b/main/main.c @@ -5861,34 +5861,55 @@ static void show_gpio(void) lv_obj_t *title = lv_label_create(content); lv_label_set_text(title, "GPIO"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(content); - lv_label_set_text(help, "Tap mode: INPUT (pull-up) -> LOW -> HIGH\n3.3V logic only. Do not connect GPIO directly to 5V."); - lv_obj_set_width(help, 640); + lv_obj_t *notice = lv_label_create(content); + lv_label_set_text(notice, "3.3V only • Never connect to 5V"); + lv_obj_set_style_text_color(notice, lv_color_hex(0xFFB74D), 0); + lv_obj_set_style_text_font(notice, &lv_font_montserrat_28, 0); lv_obj_t *list = lv_obj_create(content); - lv_obj_set_size(list, 650, 930); + lv_obj_set_size(list, 664, 980); lv_obj_set_flex_flow(list, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_all(list, 10, 0); - lv_obj_set_style_pad_row(list, 8, 0); + lv_obj_set_style_bg_opa(list, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(list, 0, 0); + lv_obj_set_style_pad_all(list, 4, 0); + lv_obj_set_style_pad_row(list, 12, 0); + lv_obj_set_scroll_dir(list, LV_DIR_VER); for (size_t i = 0; i < GPIO_CONTROL_COUNT; i++) { gpio_control_t *control = &gpio_controls[i]; control->mode = 0; + if (i == 0 || i == 6) { + lv_obj_t *heading = lv_label_create(list); + lv_label_set_text(heading, i == 0 ? "EXT" : "M-BUS"); + lv_obj_set_style_text_font(heading, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(heading, lv_color_hex(0xFFFFFF), 0); + } lv_obj_t *row = lv_obj_create(list); - lv_obj_set_size(row, 600, 66); + lv_obj_set_size(row, LV_PCT(100), 100); lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_all(row, 6, 0); + lv_obj_set_style_bg_color(row, lv_color_hex(0x1F2937), 0); + lv_obj_set_style_text_color(row, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_text_font(row, &lv_font_montserrat_28, 0); + lv_obj_set_style_border_width(row, 0, 0); + lv_obj_set_style_radius(row, 16, 0); + lv_obj_set_style_pad_all(row, 12, 0); lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *name = lv_label_create(row); - lv_label_set_text_fmt(name, "%s G%d", control->port, control->pin); - lv_obj_set_width(name, 220); + if (control->input_only) + lv_label_set_text_fmt(name, "G%d %s", control->pin, + control->pin == GPIO_NUM_17 ? "PB_IN" : "PB_OUT"); + else + lv_label_set_text_fmt(name, "G%d", control->pin); + lv_obj_set_flex_grow(name, 1); control->level_label = lv_label_create(row); - lv_label_set_text(control->level_label, "1"); + lv_obj_set_width(control->level_label, 56); + lv_obj_set_style_text_align(control->level_label, LV_TEXT_ALIGN_CENTER, 0); + lv_label_set_text(control->level_label, "0"); lv_obj_t *mode = lv_button_create(row); - lv_obj_set_size(mode, 180, 50); + lv_obj_set_size(mode, 218, 72); lv_obj_add_event_cb(mode, gpio_mode_clicked, LV_EVENT_CLICKED, control); control->mode_label = lv_label_create(mode); - lv_label_set_text(control->mode_label, control->input_only ? "READ" : "SET"); + lv_label_set_text(control->mode_label, control->input_only ? "READ" : "SET INPUT"); lv_obj_center(control->mode_label); } gpio_timer = lv_timer_create(gpio_tick, 200, NULL); From 9afe01f380401bbf187aa5889bd54f37c8200d35 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:21 -0500 Subject: [PATCH 05/55] Settings: Improve Settings with clearer grouping and larger touch targets --- main/main.c | 119 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 91 insertions(+), 28 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..10d5c1d 100644 --- a/main/main.c +++ b/main/main.c @@ -4981,6 +4981,27 @@ static void counter_clicked(lv_event_t *event) button(content, "Reset", counter_reset); } +/* Settings-local styling keeps the OS shell and other apps unchanged. */ +static void settings_panel_style(lv_obj_t *panel) +{ + lv_obj_set_style_bg_color(panel, lv_color_hex(0x20283a), 0); + lv_obj_set_style_bg_opa(panel, LV_OPA_COVER, 0); + lv_obj_set_style_text_color(panel, lv_color_white(), 0); + lv_obj_set_style_text_font(panel, &lv_font_montserrat_28, 0); + lv_obj_set_style_border_width(panel, 0, 0); + lv_obj_set_style_radius(panel, 18, 0); + lv_obj_set_style_pad_all(panel, 20, 0); + lv_obj_set_style_pad_row(panel, 16, 0); +} + +static void settings_list_message(const char *text) +{ + lv_obj_t *message = lv_list_add_text(wifi_list, text); + lv_obj_set_style_bg_opa(message, LV_OPA_TRANSP, 0); + lv_obj_set_style_text_color(message, lv_color_white(), 0); + lv_obj_set_style_pad_ver(message, 24, 0); +} + static void wifi_scan_task(void *argument) { (void)argument; @@ -5000,11 +5021,11 @@ static void wifi_scan_clicked(lv_event_t *event) wifi_scan_busy = true; wifi_scan_done = false; lv_obj_clean(wifi_list); - lv_list_add_text(wifi_list, "Scanning..."); + settings_list_message("Scanning..."); if (xTaskCreate(wifi_scan_task, "wifi-scan", 4096, NULL, 4, NULL) != pdPASS) { wifi_scan_busy = false; lv_obj_clean(wifi_list); - lv_list_add_text(wifi_list, "Could not start scan"); + settings_list_message("Could not start scan"); } } @@ -5047,6 +5068,7 @@ static void wifi_network_clicked(lv_event_t *event) lv_obj_t *title = lv_label_create(content); lv_label_set_text_fmt(title, "Connect to\n%s", selected_ssid); + lv_obj_set_style_pad_row(content, 24, 0); lv_obj_set_width(title, 640); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); @@ -5058,7 +5080,8 @@ static void wifi_network_clicked(lv_event_t *event) LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_remove_flag(password_row, LV_OBJ_FLAG_SCROLLABLE); wifi_password_area = lv_textarea_create(password_row); - lv_textarea_set_placeholder_text(wifi_password_area, "Wi-Fi password"); + lv_textarea_set_placeholder_text(wifi_password_area, + ap->authmode == WIFI_AUTH_OPEN ? "Password (optional)" : "Wi-Fi password"); lv_textarea_set_password_mode(wifi_password_area, true); lv_textarea_set_max_length(wifi_password_area, 63); lv_textarea_set_one_line(wifi_password_area, true); @@ -5067,8 +5090,6 @@ static void wifi_network_clicked(lv_event_t *event) lv_obj_set_style_pad_ver(wifi_password_area, 20, 0); lv_obj_t *visibility = button(password_row, "Show", wifi_password_visibility_clicked); lv_obj_set_size(visibility, 128, 76); - lv_obj_t *hint = lv_label_create(content); - lv_label_set_text(hint, "Leave the password blank for an open network."); button(content, "Connect", wifi_connect_clicked); lv_obj_t *keyboard = lv_keyboard_create(content); @@ -5123,11 +5144,11 @@ static void wifi_tick(lv_timer_t *timer) wifi_scan_done = false; lv_obj_clean(wifi_list); if (wifi_scan_error != ESP_OK) { - lv_list_add_text(wifi_list, "Scan failed - try again"); + settings_list_message("Scan failed - try again"); return; } if (!wifi_ap_count) { - lv_list_add_text(wifi_list, "No networks found"); + settings_list_message("No networks found"); return; } for (uint16_t i = 0; i < wifi_ap_count; i++) { @@ -5136,6 +5157,14 @@ static void wifi_tick(lv_timer_t *timer) (unsigned)wifi_aps[i].primary, wifi_aps[i].rssi, wifi_aps[i].authmode == WIFI_AUTH_OPEN ? "" : " locked"); lv_obj_t *network = lv_list_add_button(wifi_list, LV_SYMBOL_WIFI, label); + lv_obj_set_style_min_height(network, 88, 0); + lv_obj_set_style_bg_color(network, lv_color_hex(0x20283a), 0); + lv_obj_set_style_bg_color(network, lv_color_hex(0x0288d1), LV_STATE_PRESSED); + lv_obj_set_style_text_color(network, lv_color_white(), 0); + lv_obj_set_style_pad_ver(network, 20, 0); + lv_obj_set_style_pad_column(network, 16, 0); + lv_obj_t *name = lv_obj_get_child(network, -1); + lv_label_set_long_mode(name, LV_LABEL_LONG_WRAP); lv_obj_add_event_cb(network, wifi_network_clicked, LV_EVENT_CLICKED, &wifi_aps[i]); } } @@ -5187,39 +5216,73 @@ static void network_tools_clicked(lv_event_t *event) static void show_settings(void) { clear_content(); + lv_obj_set_style_pad_row(content, 20, 0); lv_obj_t *title = lv_label_create(content); lv_label_set_text(title, "Settings"); - lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + lv_obj_set_width(title, 640); + lv_obj_set_style_text_font(title, &lv_font_montserrat_48, 0); - lv_obj_t *display_row = lv_obj_create(content); - lv_obj_set_size(display_row, 640, 100); - lv_obj_clear_flag(display_row, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_t *display = lv_obj_create(content); + settings_panel_style(display); + lv_obj_set_size(display, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(display, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(display, LV_FLEX_FLOW_COLUMN); + lv_obj_t *display_title = lv_label_create(display); + lv_label_set_text(display_title, "Display"); + lv_obj_t *display_row = lv_obj_create(display); + lv_obj_remove_style_all(display_row); + lv_obj_set_size(display_row, LV_PCT(100), 104); lv_obj_set_flex_flow(display_row, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(display_row, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_column(display_row, 16, 0); + lv_obj_remove_flag(display_row, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *brightness = button(display_row, "", display_brightness_clicked); - lv_obj_set_size(brightness, 290, 82); + lv_obj_set_size(brightness, 0, 104); + lv_obj_set_flex_grow(brightness, 1); lv_label_set_text_fmt(lv_obj_get_child(brightness, 0), "Brightness\n%u%%", display_brightness); lv_obj_t *timeout = button(display_row, "", screen_timeout_clicked); - lv_obj_set_size(timeout, 290, 82); + lv_obj_set_size(timeout, 0, 104); + lv_obj_set_flex_grow(timeout, 1); display_timeout_label_update(lv_obj_get_child(timeout, 0)); - - wifi_status = lv_label_create(content); - lv_obj_set_size(wifi_status, 640, 75); - - lv_obj_t *actions = lv_obj_create(content); - lv_obj_set_size(actions, 640, 100); + lv_obj_set_style_text_align(lv_obj_get_child(brightness, 0), LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_align(lv_obj_get_child(timeout, 0), LV_TEXT_ALIGN_CENTER, 0); + + lv_obj_t *wifi = lv_obj_create(content); + settings_panel_style(wifi); + lv_obj_set_width(wifi, 640); + lv_obj_set_flex_grow(wifi, 1); + lv_obj_remove_flag(wifi, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(wifi, LV_FLEX_FLOW_COLUMN); + lv_obj_t *wifi_title = lv_label_create(wifi); + lv_label_set_text(wifi_title, "Wi-Fi"); + wifi_status = lv_label_create(wifi); + lv_obj_set_size(wifi_status, LV_PCT(100), 108); + lv_label_set_long_mode(wifi_status, LV_LABEL_LONG_WRAP); + + lv_obj_t *actions = lv_obj_create(wifi); + lv_obj_remove_style_all(actions); + lv_obj_set_size(actions, LV_PCT(100), 80); + lv_obj_remove_flag(actions, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(actions, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_column(actions, 16, 0); lv_obj_t *scan = button(actions, "Scan", wifi_scan_clicked); lv_obj_t *forget = button(actions, "Forget", wifi_forget_clicked); lv_obj_t *tools = button(actions, "Tools", network_tools_clicked); - lv_obj_set_size(scan, 180, 82); - lv_obj_set_size(forget, 180, 82); - lv_obj_set_size(tools, 180, 82); - - wifi_list = lv_list_create(content); - lv_obj_set_size(wifi_list, 640, 680); - lv_list_add_text(wifi_list, wifi_ready ? "Tap Scan to find networks" : "Wi-Fi hardware unavailable"); + lv_obj_t *buttons[] = {scan, forget, tools}; + for (size_t i = 0; i < sizeof(buttons) / sizeof(buttons[0]); i++) { + lv_obj_set_size(buttons[i], 0, 80); + lv_obj_set_flex_grow(buttons[i], 1); + } + lv_obj_set_style_bg_color(forget, lv_color_hex(0x38445a), 0); + lv_obj_set_style_bg_color(tools, lv_color_hex(0x38445a), 0); + + wifi_list = lv_list_create(wifi); + settings_panel_style(wifi_list); + lv_obj_set_style_pad_all(wifi_list, 0, 0); + lv_obj_set_style_pad_row(wifi_list, 8, 0); + lv_obj_set_width(wifi_list, LV_PCT(100)); + lv_obj_set_height(wifi_list, 0); + lv_obj_set_flex_grow(wifi_list, 1); + settings_list_message(wifi_ready ? "No scan results" : "Wi-Fi hardware unavailable"); if (!wifi_ready) { lv_obj_add_state(scan, LV_STATE_DISABLED); lv_obj_add_state(forget, LV_STATE_DISABLED); From 5fdb36e9375b4c7e3312a66367b5a4cac7425091 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:25 -0500 Subject: [PATCH 06/55] AI Chat: Improve AI Chat readability, spacing, and touch controls --- main/main.c | 72 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..ac85f75 100644 --- a/main/main.c +++ b/main/main.c @@ -3524,7 +3524,7 @@ static void chat_tick(lv_timer_t *timer) } if (chat_busy && chat_job == CHAT_JOB_VOICE && !voice_recording) { lv_label_set_text(chat_status, "Transcribing..."); - lv_label_set_text(chat_voice_label, "Start"); + lv_label_set_text(chat_voice_label, "Record"); lv_obj_add_state(chat_voice_button, LV_STATE_DISABLED); } if (!chat_done) return; @@ -3542,7 +3542,7 @@ static void chat_tick(lv_timer_t *timer) } lv_obj_remove_state(chat_send_button, LV_STATE_DISABLED); lv_obj_remove_state(chat_voice_button, LV_STATE_DISABLED); - lv_label_set_text(chat_voice_label, "Start"); + lv_label_set_text(chat_voice_label, "Record"); } static bool chat_start_job(chat_job_t job) @@ -3610,14 +3610,14 @@ static void chat_voice_clicked(lv_event_t *event) voice_stop_requested = false; voice_recording = true; voice_level = 0; - lv_label_set_text(chat_status, "Recording - press Stop when done"); + lv_label_set_text(chat_status, "Recording..."); lv_label_set_text(chat_voice_label, "Stop"); lv_obj_add_state(chat_send_button, LV_STATE_DISABLED); if (!chat_start_job(CHAT_JOB_VOICE)) { voice_recording = false; lv_obj_remove_state(chat_send_button, LV_STATE_DISABLED); lv_obj_remove_state(chat_voice_button, LV_STATE_DISABLED); - lv_label_set_text(chat_voice_label, "Start"); + lv_label_set_text(chat_voice_label, "Record"); lv_label_set_text(chat_status, "Could not start microphone"); } } @@ -3628,23 +3628,23 @@ static void chat_new_clicked(lv_event_t *event) if (chat_busy) return; chat_history[0] = '\0'; chat_response_id[0] = '\0'; - lv_textarea_set_text(chat_output, "Ask me anything."); + lv_textarea_set_text(chat_output, ""); lv_label_set_text(chat_status, "New conversation"); } static void chat_apply_preferences(void) { - const lv_font_t *font = chat_large_text ? &lv_font_montserrat_28 : &lv_font_montserrat_14; + const lv_font_t *font = chat_large_text ? &lv_font_montserrat_48 : &lv_font_montserrat_28; lv_obj_set_style_text_font(chat_output, font, 0); lv_obj_set_style_text_font(chat_input, font, 0); - lv_label_set_text(chat_text_label, chat_large_text ? "Text: Large" : "Text: Small"); + lv_label_set_text(chat_text_label, chat_large_text ? "Text: Large" : "Text: Normal"); lv_label_set_text(chat_keyboard_label, chat_keyboard_visible ? "Hide keys" : "Show keys"); if (chat_keyboard_visible) { lv_obj_remove_flag(chat_keyboard, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_height(chat_output, 230); + lv_obj_set_height(chat_output, 340); } else { lv_obj_add_flag(chat_keyboard, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_height(chat_output, 560); + lv_obj_set_height(chat_output, 682); } } @@ -5247,58 +5247,84 @@ static void show_chat(void) lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); chat_status = lv_label_create(content); - lv_label_set_text(chat_status, voice_recording ? "Recording - press Stop when done" : + lv_label_set_text(chat_status, voice_recording ? "Recording..." : chat_busy ? (chat_job == CHAT_JOB_VOICE ? "Transcribing..." : "Thinking...") : (!chat_relay_url[0] || !chat_device_token[0]) ? "Relay is not configured" : "Ready"); lv_obj_set_width(chat_status, 640); + lv_obj_set_style_text_font(chat_status, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(chat_status, lv_color_hex(0xCDD5E2), 0); chat_wave = lv_chart_create(content); - lv_obj_set_size(chat_wave, 640, 100); + lv_obj_set_size(chat_wave, 640, 48); lv_chart_set_type(chat_wave, LV_CHART_TYPE_LINE); lv_chart_set_point_count(chat_wave, 60); lv_chart_set_range(chat_wave, LV_CHART_AXIS_PRIMARY_Y, 0, 100); lv_chart_set_div_line_count(chat_wave, 0, 0); - chat_wave_series = lv_chart_add_series(chat_wave, lv_color_hex(0x29B6F6), LV_CHART_AXIS_PRIMARY_Y); + chat_wave_series = lv_chart_add_series(chat_wave, lv_color_hex(0xE91E63), LV_CHART_AXIS_PRIMARY_Y); + + lv_obj_set_style_bg_color(chat_wave, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(chat_wave, 0, 0); + lv_obj_set_style_pad_all(chat_wave, 6, 0); + lv_obj_set_style_width(chat_wave, 0, LV_PART_INDICATOR); + lv_obj_set_style_height(chat_wave, 0, LV_PART_INDICATOR); chat_output = lv_textarea_create(content); - lv_obj_set_size(chat_output, 640, 230); - lv_textarea_set_text(chat_output, chat_history[0] ? chat_history : "Ask me anything."); + lv_obj_set_size(chat_output, 640, 340); + lv_textarea_set_text(chat_output, chat_history[0] ? chat_history : ""); lv_textarea_set_cursor_pos(chat_output, LV_TEXTAREA_CURSOR_LAST); lv_textarea_set_one_line(chat_output, false); + lv_textarea_set_placeholder_text(chat_output, "New conversation"); + lv_obj_set_style_bg_color(chat_output, lv_color_hex(0x202938), 0); + lv_obj_set_style_text_color(chat_output, lv_color_white(), 0); + lv_obj_set_style_text_color(chat_output, lv_color_hex(0xCDD5E2), LV_PART_TEXTAREA_PLACEHOLDER); + lv_obj_set_style_border_width(chat_output, 0, 0); + lv_obj_set_style_pad_all(chat_output, 20, 0); + lv_obj_set_style_text_line_space(chat_output, 6, 0); + lv_obj_set_style_bg_opa(chat_output, LV_OPA_TRANSP, LV_PART_CURSOR); chat_input = lv_textarea_create(content); - lv_obj_set_size(chat_input, 640, 90); + lv_obj_set_size(chat_input, 640, 96); lv_textarea_set_placeholder_text(chat_input, "Message"); lv_textarea_set_max_length(chat_input, 2000); + lv_obj_set_style_pad_all(chat_input, 16, 0); + lv_obj_set_style_border_color(chat_input, lv_color_hex(0xE91E63), 0); + lv_obj_set_style_text_color(chat_input, lv_color_hex(0x647084), LV_PART_TEXTAREA_PLACEHOLDER); lv_obj_t *actions = lv_obj_create(content); - lv_obj_set_size(actions, 640, 90); + lv_obj_remove_style_all(actions); + lv_obj_set_size(actions, 640, 76); lv_obj_remove_flag(actions, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(actions, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_align(actions, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); chat_send_button = button(actions, "Send", chat_send_clicked); lv_obj_set_size(chat_send_button, 180, 76); - chat_voice_button = button(actions, voice_recording ? "Stop" : "Start", chat_voice_clicked); + chat_voice_button = button(actions, voice_recording ? "Stop" : "Record", chat_voice_clicked); chat_voice_label = lv_obj_get_child(chat_voice_button, 0); lv_obj_set_size(chat_voice_button, 180, 76); lv_obj_t *new_chat = button(actions, "New", chat_new_clicked); lv_obj_set_size(new_chat, 180, 76); + lv_obj_set_style_bg_color(chat_send_button, lv_color_hex(0xE91E63), 0); + lv_obj_set_style_bg_color(chat_voice_button, lv_color_hex(0x344156), 0); + lv_obj_set_style_bg_color(new_chat, lv_color_hex(0x344156), 0); if (chat_busy) { lv_obj_add_state(chat_send_button, LV_STATE_DISABLED); if (!voice_recording) lv_obj_add_state(chat_voice_button, LV_STATE_DISABLED); } lv_obj_t *controls = lv_obj_create(content); - lv_obj_set_size(controls, 640, 64); + lv_obj_remove_style_all(controls); + lv_obj_set_size(controls, 640, 60); lv_obj_remove_flag(controls, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(controls, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(controls, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_align(controls, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t *keyboard_button = button(controls, "Hide keys", chat_keyboard_clicked); - lv_obj_set_size(keyboard_button, 290, 54); + lv_obj_set_size(keyboard_button, 310, 60); chat_keyboard_label = lv_obj_get_child(keyboard_button, 0); - lv_obj_t *text_button = button(controls, "Text: Small", chat_text_clicked); - lv_obj_set_size(text_button, 290, 54); + lv_obj_t *text_button = button(controls, "Text: Normal", chat_text_clicked); + lv_obj_set_size(text_button, 310, 60); chat_text_label = lv_obj_get_child(text_button, 0); + lv_obj_set_style_bg_color(keyboard_button, lv_color_hex(0x344156), 0); + lv_obj_set_style_bg_color(text_button, lv_color_hex(0x344156), 0); chat_keyboard = lv_keyboard_create(content); lv_obj_set_size(chat_keyboard, 640, 330); From 05ab464bbcf48d77bb4c3eb37068c7802e05ae32 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:29 -0500 Subject: [PATCH 07/55] Browser: Improve Browser readability and touch-friendly layout --- main/main.c | 72 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..0a4eb0e 100644 --- a/main/main.c +++ b/main/main.c @@ -3939,10 +3939,10 @@ static void browser_apply_layout(void) lv_label_set_text(browser_keys_label, browser_keyboard_visible ? "Hide keys" : "Show keys"); if (browser_keyboard_visible) { lv_obj_remove_flag(browser_keyboard, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_height(browser_page, 450); + lv_obj_set_height(browser_page, 458); } else { lv_obj_add_flag(browser_keyboard, LV_OBJ_FLAG_HIDDEN); - lv_obj_set_height(browser_page, 780); + lv_obj_set_height(browser_page, 800); } } @@ -3950,7 +3950,9 @@ static void browser_render(void) { lv_obj_clean(browser_page); lv_obj_t *body = lv_label_create(browser_page); - lv_obj_set_width(body, 580); + lv_obj_set_width(body, LV_PCT(100)); + lv_obj_set_style_text_font(body, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(body, 6, 0); lv_label_set_long_mode(body, LV_LABEL_LONG_WRAP); lv_label_set_text(body, browser_ok ? (browser_result && browser_result[0] ? browser_result : "No readable text") : browser_error); if (!browser_ok || !browser_link_count) return; @@ -3960,12 +3962,12 @@ static void browser_render(void) lv_obj_set_style_text_font(heading, &lv_font_montserrat_28, 0); for (size_t i = 0; i < browser_link_count; ++i) { lv_obj_t *link = button(browser_page, browser_link_labels[i], NULL); - lv_obj_set_size(link, 580, 58); + lv_obj_set_size(link, LV_PCT(100), 72); lv_obj_add_event_cb(link, browser_link_clicked, LV_EVENT_CLICKED, browser_links[i]); lv_obj_t *label = lv_obj_get_child(link, 0); - lv_obj_set_width(label, 520); + lv_obj_set_width(label, 536); lv_label_set_long_mode(label, LV_LABEL_LONG_DOT); - lv_obj_set_style_text_font(label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); } } @@ -3998,6 +4000,7 @@ static bool browser_start_url(const char *requested, bool add_history) if (browser_page) { lv_obj_clean(browser_page); lv_obj_t *loading = lv_label_create(browser_page); + lv_obj_set_style_text_font(loading, &lv_font_montserrat_28, 0); lv_label_set_text(loading, "Loading..."); } if (!browser_task && xTaskCreateWithCaps(browser_request_task, "browser", 12288, NULL, 4, &browser_task, @@ -4052,7 +4055,7 @@ static void browser_tick(lv_timer_t *timer) (void)timer; if (!browser_done) return; browser_done = false; - lv_label_set_text(browser_status, browser_ok ? "Loaded" : browser_error); + lv_label_set_text(browser_status, browser_ok ? "" : browser_error); if (browser_ok) lv_textarea_set_text(browser_url_area, browser_url); browser_render(); } @@ -5318,53 +5321,74 @@ static void show_browser(void) clear_content(); lv_obj_set_style_pad_row(content, 12, 0); - lv_obj_t *title = lv_label_create(content); + lv_obj_t *header = lv_obj_create(content); + lv_obj_set_size(header, 640, 56); + lv_obj_set_style_bg_opa(header, LV_OPA_TRANSP, 0); + lv_obj_set_style_text_color(header, lv_color_white(), 0); + lv_obj_set_style_border_width(header, 0, 0); + lv_obj_set_style_pad_all(header, 0, 0); + lv_obj_remove_flag(header, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(header, LV_FLEX_FLOW_ROW); + lv_obj_set_flex_align(header, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_t *title = lv_label_create(header); lv_label_set_text(title, "Browser"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - browser_status = lv_label_create(content); - lv_label_set_text(browser_status, browser_busy ? "Loading..." : browser_result ? "Loaded" : "Ready"); - lv_obj_set_width(browser_status, 640); + browser_status = lv_label_create(header); + lv_label_set_text(browser_status, browser_busy ? "Loading..." : ""); + lv_obj_set_width(browser_status, 440); + lv_obj_set_style_text_align(browser_status, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_t *address = lv_obj_create(content); - lv_obj_set_size(address, 640, 82); + lv_obj_set_size(address, 640, 80); lv_obj_remove_flag(address, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_opa(address, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(address, 0, 0); + lv_obj_set_style_pad_all(address, 0, 0); + lv_obj_set_style_pad_column(address, 12, 0); lv_obj_set_flex_flow(address, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(address, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_align(address, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); browser_url_area = lv_textarea_create(address); - lv_obj_set_size(browser_url_area, 470, 68); + lv_obj_set_size(browser_url_area, 524, 80); + lv_obj_set_style_text_font(browser_url_area, &lv_font_montserrat_28, 0); lv_textarea_set_one_line(browser_url_area, true); lv_textarea_set_max_length(browser_url_area, sizeof(browser_url) - 1); lv_textarea_set_text(browser_url_area, browser_url); lv_obj_add_event_cb(browser_url_area, browser_go_clicked, LV_EVENT_READY, NULL); lv_obj_t *go = button(address, "Go", browser_go_clicked); - lv_obj_set_size(go, 130, 68); + lv_obj_set_size(go, 104, 80); lv_obj_t *tools = lv_obj_create(content); - lv_obj_set_size(tools, 640, 64); + lv_obj_set_size(tools, 640, 72); lv_obj_remove_flag(tools, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_opa(tools, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(tools, 0, 0); + lv_obj_set_style_pad_all(tools, 0, 0); + lv_obj_set_style_pad_column(tools, 12, 0); lv_obj_set_flex_flow(tools, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(tools, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_align(tools, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t *back = button(tools, "Back", browser_back_clicked); - lv_obj_set_size(back, 190, 54); + lv_obj_set_size(back, 205, 72); lv_obj_t *keys = button(tools, browser_keyboard_visible ? "Hide keys" : "Show keys", browser_keys_clicked); browser_keys_label = lv_obj_get_child(keys, 0); - lv_obj_set_size(keys, 190, 54); + lv_obj_set_size(keys, 205, 72); lv_obj_t *reload = button(tools, "Reload", browser_reload_clicked); - lv_obj_set_size(reload, 190, 54); + lv_obj_set_size(reload, 205, 72); browser_page = lv_obj_create(content); - lv_obj_set_size(browser_page, 640, 450); + lv_obj_set_size(browser_page, 640, 458); lv_obj_set_flex_flow(browser_page, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(browser_page, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_style_bg_color(browser_page, lv_color_white(), 0); lv_obj_set_style_text_color(browser_page, lv_color_black(), 0); - lv_obj_set_style_pad_row(browser_page, 12, 0); + lv_obj_set_style_pad_all(browser_page, 24, 0); + lv_obj_set_style_pad_row(browser_page, 20, 0); if (browser_result) browser_render(); else { lv_obj_t *message = lv_label_create(browser_page); - lv_obj_set_width(message, 580); - lv_label_set_text(message, "Enter a web address, or tap Go to open example.com."); + lv_obj_set_width(message, LV_PCT(100)); + lv_obj_set_style_text_font(message, &lv_font_montserrat_28, 0); + lv_label_set_text(message, browser_busy ? "Loading..." : "No page open"); } browser_keyboard = lv_keyboard_create(content); From e457d94a867257eea795e78f29c3ac6da8005adc Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:34 -0500 Subject: [PATCH 08/55] Ebooks: Improve Ebooks readability and touch-friendly spacing --- main/main.c | 29 ++++++++++++++++++++++------- tests/ebook_library_test.c | 14 ++++++++++++-- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..edac2ad 100644 --- a/main/main.c +++ b/main/main.c @@ -4591,7 +4591,7 @@ static void ebook_load_page(long offset) ESP_LOGI("tab5-os", "Ebook loaded %u bytes at %ld from %.120s", (unsigned)raw_read, ebook_offset, ebook_path); lv_textarea_set_text(ebook_text, raw_read ? ebook_buffer : "End of book"); lv_obj_scroll_to_y(ebook_text, 0, LV_ANIM_OFF); - lv_label_set_text_fmt(ebook_status, "Page %lu - %ld KB", (unsigned long)(ebook_offset / EBOOK_PAGE_BYTES + 1), ebook_offset / 1024); + lv_label_set_text_fmt(ebook_status, "Page %lu", (unsigned long)(ebook_offset / EBOOK_PAGE_BYTES + 1)); if (ebook_offset) lv_obj_remove_state(ebook_prev, LV_STATE_DISABLED); else lv_obj_add_state(ebook_prev, LV_STATE_DISABLED); if (raw_read == EBOOK_PAGE_BYTES) lv_obj_remove_state(ebook_next, LV_STATE_DISABLED); @@ -4622,8 +4622,8 @@ static void ebook_text_clicked(lv_event_t *event) { lv_obj_t *label = lv_obj_get_child(lv_event_get_target(event), 0); ebook_large_text = !ebook_large_text; - lv_obj_set_style_text_font(ebook_text, ebook_large_text ? &lv_font_montserrat_28 : &lv_font_montserrat_14, 0); - lv_label_set_text(label, ebook_large_text ? "Text: Large" : "Text: Small"); + lv_obj_set_style_text_font(ebook_text, ebook_large_text ? &lv_font_montserrat_48 : &lv_font_montserrat_28, 0); + lv_label_set_text(label, ebook_large_text ? "Large" : "Small"); } static void show_ebook_reader(const char *path) @@ -4652,19 +4652,25 @@ static void show_ebook_reader(const char *path) ebook_next = button(actions, "Next", ebook_next_clicked); lv_obj_add_state(ebook_prev, LV_STATE_DISABLED); lv_obj_add_state(ebook_next, LV_STATE_DISABLED); - lv_obj_t *text_size = button(actions, ebook_large_text ? "Text: Large" : "Text: Small", ebook_text_clicked); + lv_obj_t *text_size = button(actions, ebook_large_text ? "Large" : "Small", ebook_text_clicked); lv_obj_set_size(library, 135, 64); lv_obj_set_size(ebook_prev, 135, 64); lv_obj_set_size(ebook_next, 135, 64); lv_obj_set_size(text_size, 170, 64); - for (size_t i = 0; i < 4; ++i) lv_obj_set_style_text_font(lv_obj_get_child(lv_obj_get_child(actions, i), 0), &lv_font_montserrat_14, 0); + lv_obj_set_style_bg_opa(actions, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(actions, 0, 0); + lv_obj_set_style_pad_all(actions, 0, 0); ebook_text = lv_textarea_create(content); lv_obj_set_size(ebook_text, 640, 860); lv_textarea_set_one_line(ebook_text, false); lv_textarea_set_cursor_click_pos(ebook_text, false); lv_obj_remove_flag(ebook_text, LV_OBJ_FLAG_CLICK_FOCUSABLE); - lv_obj_set_style_text_font(ebook_text, ebook_large_text ? &lv_font_montserrat_28 : &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(ebook_text, ebook_large_text ? &lv_font_montserrat_48 : &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_all(ebook_text, 24, 0); + lv_obj_set_style_text_line_space(ebook_text, 8, 0); + lv_obj_set_style_bg_color(ebook_text, lv_color_hex(0xFFFCF5), 0); + lv_obj_set_style_text_color(ebook_text, lv_color_hex(0x202938), 0); ebook_load_page(0); } @@ -4681,8 +4687,14 @@ static void show_ebooks(void) lv_label_set_text(title, "Ebooks"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); lv_obj_t *list = lv_list_create(content); - lv_obj_set_size(list, 640, 940); + lv_obj_set_size(list, 640, 1040); + lv_obj_set_style_text_font(list, &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_all(list, 12, 0); + lv_obj_set_style_pad_row(list, 8, 0); + lv_obj_set_style_radius(list, 16, 0); lv_obj_t *back = lv_list_add_button(list, LV_SYMBOL_LEFT, "Back to apps"); + lv_obj_set_style_min_height(back, 72, 0); + lv_obj_set_style_pad_all(back, 20, 0); lv_obj_add_event_cb(back, home_clicked, LV_EVENT_CLICKED, NULL); if (!sd_ready) { lv_list_add_text(list, "Insert an SD card to read books"); @@ -4772,6 +4784,9 @@ static void show_ebooks(void) continue; } lv_obj_t *item = lv_list_add_button(list, LV_SYMBOL_FILE, entry->d_name); + lv_obj_set_style_min_height(item, 88, 0); + lv_obj_set_style_pad_all(item, 20, 0); + lv_obj_set_style_pad_column(item, 20, 0); lv_obj_add_event_cb(item, ebook_open_clicked, LV_EVENT_CLICKED, full); } errno = 0; diff --git a/tests/ebook_library_test.c b/tests/ebook_library_test.c index a343f06..3853e9c 100644 --- a/tests/ebook_library_test.c +++ b/tests/ebook_library_test.c @@ -279,9 +279,19 @@ static lv_timer_t *lv_timer_create(void (*callback)(lv_timer_t *), unsigned peri { assert(callback == ebook_download_tick && period == 500 && !data && !timer_handles); timer_handles++; timer_creates++; return &timer; } static lv_obj_t *lv_label_create(lv_obj_t *parent) { assert(parent == content); return &title; } static void lv_label_set_text(lv_obj_t *object, const char *text) { assert(object == &title && !strcmp(text, "Ebooks")); strcpy(object->text, text); } -static void lv_obj_set_style_text_font(lv_obj_t *object, const int *font, int part) { assert(object == &title && font == &lv_font_montserrat_28 && !part); } +static void lv_obj_set_style_text_font(lv_obj_t *object, const int *font, int part) { assert((object == &title || object == &list) && font == &lv_font_montserrat_28 && !part); } static lv_obj_t *lv_list_create(lv_obj_t *parent) { assert(parent == content); return &list; } -static void lv_obj_set_size(lv_obj_t *object, int width, int height) { assert(object == &list && width == 640 && height == 940); } +static void lv_obj_set_size(lv_obj_t *object, int width, int height) { assert(object == &list && width == 640 && height == 1040); } +static void lv_obj_set_style_pad_all(lv_obj_t *object, int value, int part) +{ assert(!part && ((object == &list && value == 12) || (object >= rows && object < rows + row_count && value == 20))); } +static void lv_obj_set_style_pad_row(lv_obj_t *object, int value, int part) +{ assert(object == &list && value == 8 && !part); } +static void lv_obj_set_style_radius(lv_obj_t *object, int value, int part) +{ assert(object == &list && value == 16 && !part); } +static void lv_obj_set_style_min_height(lv_obj_t *object, int value, int part) +{ assert(object >= rows && object < rows + row_count && value == (object == rows ? 72 : 88) && !part); } +static void lv_obj_set_style_pad_column(lv_obj_t *object, int value, int part) +{ assert(object > rows && object < rows + row_count && value == 20 && !part); } static lv_obj_t *lv_list_add_button(lv_obj_t *parent, const char *symbol, const char *text) { assert(parent == &list && row_count < 80 && (!symbol || !strcmp(symbol, LV_SYMBOL_LEFT) || !strcmp(symbol, LV_SYMBOL_FILE))); From 77ed58b3ad82f0160c8844a5f5dc2536e2724210 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:38 -0500 Subject: [PATCH 09/55] Clock: Improve Clock readability with spacious alarm cards and larger controls --- main/main.c | 61 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..56f9cd2 100644 --- a/main/main.c +++ b/main/main.c @@ -337,7 +337,6 @@ static i2c_master_dev_handle_t rtc; static lv_obj_t *time_label; static lv_obj_t *clock_time; static lv_obj_t *clock_date; -static lv_obj_t *clock_status; static alarm_setting_t alarms[ALARM_COUNT]; static int alarm_last_day[ALARM_COUNT]; static lv_obj_t *alarm_time_labels[ALARM_COUNT]; @@ -2670,8 +2669,6 @@ static void clock_tick(lv_timer_t *timer) else snprintf(text, sizeof(text), "Time not set"); lv_label_set_text(clock_date, text); } - if (clock_status) lv_label_set_text(clock_status, internet_time_synced ? "Synced from internet" : - rtc_time_loaded ? "Running from hardware RTC" : "Connect to Wi-Fi to set the clock"); } static void battery_tick(lv_timer_t *timer) @@ -4169,7 +4166,6 @@ static void clear_content(void) storage_format_armed = false; clock_time = NULL; clock_date = NULL; - clock_status = NULL; for (size_t i = 0; i < ALARM_COUNT; i++) { alarm_time_labels[i] = NULL; alarm_enabled_labels[i] = NULL; @@ -5789,6 +5785,9 @@ static void alarm_update_row(size_t index) lv_label_set_text_fmt(alarm_time_labels[index], "%u:%02u %s", hour ? hour : 12, alarms[index].minute, alarms[index].hour < 12 ? "AM" : "PM"); lv_label_set_text(alarm_enabled_labels[index], alarms[index].enabled ? "ON" : "OFF"); + lv_obj_t *toggle = lv_obj_get_parent(alarm_enabled_labels[index]); + lv_obj_set_style_bg_color(toggle, lv_color_hex(alarms[index].enabled ? 0x009688 : 0x374151), 0); + lv_obj_set_style_border_color(toggle, lv_color_hex(alarms[index].enabled ? 0x009688 : 0x64748b), 0); } static void alarm_edit_clicked(lv_event_t *event) @@ -5810,7 +5809,14 @@ static void alarm_edit_clicked(lv_event_t *event) static lv_obj_t *alarm_control(lv_obj_t *parent, const char *text, int width, unsigned action, lv_obj_t **label_out) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, width, 64); + lv_obj_set_size(control, width, 72); + lv_obj_set_style_radius(control, 14, 0); + lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_all(control, 8, 0); + lv_obj_set_style_bg_color(control, lv_color_hex(0x263449), 0); + lv_obj_set_style_border_width(control, 1, 0); + lv_obj_set_style_border_color(control, lv_color_hex(0x475569), 0); + lv_obj_set_style_shadow_width(control, 0, 0); lv_obj_add_event_cb(control, alarm_edit_clicked, LV_EVENT_CLICKED, (void *)(uintptr_t)action); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -5822,27 +5828,46 @@ static lv_obj_t *alarm_control(lv_obj_t *parent, const char *text, int width, un static void show_clock(void) { clear_content(); - clock_time = lv_label_create(content); + lv_obj_t *face = lv_obj_create(content); + lv_obj_remove_style_all(face); + lv_obj_set_size(face, 650, 190); + lv_obj_set_flex_flow(face, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(face, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_row(face, 18, 0); + clock_time = lv_label_create(face); lv_obj_set_style_text_font(clock_time, &lv_font_montserrat_48, 0); - clock_date = lv_label_create(content); + clock_date = lv_label_create(face); + lv_obj_set_width(clock_date, LV_PCT(100)); + lv_obj_set_style_text_align(clock_date, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_font(clock_date, &lv_font_montserrat_28, 0); - clock_status = lv_label_create(content); lv_obj_t *heading = lv_label_create(content); lv_label_set_text(heading, "Daily alarms"); + lv_obj_set_width(heading, 650); lv_obj_set_style_text_font(heading, &lv_font_montserrat_28, 0); for (size_t i = 0; i < ALARM_COUNT; i++) { - lv_obj_t *row = lv_obj_create(content); + lv_obj_t *card = lv_obj_create(content); + lv_obj_set_size(card, 650, 220); + lv_obj_remove_flag(card, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(card, lv_color_hex(0x1f2937), 0); + lv_obj_set_style_bg_opa(card, LV_OPA_COVER, 0); + lv_obj_set_style_border_width(card, 0, 0); + lv_obj_set_style_radius(card, 20, 0); + lv_obj_set_style_pad_all(card, 20, 0); + alarm_time_labels[i] = lv_label_create(card); + lv_obj_set_style_text_font(alarm_time_labels[i], &lv_font_montserrat_48, 0); + lv_obj_align(alarm_time_labels[i], LV_ALIGN_TOP_LEFT, 0, 8); + lv_obj_t *toggle = alarm_control(card, "OFF", 120, (i << 4) | 4, &alarm_enabled_labels[i]); + lv_obj_align(toggle, LV_ALIGN_TOP_RIGHT, 0, 0); + lv_obj_t *row = lv_obj_create(card); lv_obj_remove_style_all(row); - lv_obj_set_size(row, 650, 76); + lv_obj_set_size(row, LV_PCT(100), 72); + lv_obj_align(row, LV_ALIGN_BOTTOM_LEFT, 0, 0); lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - alarm_time_labels[i] = lv_label_create(row); - lv_obj_set_width(alarm_time_labels[i], 120); - alarm_control(row, "H-", 68, i << 4, NULL); - alarm_control(row, "H+", 68, (i << 4) | 1, NULL); - alarm_control(row, "M-", 68, (i << 4) | 2, NULL); - alarm_control(row, "M+", 68, (i << 4) | 3, NULL); - alarm_control(row, "OFF", 100, (i << 4) | 4, &alarm_enabled_labels[i]); + lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + alarm_control(row, "Hour -", 140, i << 4, NULL); + alarm_control(row, "Hour +", 140, (i << 4) | 1, NULL); + alarm_control(row, "Min -", 140, (i << 4) | 2, NULL); + alarm_control(row, "Min +", 140, (i << 4) | 3, NULL); alarm_update_row(i); } clock_tick(NULL); From 356e5130572c6e7183c0b45d97f9447448ac3518 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:42 -0500 Subject: [PATCH 10/55] System: Make System easier to scan with readable panels and larger controls --- main/main.c | 98 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..252f652 100644 --- a/main/main.c +++ b/main/main.c @@ -5625,6 +5625,34 @@ static void system_self_test(void) assert(!wifi_forget_confirmation_valid(false, 100, 100)); } +static lv_obj_t *system_panel(const char *heading) +{ + lv_obj_t *panel = lv_obj_create(content); + lv_obj_set_size(panel, LV_PCT(100), LV_SIZE_CONTENT); + lv_obj_remove_flag(panel, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(panel, lv_color_hex(0x202838), 0); + lv_obj_set_style_text_color(panel, lv_color_white(), 0); + lv_obj_set_style_border_width(panel, 0, 0); + lv_obj_set_style_radius(panel, 16, 0); + lv_obj_set_style_pad_all(panel, 20, 0); + lv_obj_set_style_pad_row(panel, 16, 0); + lv_obj_set_style_text_font(panel, &lv_font_montserrat_28, 0); + lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_COLUMN); + lv_obj_t *title = lv_label_create(panel); + lv_label_set_text(title, heading); + lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(title, lv_color_hex(0xB69CFF), 0); + return panel; +} + +static lv_obj_t *system_details(lv_obj_t *panel) +{ + lv_obj_t *label = lv_label_create(panel); + lv_obj_set_width(label, LV_PCT(100)); + lv_obj_set_style_text_line_space(label, 10, 0); + return label; +} + static void system_refresh_ota(void) { if (!system_ota_info) return; @@ -5679,6 +5707,12 @@ static void system_clicked(lv_event_t *event) lv_obj_t *title = lv_label_create(content); lv_label_set_text(title, "System"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + lv_obj_set_width(title, LV_PCT(100)); + lv_obj_set_style_pad_row(content, 20, 0); + lv_obj_t *firmware = system_panel("Firmware"); + lv_obj_t *battery = system_panel("Battery"); + lv_obj_t *device = system_panel("Device"); + lv_obj_t *storage = system_panel("Storage & network"); esp_chip_info_t chip; esp_chip_info(&chip); const esp_app_desc_t *app = esp_app_get_description(); @@ -5712,16 +5746,21 @@ static void system_clicked(lv_event_t *event) else snprintf(sd_text, sizeof(sd_text), "mounted but not responding"); } - lv_obj_t *info = lv_label_create(content); + lv_obj_t *version = system_details(firmware); + lv_label_set_text_fmt(version, "Tab5 OS %s", app->version); + system_ota_info = system_details(firmware); + system_refresh_ota(); + ota_button = button(firmware, "Install stable", ota_clicked); + lv_obj_set_size(ota_button, LV_PCT(100), 72); + if (ota_busy) lv_obj_add_state(ota_button, LV_STATE_DISABLED); + ota_status = system_details(firmware); + lv_label_set_text(ota_status, ota_busy ? "Checking stable release manifest..." : ""); + + lv_obj_t *info = system_details(device); lv_label_set_text_fmt(info, - "Tab5 OS %s\nESP-IDF %d.%d.%d | ELF SHA-256: %s...\n\n" "ESP32-P4 rev %d.%d | %d cores\nPanel: %s 720 x 1280\n" "Reset: %s\nUptime: %lu d %02lu:%02lu\n" - "Internal heap: %lu KB free / %lu KB minimum\nPSRAM: %lu KB free / %lu KB total\n\n" - "Settings: %s\nInternal: %s\nSD card: %s\nWi-Fi: %s\n" - "Running app: %s", - app->version, ESP_IDF_VERSION_MAJOR, ESP_IDF_VERSION_MINOR, - ESP_IDF_VERSION_PATCH, elf_hash, + "Internal heap: %lu KB free / %lu KB minimum\nPSRAM: %lu KB free / %lu KB total", chip.revision / 100, chip.revision % 100, chip.cores, bsp_display_get_panel_ic(), reset_reason_name(esp_reset_reason()), (unsigned long)(uptime / 86400), (unsigned long)(uptime / 3600 % 24), @@ -5729,32 +5768,36 @@ static void system_clicked(lv_event_t *event) (unsigned long)(heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) / 1024), (unsigned long)(heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT) / 1024), (unsigned long)(heap_caps_get_free_size(MALLOC_CAP_SPIRAM) / 1024), - (unsigned long)(heap_caps_get_total_size(MALLOC_CAP_SPIRAM) / 1024), + (unsigned long)(heap_caps_get_total_size(MALLOC_CAP_SPIRAM) / 1024)); + lv_obj_t *build_info = system_details(device); + lv_label_set_text_fmt(build_info, "ESP-IDF %d.%d.%d\nELF SHA-256: %s...\nRunning app: %s", + ESP_IDF_VERSION_MAJOR, ESP_IDF_VERSION_MINOR, ESP_IDF_VERSION_PATCH, + elf_hash, running_text); + lv_obj_t *storage_info = system_details(storage); + lv_label_set_text_fmt(storage_info, "Settings: %s\nInternal: %s\nSD card: %s\nWi-Fi: %s", nvs_init_error == ESP_OK ? "ready" : esp_err_to_name(nvs_init_error), internal_text, sd_text, - wifi_connected ? wifi_ip : wifi_ready ? "disconnected" : "unavailable", - running_text); - lv_obj_set_style_text_line_space(info, 8, 0); - system_ota_info = lv_label_create(content); - lv_obj_set_width(system_ota_info, LV_PCT(100)); - lv_obj_set_style_text_line_space(system_ota_info, 8, 0); - system_refresh_ota(); + wifi_connected ? wifi_ip : wifi_ready ? "disconnected" : "unavailable"); storage_format_armed = false; if (!internal_ready) { - storage_status = lv_label_create(content); - lv_obj_set_width(storage_status, 620); + storage_status = system_details(storage); lv_label_set_text(storage_status, "Internal storage could not be mounted. Initialization erases it."); - lv_obj_t *format = button(content, "Initialize internal storage", storage_format_clicked); + lv_obj_t *format = button(storage, "Initialize internal storage", storage_format_clicked); storage_format_label = lv_obj_get_child(format, 0); - lv_obj_set_size(format, 520, 82); + lv_obj_set_size(format, LV_PCT(100), 82); } - battery_metrics = lv_label_create(content); + battery_metrics = system_details(battery); + lv_obj_set_style_text_font(battery_metrics, &lv_font_montserrat_28, 0); lv_label_set_text_fmt(battery_metrics, "%d.%03d V %+d mA %d%%", battery_millivolts / 1000, battery_millivolts % 1000, battery_milliamps, battery_percent); - lv_obj_t *history_title = lv_label_create(content); - lv_label_set_text(history_title, "Battery percentage - last 5 minutes"); - battery_chart = lv_chart_create(content); - lv_obj_set_size(battery_chart, 620, 260); + lv_obj_t *history_title = lv_label_create(battery); + lv_label_set_text(history_title, "Charge (%) · 5 min"); + battery_chart = lv_chart_create(battery); + lv_obj_set_size(battery_chart, LV_PCT(100), 220); + lv_obj_set_style_bg_color(battery_chart, lv_color_hex(0x202838), 0); + lv_obj_set_style_border_color(battery_chart, lv_color_hex(0x465166), 0); + lv_obj_set_style_line_color(battery_chart, lv_color_hex(0x465166), LV_PART_MAIN); + lv_obj_set_style_size(battery_chart, 4, 4, LV_PART_INDICATOR); lv_chart_set_type(battery_chart, LV_CHART_TYPE_LINE); lv_chart_set_point_count(battery_chart, BATTERY_HISTORY_POINTS); lv_chart_set_range(battery_chart, LV_CHART_AXIS_PRIMARY_Y, 0, 100); @@ -5766,13 +5809,6 @@ static void system_clicked(lv_event_t *event) lv_chart_set_next_value(battery_chart, battery_series, battery_history[(first + i) % BATTERY_HISTORY_POINTS]); } - ota_button = button(content, "Install stable", ota_clicked); - lv_obj_set_size(ota_button, 320, 82); - if (ota_busy) lv_obj_add_state(ota_button, LV_STATE_DISABLED); - ota_status = lv_label_create(content); - lv_label_set_text(ota_status, ota_busy ? "Checking stable release manifest..." : - "Manifest version, hardware, size, URL, and SHA-256 are verified before activation"); - lv_obj_set_width(ota_status, 620); ota_timer = lv_timer_create(ota_tick, 250, NULL); } From cdd9f643389311be7b9c10f8b3ac65cbf32ad9c6 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:46 -0500 Subject: [PATCH 11/55] Scope: Improve Scope readability with larger controls and a dark waveform chart --- main/main.c | 61 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 22 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..0ac9141 100644 --- a/main/main.c +++ b/main/main.c @@ -496,6 +496,7 @@ static lv_timer_t *scope_timer; static lv_obj_t *scope_chart; static lv_chart_series_t *scope_series; static lv_obj_t *scope_stats; +static int32_t scope_previous_row_gap; static lv_obj_t *scope_channel_label; static lv_obj_t *scope_run_label; static lv_obj_t *scope_rate_label; @@ -2021,6 +2022,7 @@ static void scope_task(void *argument) static void scope_release(void) { + lv_obj_set_style_pad_row(content, scope_previous_row_gap, 0); portENTER_CRITICAL(&scope_lock); scope_active = false; portEXIT_CRITICAL(&scope_lock); @@ -2059,7 +2061,7 @@ static void scope_update_controls(void) lv_label_set_text_fmt(scope_level_label, "Trigger %u mV", scope_trigger_mv); if (scope_offset_label) lv_label_set_text_fmt(scope_offset_label, "Offset\n%d mV", (int)offset_mv); if (scope_gain_label) - lv_label_set_text_fmt(scope_gain_label, "Scale\n%u.%u%%", + lv_label_set_text_fmt(scope_gain_label, "Gain\n%u.%u%%", (unsigned)(gain_permille / 10), (unsigned)(gain_permille % 10)); } @@ -2076,7 +2078,7 @@ static void scope_tick(lv_timer_t *timer) size_t start; if (!scope_window_start(scope_snapshot, count, scope_trigger_mode, scope_trigger_mv, &start)) { - lv_label_set_text(scope_stats, scope_error ? "ADC error" : "Waiting for trigger..."); + lv_label_set_text(scope_stats, scope_error ? "ADC error" : count < SCOPE_CHART_POINTS ? "Acquiring samples..." : "Waiting for trigger..."); return; } uint32_t sum = 0; @@ -2102,8 +2104,9 @@ static void scope_tick(lv_timer_t *timer) else snprintf(timing, sizeof(timing), "Freq -- Duty --"); lv_label_set_text_fmt(scope_stats, - "Now %u.%03u V Min %u.%03u Max %u.%03u Vpp %u.%03u\n" - "Avg %u.%03u V %s %lu kS/s", + "Now %u.%03u V Min %u.%03u V\n" + "Max %u.%03u V Vpp %u.%03u V\n" + "Avg %u.%03u V\n%s %lu kS/s", now / 1000, now % 1000, minimum / 1000, minimum % 1000, maximum / 1000, maximum % 1000, peak_to_peak / 1000, peak_to_peak % 1000, average / 1000, average % 1000, timing, @@ -6583,7 +6586,10 @@ static lv_obj_t *scope_control(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback, void *user_data, lv_obj_t **label_out) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, width, 60); + lv_obj_set_size(control, width, 72); + lv_obj_set_style_radius(control, 14, 0); + lv_obj_set_style_pad_all(control, 4, 0); + lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -6596,9 +6602,10 @@ static lv_obj_t *scope_row(void) { lv_obj_t *row = lv_obj_create(content); lv_obj_remove_style_all(row); - lv_obj_set_size(row, 650, 64); + lv_obj_set_size(row, 650, 72); + lv_obj_set_style_pad_column(row, 12, 0); lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_align(row, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); return row; } @@ -6611,8 +6618,10 @@ static void scope_clicked(lv_event_t *event) static void show_scope(void) { clear_content(); + scope_previous_row_gap = lv_obj_get_style_pad_row(content, 0); if (!shared_i2c_pins_available()) return; lv_obj_clear_flag(content, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_pad_row(content, 16, 0); if (!scope_ring) { scope_ring = heap_caps_calloc(SCOPE_RING_POINTS, sizeof(*scope_ring), MALLOC_CAP_SPIRAM); scope_snapshot = heap_caps_calloc(SCOPE_RING_POINTS, sizeof(*scope_snapshot), MALLOC_CAP_SPIRAM); @@ -6629,16 +6638,22 @@ static void show_scope(void) } } lv_obj_t *title = lv_label_create(content); - lv_label_set_text(title, "ADC Oscilloscope"); + lv_label_set_text(title, "Scope"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); scope_stats = lv_label_create(content); - lv_obj_set_width(scope_stats, 650); + lv_obj_set_size(scope_stats, 650, 136); + lv_obj_set_style_text_font(scope_stats, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(scope_stats, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(scope_stats, "Starting ADC..."); scope_chart = lv_chart_create(content); lv_obj_set_size(scope_chart, 650, 420); + lv_obj_set_style_bg_color(scope_chart, lv_color_hex(0x18222e), 0); + lv_obj_set_style_border_color(scope_chart, lv_color_hex(0x394655), 0); + lv_obj_set_style_line_color(scope_chart, lv_color_hex(0x394655), LV_PART_MAIN); + lv_obj_set_style_line_width(scope_chart, 2, LV_PART_ITEMS); + lv_obj_set_style_size(scope_chart, 0, 0, LV_PART_INDICATOR); lv_chart_set_type(scope_chart, LV_CHART_TYPE_LINE); lv_chart_set_point_count(scope_chart, SCOPE_CHART_POINTS); lv_chart_set_range(scope_chart, LV_CHART_AXIS_PRIMARY_Y, 0, scope_ranges_mv[scope_range_index]); @@ -6647,37 +6662,39 @@ static void show_scope(void) lv_chart_set_series_ext_y_array(scope_chart, scope_series, scope_chart_points); lv_obj_t *row = scope_row(); - scope_control(row, "G16", 130, scope_channel_clicked, NULL, &scope_channel_label); - scope_control(row, "HOLD", 130, scope_run_clicked, NULL, &scope_run_label); - scope_control(row, "6 ms/div", 250, scope_rate_clicked, NULL, &scope_rate_label); + scope_control(row, "G16", 208, scope_channel_clicked, NULL, &scope_channel_label); + scope_control(row, "HOLD", 208, scope_run_clicked, NULL, &scope_run_label); + scope_control(row, "6 ms/div", 210, scope_rate_clicked, NULL, &scope_rate_label); row = scope_row(); - scope_control(row, "330 mV/div", 250, scope_scale_clicked, NULL, &scope_scale_label); - scope_control(row, "AUTO", 250, scope_trigger_clicked, NULL, &scope_trigger_label); + scope_control(row, "330 mV/div", 319, scope_scale_clicked, NULL, &scope_scale_label); + scope_control(row, "AUTO", 319, scope_trigger_clicked, NULL, &scope_trigger_label); row = scope_row(); scope_control(row, LV_SYMBOL_MINUS, 100, scope_level_clicked, (void *)(intptr_t)-100, NULL); scope_level_label = lv_label_create(row); - lv_obj_set_width(scope_level_label, 260); + lv_obj_set_width(scope_level_label, 426); + lv_obj_set_style_text_font(scope_level_label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(scope_level_label, LV_TEXT_ALIGN_CENTER, 0); scope_control(row, LV_SYMBOL_PLUS, 100, scope_level_clicked, (void *)(intptr_t)100, NULL); row = scope_row(); - scope_control(row, "Offset\n0 mV", 180, scope_offset_clicked, NULL, &scope_offset_label); - scope_control(row, "Scale\n100.0%", 180, scope_gain_clicked, NULL, &scope_gain_label); - scope_control(row, "RESET CAL", 180, scope_calibration_reset_clicked, NULL, NULL); + scope_control(row, "Offset\n0 mV", 208, scope_offset_clicked, NULL, &scope_offset_label); + scope_control(row, "Gain\n100.0%", 208, scope_gain_clicked, NULL, &scope_gain_label); + scope_control(row, "Reset cal", 210, scope_calibration_reset_clicked, NULL, NULL); row = scope_row(); - scope_control(row, "SAVE CSV", 180, scope_capture_clicked, NULL, NULL); + scope_control(row, "Save CSV", 208, scope_capture_clicked, NULL, NULL); scope_capture_status = lv_label_create(row); - lv_obj_set_width(scope_capture_status, 420); + lv_obj_set_width(scope_capture_status, 430); lv_obj_set_style_text_align(scope_capture_status, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_long_mode(scope_capture_status, LV_LABEL_LONG_WRAP); lv_label_set_text(scope_capture_status, scope_capture_notice[0] ? scope_capture_notice : - "Save the visible 300-point chart to SD"); + ""); lv_obj_t *warning = lv_label_create(content); - lv_label_set_text(warning, "Inputs: G16 G18 G19 G49 G50 G51 G53 G54 | 0-3.3V only"); + lv_label_set_text(warning, "0-3.3 V input"); + lv_obj_set_style_text_font(warning, &lv_font_montserrat_28, 0); lv_obj_set_width(warning, 650); lv_obj_set_style_text_align(warning, LV_TEXT_ALIGN_CENTER, 0); From 240b67e9f53482bf7f6f3de97abf45cbdef46bb0 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:50 -0500 Subject: [PATCH 12/55] Weather: Improve Weather readability with larger text and clearer forecast cards --- main/main.c | 103 +++++++++++++++++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 34 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..0a90692 100644 --- a/main/main.c +++ b/main/main.c @@ -7613,23 +7613,33 @@ static void weather_short_time(const char *iso, char output[12]) snprintf(output, 12, "%d:%02d %s", hour % 12 ? hour % 12 : 12, minute, hour < 12 ? "AM" : "PM"); } +/* Weather-only surfaces keep the forecast legible against the OS background. */ +static void weather_surface(lv_obj_t *obj) +{ + lv_obj_set_style_bg_color(obj, lv_color_hex(0x202938), 0); + lv_obj_set_style_text_color(obj, lv_color_hex(0xF5F7FA), 0); + lv_obj_set_style_border_width(obj, 0, 0); + lv_obj_set_style_radius(obj, 16, 0); +} + static void weather_render(void) { if (!weather_body || !weather_has_data) return; lv_obj_clean(weather_body); lv_obj_t *place = lv_label_create(weather_body); lv_label_set_text(place, weather_data.place); - lv_obj_set_width(place, 600); + lv_obj_set_width(place, 630); lv_obj_set_style_text_font(place, &lv_font_montserrat_28, 0); - lv_obj_set_style_text_align(place, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_align(place, LV_TEXT_ALIGN_LEFT, 0); lv_obj_t *current = lv_obj_create(weather_body); - lv_obj_set_size(current, 610, 245); + lv_obj_set_size(current, 650, LV_SIZE_CONTENT); + weather_surface(current); lv_obj_clear_flag(current, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(current, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(current, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_all(current, 12, 0); - lv_obj_set_style_pad_row(current, 5, 0); + lv_obj_set_style_pad_all(current, 20, 0); + lv_obj_set_style_pad_row(current, 12, 0); lv_obj_t *temperature = lv_label_create(current); lv_label_set_text_fmt(temperature, "%d F", weather_round(weather_data.temperature)); lv_obj_set_style_text_font(temperature, &lv_font_montserrat_48, 0); @@ -7638,14 +7648,16 @@ static void weather_render(void) lv_obj_set_style_text_font(condition, &lv_font_montserrat_28, 0); lv_obj_t *details = lv_label_create(current); lv_label_set_text_fmt(details, - "Feels %d F | Humidity %u%% | Clouds %u%%\n" - "Wind %s %d mph, gusts %d | Pressure %d hPa\n" + "Feels %d F Humidity %u%%\nClouds %u%% " + "Wind %s %d mph, gusts %d\nPressure %d hPa " "Precipitation %d.%02d in", weather_round(weather_data.apparent), weather_data.humidity, weather_data.cloud, weather_wind_direction(weather_data.wind_direction), weather_round(weather_data.wind), weather_round(weather_data.gust), weather_round(weather_data.pressure), (int)(weather_data.precipitation * 100) / 100, (int)(weather_data.precipitation * 100) % 100); - lv_obj_set_width(details, 570); + lv_obj_set_width(details, 610); + lv_obj_set_style_text_font(details, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(details, 8, 0); lv_obj_set_style_text_align(details, LV_TEXT_ALIGN_CENTER, 0); if (weather_data.day_count) { char sunrise[12], sunset[12]; @@ -7653,13 +7665,18 @@ static void weather_render(void) weather_short_time(weather_data.daily[0].sunset, sunset); lv_obj_t *sun = lv_label_create(current); lv_label_set_text_fmt(sun, "Sunrise %s | Sunset %s", sunrise, sunset); + lv_obj_set_width(sun, 610); + lv_obj_set_style_text_align(sun, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_font(sun, &lv_font_montserrat_28, 0); } lv_obj_t *hourly_title = lv_label_create(weather_body); lv_label_set_text(hourly_title, "Next 12 hours"); lv_obj_set_style_text_font(hourly_title, &lv_font_montserrat_28, 0); lv_obj_t *hourly = lv_obj_create(weather_body); - lv_obj_set_size(hourly, 610, 170); + lv_obj_set_size(hourly, 650, 220); + weather_surface(hourly); + lv_obj_set_scroll_dir(hourly, LV_DIR_HOR); lv_obj_set_flex_flow(hourly, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(hourly, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_style_pad_all(hourly, 8, 0); @@ -7667,7 +7684,9 @@ static void weather_render(void) for (uint8_t i = 0; i < weather_data.hour_count; i++) { weather_hour_t *hour = &weather_data.hourly[i]; lv_obj_t *card = lv_obj_create(hourly); - lv_obj_set_size(card, 130, 135); + lv_obj_set_size(card, 190, 188); + weather_surface(card); + lv_obj_set_style_bg_color(card, lv_color_hex(0x101820), 0); lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(card, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -7678,7 +7697,8 @@ static void weather_render(void) lv_obj_t *label = lv_label_create(card); lv_label_set_text_fmt(label, "%s\n%d F\n%u%% rain\n%s", time, weather_round(hour->temperature), (unsigned)hour->precipitation, weather_condition(hour->code)); - lv_obj_set_width(label, 115); + lv_obj_set_width(label, 176); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); } @@ -7688,16 +7708,21 @@ static void weather_render(void) for (uint8_t i = 0; i < weather_data.day_count; i++) { weather_day_t *day = &weather_data.daily[i]; lv_obj_t *row = lv_obj_create(weather_body); - lv_obj_set_size(row, 610, 70); + lv_obj_set_size(row, 650, LV_SIZE_CONTENT); + weather_surface(row); lv_obj_clear_flag(row, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_all(row, 10, 0); + lv_obj_set_style_pad_all(row, 18, 0); lv_obj_t *label = lv_label_create(row); - lv_label_set_text_fmt(label, "%c%c/%c%c %s %u%% rain %d / %d F", + lv_label_set_text_fmt(label, "%c%c/%c%c %s\n%u%% rain", day->date[5], day->date[6], day->date[8], day->date[9], weather_condition(day->code), - (unsigned)day->precipitation, weather_round(day->high), weather_round(day->low)); - lv_obj_set_width(label, 570); + (unsigned)day->precipitation); + lv_obj_set_width(label, 380); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(label, 8, 0); + lv_obj_t *range = lv_label_create(row); + lv_label_set_text_fmt(range, "%d / %d F", weather_round(day->high), weather_round(day->low)); + lv_obj_set_style_text_font(range, &lv_font_montserrat_28, 0); + lv_obj_align(range, LV_ALIGN_RIGHT_MID, 0, 0); } lv_obj_t *source = lv_label_create(weather_body); lv_label_set_text(source, "Weather data: Open-Meteo"); @@ -7759,7 +7784,7 @@ static void weather_tick(lv_timer_t *timer) (void)timer; if (!weather_done || !weather_status) return; weather_done = false; - lv_label_set_text(weather_status, weather_ok ? "Forecast updated" : weather_error); + lv_label_set_text(weather_status, weather_ok ? "" : weather_error); if (weather_ok) { lv_textarea_set_text(weather_location_area, weather_location); weather_render(); @@ -7769,40 +7794,45 @@ static void weather_tick(lv_timer_t *timer) static void show_weather(void) { clear_content(); - lv_obj_set_style_pad_row(content, 10, 0); + lv_obj_set_style_pad_row(content, 16, 0); lv_obj_t *title = lv_label_create(content); lv_label_set_text(title, "Weather"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); lv_obj_t *search = lv_obj_create(content); - lv_obj_set_size(search, 650, 76); + lv_obj_set_size(search, 650, 158); + weather_surface(search); lv_obj_clear_flag(search, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(search, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(search, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_all(search, 4, 0); + lv_obj_set_flex_flow(search, LV_FLEX_FLOW_ROW_WRAP); + lv_obj_set_flex_align(search, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_all(search, 10, 0); + lv_obj_set_style_pad_gap(search, 10, 0); weather_location_area = lv_textarea_create(search); - lv_obj_set_size(weather_location_area, 385, 62); + lv_obj_set_size(weather_location_area, 628, 64); lv_textarea_set_one_line(weather_location_area, true); + lv_textarea_set_placeholder_text(weather_location_area, "City or postal code"); + lv_obj_set_style_text_font(weather_location_area, &lv_font_montserrat_28, 0); lv_textarea_set_max_length(weather_location_area, sizeof(weather_location) - 1); lv_textarea_set_text(weather_location_area, weather_location); lv_obj_add_event_cb(weather_location_area, weather_search_clicked, LV_EVENT_READY, NULL); lv_obj_t *find = button(search, "Find", weather_search_clicked); - lv_obj_set_size(find, 110, 62); + lv_obj_set_size(find, 300, 64); lv_obj_t *keys = button(search, weather_keyboard_visible ? "Hide" : "Keys", weather_keys_clicked); weather_keys_label = lv_obj_get_child(keys, 0); - lv_obj_set_size(keys, 125, 62); + lv_obj_set_size(keys, 318, 64); lv_obj_t *tools = lv_obj_create(content); - lv_obj_set_size(tools, 650, 58); + lv_obj_set_size(tools, 650, 72); + weather_surface(tools); lv_obj_clear_flag(tools, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(tools, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(tools, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_set_style_pad_all(tools, 3, 0); weather_status = lv_label_create(tools); - lv_obj_set_width(weather_status, 450); - lv_label_set_text(weather_status, weather_busy ? "Updating forecast..." : weather_has_data ? "Saved forecast" : "Ready"); + lv_obj_set_width(weather_status, 440); + lv_label_set_text(weather_status, weather_busy ? "Updating forecast..." : weather_has_data ? "" : "No forecast"); lv_obj_t *refresh = button(tools, "Refresh", weather_refresh_clicked); - lv_obj_set_size(refresh, 150, 52); + lv_obj_set_size(refresh, 170, 64); weather_body = lv_obj_create(content); lv_obj_set_width(weather_body, 650); @@ -7810,13 +7840,18 @@ static void show_weather(void) lv_obj_clear_flag(weather_body, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(weather_body, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(weather_body, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_all(weather_body, 8, 0); - lv_obj_set_style_pad_row(weather_body, 10, 0); + lv_obj_set_style_pad_all(weather_body, 0, 0); + lv_obj_set_style_bg_opa(weather_body, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(weather_body, 0, 0); + lv_obj_set_style_text_color(weather_body, lv_color_hex(0xF5F7FA), 0); + lv_obj_set_style_pad_row(weather_body, 16, 0); if (weather_has_data) weather_render(); else { lv_obj_t *message = lv_label_create(weather_body); - lv_label_set_text(message, "Search for a city or postal code to load weather."); + lv_label_set_text(message, wifi_connected ? "No forecast" : "Wi-Fi disconnected"); lv_obj_set_width(message, 600); + lv_obj_set_style_text_font(message, &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_ver(message, 64, 0); lv_obj_set_style_text_align(message, LV_TEXT_ALIGN_CENTER, 0); } From ee6869b2a0cd455b1c28ffbc50735113cc458131 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:54 -0500 Subject: [PATCH 13/55] Govee: Improve Govee readability with compact dark reading cards and clearer Bluetooth states --- main/main.c | 74 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 24 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..cf3ff47 100644 --- a/main/main.c +++ b/main/main.c @@ -6717,12 +6717,12 @@ static void govee_tick(lv_timer_t *timer) bool scanning = govee_scanning; portEXIT_CRITICAL(&govee_lock); if (govee_toggle_label) - lv_label_set_text(govee_toggle_label, enabled ? "Turn Govee Bluetooth off" : "Turn Govee Bluetooth on"); + lv_label_set_text(govee_toggle_label, enabled ? "Turn Bluetooth off" : "Turn Bluetooth on"); if (!enabled) { - lv_label_set_text(govee_status, "Govee Bluetooth is off"); + lv_label_set_text(govee_status, "Bluetooth off"); lv_label_set_text(govee_temperature, "-- F"); lv_label_set_text(govee_humidity, "--% RH"); - lv_label_set_text(govee_details, "Turn on Bluetooth to monitor broadcasts"); + lv_obj_add_flag(govee_details, LV_OBJ_FLAG_HIDDEN); return; } govee_reading_t reading; @@ -6730,12 +6730,16 @@ static void govee_tick(lv_timer_t *timer) int8_t rssi; time_t updated; if (!govee_snapshot(&reading, name, sizeof(name), address, sizeof(address), &rssi, &updated)) { - lv_label_set_text(govee_status, scanning ? "Scanning for a Govee H5075..." : "Bluetooth is unavailable"); + lv_label_set_text(govee_status, scanning ? "Scanning..." : "Bluetooth unavailable"); + lv_label_set_text(govee_temperature, "-- F"); + lv_label_set_text(govee_humidity, "--% RH"); + lv_obj_add_flag(govee_details, LV_OBJ_FLAG_HIDDEN); return; } int age = (int)(time(NULL) - updated); int c_tenths = weather_round(reading.temperature_c * 10.0f); - lv_label_set_text_fmt(govee_status, "%s | updated %d sec ago", name, age < 0 ? 0 : age); + lv_label_set_text_fmt(govee_status, "%s\nUpdated %d sec ago", name, age < 0 ? 0 : age); + lv_obj_remove_flag(govee_details, LV_OBJ_FLAG_HIDDEN); lv_label_set_text_fmt(govee_temperature, "%d F", weather_round(reading.temperature_c * 9.0f / 5.0f + 32.0f)); lv_label_set_text_fmt(govee_humidity, "%d%% RH", weather_round(reading.humidity)); lv_label_set_text_fmt(govee_details, "%s%d.%d C\nSensor battery %u%%\nSignal %d dBm\n%s", @@ -6760,29 +6764,51 @@ static void show_govee(void) lv_obj_t *title = lv_label_create(content); lv_label_set_text(title, "Govee H5075"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + lv_obj_t *toggle = button(content, "Turn Bluetooth on", govee_toggle_clicked); + govee_toggle_label = lv_obj_get_child(toggle, 0); + lv_obj_set_size(toggle, 620, 88); + lv_obj_set_style_bg_color(toggle, lv_color_hex(0x00897B), 0); + govee_status = lv_label_create(content); lv_obj_set_width(govee_status, 620); + lv_obj_set_style_text_font(govee_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(govee_status, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_t *toggle = button(content, "Turn Govee Bluetooth on", govee_toggle_clicked); - govee_toggle_label = lv_obj_get_child(toggle, 0); - lv_obj_set_size(toggle, 520, 82); - - lv_obj_t *card = lv_obj_create(content); - lv_obj_set_size(card, 620, 610); - lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_align(card, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_row(card, 32, 0); - govee_temperature = lv_label_create(card); - lv_obj_set_style_text_font(govee_temperature, &lv_font_montserrat_48, 0); - govee_humidity = lv_label_create(card); - lv_obj_set_style_text_font(govee_humidity, &lv_font_montserrat_48, 0); - govee_details = lv_label_create(card); - lv_obj_set_width(govee_details, 560); + lv_obj_set_style_text_color(govee_status, lv_color_hex(0xCBD5E1), 0); + + lv_obj_t *readings = lv_obj_create(content); + lv_obj_set_size(readings, 620, 240); + lv_obj_set_style_bg_opa(readings, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(readings, 0, 0); + lv_obj_set_style_pad_all(readings, 0, 0); + lv_obj_set_style_pad_column(readings, 20, 0); + lv_obj_clear_flag(readings, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(readings, LV_FLEX_FLOW_ROW); + for (int i = 0; i < 2; ++i) { + lv_obj_t *card = lv_obj_create(readings); + lv_obj_set_size(card, 300, 240); + lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(card, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(card, 0, 0); + lv_obj_set_style_radius(card, 20, 0); + lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(card, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_row(card, 24, 0); + lv_obj_t *label = lv_label_create(card); + lv_label_set_text(label, i == 0 ? "Temperature" : "Humidity"); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(label, lv_color_white(), 0); + lv_obj_t *value = lv_label_create(card); + lv_obj_set_style_text_font(value, &lv_font_montserrat_48, 0); + lv_obj_set_style_text_color(value, lv_color_hex(0x5EEAD4), 0); + if (i == 0) govee_temperature = value; + else govee_humidity = value; + } + govee_details = lv_label_create(content); + lv_obj_set_width(govee_details, 620); + lv_obj_set_style_text_font(govee_details, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(govee_details, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(govee_temperature, "-- F"); - lv_label_set_text(govee_humidity, "--% RH"); - lv_label_set_text(govee_details, "Waiting for a broadcast..."); + lv_obj_set_style_text_line_space(govee_details, 12, 0); + lv_obj_set_style_text_color(govee_details, lv_color_hex(0xCBD5E1), 0); govee_tick(NULL); govee_timer = lv_timer_create(govee_tick, 1000, NULL); } From a81a02656b6de839305bf9cd04e394f8745fb792 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:00:59 -0500 Subject: [PATCH 14/55] Ring: Refine Ring with a clearer heart-rate layout and dark panels --- main/main.c | 75 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 52 insertions(+), 23 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..0545a36 100644 --- a/main/main.c +++ b/main/main.c @@ -610,6 +610,7 @@ static lv_obj_t *ring_hr_label; static lv_obj_t *ring_hr_status; static lv_obj_t *ring_hr_button_label; static lv_obj_t *ring_hr_chart; +static lv_obj_t *ring_chart_empty; static lv_chart_series_t *ring_hr_series; static lv_obj_t *ring_details; static lv_timer_t *ring_timer; @@ -4203,6 +4204,7 @@ static void clear_content(void) ring_hr_status = NULL; ring_hr_button_label = NULL; ring_hr_chart = NULL; + ring_chart_empty = NULL; ring_hr_series = NULL; ring_details = NULL; ride_status = NULL; @@ -7255,6 +7257,10 @@ static void ring_chart_render(void) first = (ring_hr_history_head + RING_HR_HISTORY_POINTS - count) % RING_HR_HISTORY_POINTS; for (uint8_t i = 0; i < count; i++) values[i] = ring_hr_history[(first + i) % RING_HR_HISTORY_POINTS]; portEXIT_CRITICAL(&ring_lock); + if (ring_chart_empty) { + if (count) lv_obj_add_flag(ring_chart_empty, LV_OBJ_FLAG_HIDDEN); + else lv_obj_remove_flag(ring_chart_empty, LV_OBJ_FLAG_HIDDEN); + } lv_chart_set_all_value(ring_hr_chart, ring_hr_series, LV_CHART_POINT_NONE); for (uint8_t i = 0; i < count; i++) lv_chart_set_next_value(ring_hr_chart, ring_hr_series, values[i]); } @@ -7287,25 +7293,25 @@ static void ring_tick(lv_timer_t *timer) hr_error = ring_hr_error; portEXIT_CRITICAL(&ring_lock); lv_label_set_text(ring_status, !enabled ? "Ring Bluetooth is off" : connected ? "Connected" : connecting ? "Connecting..." : found ? "Reconnecting..." : "Scanning..."); - if (ring_toggle_label) lv_label_set_text(ring_toggle_label, enabled ? "Turn Ring Bluetooth off" : "Turn Ring Bluetooth on"); - lv_label_set_text_fmt(ring_battery_label, battery < 0 ? "--%%" : "%d%%", battery); + if (ring_toggle_label) lv_label_set_text(ring_toggle_label, enabled ? "Turn Bluetooth off" : "Turn Bluetooth on"); + lv_label_set_text_fmt(ring_battery_label, battery < 0 ? LV_SYMBOL_BATTERY_EMPTY " --" : LV_SYMBOL_BATTERY_FULL " %d%%", battery); if (ring_hr_label) lv_label_set_text_fmt(ring_hr_label, heart_rate < 0 ? "-- BPM" : "%d BPM", heart_rate); if (ring_hr_button_label) lv_label_set_text(ring_hr_button_label, hr_active ? "Measuring..." : "Measure now"); if (ring_hr_status) { if (ring_storage_error[0]) lv_label_set_text(ring_hr_status, ring_storage_error); - else if (!enabled) lv_label_set_text(ring_hr_status, "Turn on Ring Bluetooth to connect"); - else if (!connected) lv_label_set_text(ring_hr_status, "Ring is disconnected"); + else if (!enabled) lv_label_set_text(ring_hr_status, ""); + else if (!connected) lv_label_set_text(ring_hr_status, ""); else if (hr_active) lv_label_set_text(ring_hr_status, "Measuring - keep your hand still"); else if (sync_active) lv_label_set_text(ring_hr_status, "Syncing stored heart-rate history..."); else if (hr_error == 1) lv_label_set_text(ring_hr_status, "Adjust the ring for better skin contact"); else if (hr_error == 2) lv_label_set_text(ring_hr_status, "No reading yet - keep your hand still"); - else lv_label_set_text(ring_hr_status, "Ring records every 5 min, even while away"); + else lv_label_set_text(ring_hr_status, ""); } ring_chart_render(); if (!enabled) { - lv_label_set_text(ring_details, "Ring Bluetooth is off"); + lv_label_set_text(ring_details, ""); } else if (!found) { - lv_label_set_text(ring_details, "Looking for COLMI R12..."); + lv_label_set_text(ring_details, ""); } else { int age = updated ? (int)(time(NULL) - updated) : 0; if (updated) @@ -7377,41 +7383,64 @@ static void show_ring(void) lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); ring_status = lv_label_create(content); lv_obj_set_width(ring_status, 620); + lv_obj_set_style_text_font(ring_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(ring_status, LV_TEXT_ALIGN_CENTER, 0); lv_obj_t *toggle = button(content, "Turn Ring Bluetooth on", ring_toggle_clicked); ring_toggle_label = lv_obj_get_child(toggle, 0); - lv_obj_set_size(toggle, 520, 82); + lv_obj_set_size(toggle, 620, 82); lv_obj_t *card = lv_obj_create(content); - lv_obj_set_size(card, 620, 500); + lv_obj_set_size(card, 620, 380); lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_align(card, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_row(card, 20, 0); + lv_obj_set_style_bg_color(card, lv_color_hex(0x202837), 0); + lv_obj_set_style_border_width(card, 0, 0); + lv_obj_set_style_radius(card, 20, 0); + lv_obj_set_style_text_color(card, lv_color_white(), 0); + lv_obj_set_style_pad_all(card, 24, 0); + lv_obj_t *metric = lv_label_create(card); + lv_label_set_text(metric, "Heart rate"); + lv_obj_set_style_text_font(metric, &lv_font_montserrat_28, 0); + lv_obj_align(metric, LV_ALIGN_TOP_LEFT, 0, 0); ring_battery_label = lv_label_create(card); lv_obj_set_style_text_font(ring_battery_label, &lv_font_montserrat_28, 0); + lv_obj_align(ring_battery_label, LV_ALIGN_TOP_RIGHT, 0, 0); ring_hr_label = lv_label_create(card); lv_label_set_text(ring_hr_label, "-- BPM"); lv_obj_set_style_text_font(ring_hr_label, &lv_font_montserrat_48, 0); + lv_obj_align(ring_hr_label, LV_ALIGN_TOP_LEFT, 0, 64); ring_hr_status = lv_label_create(card); - lv_obj_set_width(ring_hr_status, 560); - lv_obj_set_style_text_align(ring_hr_status, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_width(ring_hr_status, 572); + lv_obj_set_style_text_font(ring_hr_status, &lv_font_montserrat_28, 0); + lv_obj_align(ring_hr_status, LV_ALIGN_TOP_LEFT, 0, 130); lv_obj_t *measure = button(card, "Measure now", ring_hr_clicked); ring_hr_button_label = lv_obj_get_child(measure, 0); - lv_obj_set_size(measure, 520, 82); - ring_details = lv_label_create(card); - lv_obj_set_width(ring_details, 560); - lv_obj_set_style_text_align(ring_details, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_t *disclaimer = lv_label_create(card); - lv_label_set_text(disclaimer, "Wellness estimate - not a medical measurement"); + lv_obj_set_size(measure, 572, 82); + lv_obj_align(measure, LV_ALIGN_BOTTOM_MID, 0, 0); lv_obj_t *chart_title = lv_label_create(content); - lv_label_set_text(chart_title, "Heart rate - last 5 hours"); + lv_label_set_text(chart_title, "Heart rate · 5 hours"); + lv_obj_set_width(chart_title, 620); + lv_obj_set_style_text_font(chart_title, &lv_font_montserrat_28, 0); ring_hr_chart = lv_chart_create(content); - lv_obj_set_size(ring_hr_chart, 620, 260); + lv_obj_set_size(ring_hr_chart, 620, 240); + lv_obj_set_style_bg_color(ring_hr_chart, lv_color_hex(0x202837), 0); + lv_obj_set_style_border_width(ring_hr_chart, 0, 0); + lv_obj_set_style_radius(ring_hr_chart, 20, 0); + lv_obj_set_style_line_color(ring_hr_chart, lv_color_hex(0x3B4658), LV_PART_MAIN); + lv_obj_set_style_line_width(ring_hr_chart, 3, LV_PART_ITEMS); lv_chart_set_type(ring_hr_chart, LV_CHART_TYPE_LINE); lv_chart_set_point_count(ring_hr_chart, RING_HR_HISTORY_POINTS); lv_chart_set_range(ring_hr_chart, LV_CHART_AXIS_PRIMARY_Y, 40, 200); lv_chart_set_div_line_count(ring_hr_chart, 5, 6); - ring_hr_series = lv_chart_add_series(ring_hr_chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); + ring_hr_series = lv_chart_add_series(ring_hr_chart, lv_color_hex(0xFF6B81), LV_CHART_AXIS_PRIMARY_Y); + ring_chart_empty = lv_label_create(ring_hr_chart); + lv_label_set_text(ring_chart_empty, "No heart-rate history"); + lv_obj_set_style_text_font(ring_chart_empty, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(ring_chart_empty, lv_color_white(), 0); + lv_obj_set_style_bg_color(ring_chart_empty, lv_color_hex(0x202837), 0); + lv_obj_set_style_bg_opa(ring_chart_empty, LV_OPA_COVER, 0); + lv_obj_set_style_pad_all(ring_chart_empty, 12, 0); + lv_obj_center(ring_chart_empty); + ring_details = lv_label_create(content); + lv_obj_set_width(ring_details, 620); ring_tick(NULL); ring_timer = lv_timer_create(ring_tick, 1000, NULL); } From 9110f39a566599176f5dfbd2d7618d26cb7a43f2 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:03 -0500 Subject: [PATCH 15/55] =?UTF-8?q?Servo=20Toy:=20Improve=20Servo=20Toy?= =?UTF-8?q?=E2=80=99s=20layout=20with=20larger=20controls=20and=20clearer?= =?UTF-8?q?=20status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/main.c | 76 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..734bed3 100644 --- a/main/main.c +++ b/main/main.c @@ -7531,45 +7531,69 @@ static void show_servo(void) { clear_content(); if (!shared_i2c_pins_available()) return; - lv_obj_t *title = lv_label_create(content); + /* Keep spacing local so other apps retain their content styles. */ + lv_obj_t *panel = lv_obj_create(content); + lv_obj_remove_style_all(panel); + lv_obj_set_size(panel, 640, LV_SIZE_CONTENT); + lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(panel, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_row(panel, 20, 0); + lv_obj_remove_flag(panel, LV_OBJ_FLAG_SCROLLABLE); + + lv_obj_t *title = lv_label_create(panel); lv_label_set_text(title, "Servo Toy"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - servo_status = lv_label_create(content); - lv_label_set_text(servo_status, "Stopped - outputs off"); - servo_position = lv_label_create(content); + + lv_obj_t *readout = lv_obj_create(panel); + lv_obj_set_size(readout, 640, 180); + lv_obj_set_style_bg_color(readout, lv_color_hex(0x202938), 0); + lv_obj_set_style_text_color(readout, lv_color_white(), 0); + lv_obj_set_style_border_width(readout, 0, 0); + lv_obj_set_style_radius(readout, 20, 0); + lv_obj_remove_flag(readout, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(readout, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(readout, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_style_pad_row(readout, 16, 0); + servo_position = lv_label_create(readout); lv_label_set_text(servo_position, "90 deg"); lv_obj_set_style_text_font(servo_position, &lv_font_montserrat_48, 0); + servo_status = lv_label_create(readout); + lv_obj_set_width(servo_status, LV_PCT(100)); + lv_obj_set_style_text_font(servo_status, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_align(servo_status, LV_TEXT_ALIGN_CENTER, 0); + lv_label_set_text(servo_status, "Stopped - outputs off"); - lv_obj_t *mode = button(content, "Motion: Sine", servo_mode_clicked); + lv_obj_t *mode = button(panel, "Motion: Sine", servo_mode_clicked); servo_mode_label = lv_obj_get_child(mode, 0); - lv_obj_set_size(mode, 620, 72); + lv_obj_set_size(mode, 640, 96); + lv_obj_set_style_bg_color(mode, lv_color_hex(0x202938), 0); - lv_obj_t *controls = lv_obj_create(content); - lv_obj_set_size(controls, 620, 100); - lv_obj_remove_flag(controls, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(controls, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(controls, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_t *range = button(controls, "Range: Medium", servo_range_clicked); + lv_obj_t *range = button(panel, "Range: Medium", servo_range_clicked); servo_range_label = lv_obj_get_child(range, 0); - lv_obj_set_size(range, 270, 72); - lv_obj_t *rate = button(controls, "Freq: 0.25 Hz", servo_rate_clicked); + lv_obj_set_size(range, 640, 96); + lv_obj_set_style_bg_color(range, lv_color_hex(0x202938), 0); + lv_obj_t *rate = button(panel, "Freq: 0.25 Hz", servo_rate_clicked); servo_rate_label = lv_obj_get_child(rate, 0); - lv_obj_set_size(rate, 270, 72); - - lv_obj_t *hint = lv_label_create(content); - lv_obj_set_width(hint, 620); - lv_label_set_text(hint, "Sine frequency is full back-and-forth cycles per second.\nTap Motion to switch modes; switching stops the servo."); + lv_obj_set_size(rate, 640, 96); + lv_obj_set_style_bg_color(rate, lv_color_hex(0x202938), 0); - lv_obj_t *start = button(content, "START", servo_start_clicked); - lv_obj_set_size(start, 620, 110); - lv_obj_t *stop = button(content, "STOP", servo_stop_clicked); - lv_obj_set_size(stop, 620, 150); + lv_obj_t *actions = lv_obj_create(panel); + lv_obj_remove_style_all(actions); + lv_obj_set_size(actions, 640, 112); + lv_obj_remove_flag(actions, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW); + lv_obj_set_style_pad_column(actions, 20, 0); + lv_obj_t *start = button(actions, LV_SYMBOL_PLAY " Start", servo_start_clicked); + lv_obj_set_size(start, 310, 112); + lv_obj_t *stop = button(actions, LV_SYMBOL_STOP " Stop", servo_stop_clicked); + lv_obj_set_size(stop, 310, 112); lv_obj_set_style_bg_color(stop, lv_color_hex(0xC62828), 0); - lv_obj_t *wiring = lv_label_create(content); - lv_obj_set_width(wiring, 620); + lv_obj_t *wiring = lv_label_create(panel); + lv_obj_set_width(wiring, 640); + lv_obj_set_style_text_font(wiring, &lv_font_montserrat_28, 0); lv_label_set_long_mode(wiring, LV_LABEL_LONG_WRAP); - lv_label_set_text_fmt(wiring, "G%d: servo signal\nG%d: LED driver signal\nUse external 5V servo power and common ground. Use a resistor and transistor/MOSFET for the LED. Leaving this app turns both outputs off.", SERVO_PIN, TOY_LED_PIN); + lv_label_set_text_fmt(wiring, "G%d Servo G%d LED driver\nExternal 5V servo power + common ground.\nLED requires a resistor + transistor/MOSFET.", SERVO_PIN, TOY_LED_PIN); servo_update_labels(); servo_timer = lv_timer_create(servo_tick, servo_sine_mode ? 20 : 50, NULL); } From ea349263c263ab3866f5c83d2dd511ecd6356288 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:07 -0500 Subject: [PATCH 16/55] Cycling: Improve Cycling dashboard readability and touch controls --- main/main.c | 65 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 17 deletions(-) diff --git a/main/main.c b/main/main.c index ab4718f..1a2b5aa 100644 --- a/main/main.c +++ b/main/main.c @@ -7143,7 +7143,7 @@ static void cycling_tick(lv_timer_t *timer) connecting ? "Connecting to KICKR..." : connected ? "Reading KICKR services..." : found ? "KICKR disconnected - scanning..." : "Wake the KICKR by pedaling"); if (ride_toggle_label) - lv_label_set_text(ride_toggle_label, enabled ? "Turn KICKR Bluetooth off" : "Turn KICKR Bluetooth on"); + lv_label_set_text(ride_toggle_label, enabled ? "KICKR Bluetooth: On" : "KICKR Bluetooth: Off"); lv_label_set_text_fmt(ride_power_label, data.has_power ? "%d W" : "-- W", data.power_w); /* LVGL's formatter has float support disabled; libc snprintf supports it. */ char cadence_text[32]; @@ -7152,7 +7152,7 @@ static void cycling_tick(lv_timer_t *timer) lv_label_set_text_fmt(ride_hr_label, heart_rate > 0 ? "%d BPM" : "-- BPM", heart_rate); unsigned elapsed = ride_recording ? pdTICKS_TO_MS(ticks - ride_started_tick) / 1000 : 0; char stats_text[160]; - snprintf(stats_text, sizeof(stats_text), "%.1f mph | %.2f mi | %.1f kJ | %02u:%02u:%02u", + snprintf(stats_text, sizeof(stats_text), "%.1f mph %.2f mi %.1f kJ\n%02u:%02u:%02u", data.speed_kmh * 0.621371f, ride_distance_km * 0.621371f, ride_work_kj, elapsed / 3600, elapsed / 60 % 60, elapsed % 60); lv_label_set_text(ride_stats, stats_text); @@ -7201,18 +7201,34 @@ static void cycling_clicked(lv_event_t *event) static void show_cycling(void) { clear_content(); - lv_obj_t *title = lv_label_create(content); + /* Keep the dashboard self-contained so shared content styles are untouched. */ + lv_obj_t *dashboard = lv_obj_create(content); + lv_obj_set_size(dashboard, 664, LV_SIZE_CONTENT); + lv_obj_set_style_bg_opa(dashboard, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(dashboard, 0, 0); + lv_obj_set_style_pad_all(dashboard, 0, 0); + lv_obj_set_style_pad_row(dashboard, 20, 0); + lv_obj_clear_flag(dashboard, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(dashboard, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(dashboard, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_t *title = lv_label_create(dashboard); lv_label_set_text(title, "Cycling"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - ride_status = lv_label_create(content); + ride_status = lv_label_create(dashboard); lv_obj_set_width(ride_status, 640); + lv_obj_set_style_text_font(ride_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(ride_status, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_t *toggle = button(content, "Turn KICKR Bluetooth on", kickr_toggle_clicked); + lv_obj_t *toggle = button(dashboard, "KICKR Bluetooth: Off", kickr_toggle_clicked); ride_toggle_label = lv_obj_get_child(toggle, 0); - lv_obj_set_size(toggle, 520, 82); - - lv_obj_t *metrics = lv_obj_create(content); - lv_obj_set_size(metrics, 640, 180); + lv_obj_set_size(toggle, 640, 72); + lv_obj_set_style_bg_color(toggle, lv_color_hex(0x243449), 0); + + lv_obj_t *metrics = lv_obj_create(dashboard); + lv_obj_set_size(metrics, 640, 200); + lv_obj_set_style_bg_color(metrics, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(metrics, 0, 0); + lv_obj_set_style_radius(metrics, 20, 0); + lv_obj_set_style_text_color(metrics, lv_color_hex(0xFFFFFF), 0); lv_obj_clear_flag(metrics, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(metrics, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(metrics, LV_FLEX_ALIGN_SPACE_AROUND, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -7223,24 +7239,39 @@ static void show_cycling(void) lv_obj_set_style_text_font(ride_cadence_label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_font(ride_hr_label, &lv_font_montserrat_28, 0); - ride_stats = lv_label_create(content); + lv_obj_set_style_text_color(ride_power_label, lv_color_hex(0x42A5FF), 0); + lv_obj_set_style_text_color(ride_hr_label, lv_color_hex(0xFF8095), 0); + + ride_stats = lv_label_create(dashboard); lv_obj_set_width(ride_stats, 640); + lv_obj_set_style_text_font(ride_stats, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(ride_stats, 14, 0); lv_obj_set_style_text_align(ride_stats, LV_TEXT_ALIGN_CENTER, 0); - ride_chart = lv_chart_create(content); - lv_obj_set_size(ride_chart, 640, 350); + ride_chart = lv_chart_create(dashboard); + lv_obj_set_size(ride_chart, 640, 280); + lv_obj_set_style_bg_color(ride_chart, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(ride_chart, 0, 0); + lv_obj_set_style_radius(ride_chart, 20, 0); + lv_obj_set_style_line_color(ride_chart, lv_color_hex(0x394555), LV_PART_MAIN); + lv_obj_set_style_line_width(ride_chart, 3, LV_PART_ITEMS); + lv_obj_set_style_size(ride_chart, 0, 0, LV_PART_INDICATOR); lv_chart_set_type(ride_chart, LV_CHART_TYPE_LINE); lv_chart_set_point_count(ride_chart, RIDE_CHART_POINTS); lv_chart_set_range(ride_chart, LV_CHART_AXIS_PRIMARY_Y, 0, 1000); lv_chart_set_range(ride_chart, LV_CHART_AXIS_SECONDARY_Y, 40, 220); lv_chart_set_div_line_count(ride_chart, 5, 7); - ride_power_series = lv_chart_add_series(ride_chart, lv_palette_main(LV_PALETTE_BLUE), LV_CHART_AXIS_PRIMARY_Y); - ride_hr_series = lv_chart_add_series(ride_chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_SECONDARY_Y); + ride_power_series = lv_chart_add_series(ride_chart, lv_color_hex(0x42A5FF), LV_CHART_AXIS_PRIMARY_Y); + ride_hr_series = lv_chart_add_series(ride_chart, lv_color_hex(0xFF8095), LV_CHART_AXIS_SECONDARY_Y); + + lv_chart_set_all_value(ride_chart, ride_power_series, LV_CHART_POINT_NONE); + lv_chart_set_all_value(ride_chart, ride_hr_series, LV_CHART_POINT_NONE); - lv_obj_t *start = button(content, ride_recording ? "Stop & save" : "Start ride", ride_button_clicked); - lv_obj_set_size(start, 520, 82); + lv_obj_t *start = button(dashboard, ride_recording ? "Stop & save" : "Start ride", ride_button_clicked); + lv_obj_set_size(start, 640, 88); ride_button_label = lv_obj_get_child(start, 0); - ride_history = lv_label_create(content); + ride_history = lv_label_create(dashboard); lv_obj_set_width(ride_history, 640); + lv_obj_set_style_text_font(ride_history, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(ride_history, LV_TEXT_ALIGN_CENTER, 0); ride_load_history(); cycling_tick(NULL); From 8593177d736a0ac5e7addb6e4d9744f72211de69 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:11 -0500 Subject: [PATCH 17/55] I2C Tool: Improve I2C Tool layout with grouped controls and readable results --- main/i2c_result.c | 10 ++--- main/main.c | 99 +++++++++++++++++++++++++++-------------------- 2 files changed, 61 insertions(+), 48 deletions(-) diff --git a/main/i2c_result.c b/main/i2c_result.c index 6ebd96d..23763c0 100644 --- a/main/i2c_result.c +++ b/main/i2c_result.c @@ -29,11 +29,11 @@ static void render(const char *notice) "Saved read: addr 0x%02X | reg 0x%02X | %lu kHz\n" "%s\n%s", saved.address, saved.reg, (unsigned long)(saved.speed_hz / 1000), - value, notice ? notice : "Copy uses this saved read; it does not read the bus."); + value, notice ? notice : ""); } else { lv_obj_add_state(copy_button, LV_STATE_DISABLED); lv_label_set_text_fmt(details, "Saved read: none\n%s", - notice ? notice : "Complete a read, then COPY READ to inspect it in Byte Lab."); + notice ? notice : ""); } } @@ -94,7 +94,7 @@ void i2c_result_show(lv_obj_t *parent, void (*before_action)(void)) cancel_write = before_action; lv_obj_t *panel = lv_obj_create(parent); lv_obj_remove_style_all(panel); - lv_obj_set_size(panel, 620, 154); + lv_obj_set_size(panel, 620, LV_SIZE_CONTENT); lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(panel, 8, 0); lv_obj_t *row = lv_obj_create(panel); @@ -106,8 +106,8 @@ void i2c_result_show(lv_obj_t *parent, void (*before_action)(void)) copy_button = button(row, "COPY READ", copy_clicked); button(row, "CLEAR READ", clear_clicked); details = lv_label_create(panel); - lv_obj_set_size(details, 620, 80); - lv_obj_set_style_text_font(details, &lv_font_montserrat_14, 0); + lv_obj_set_size(details, 620, LV_SIZE_CONTENT); + lv_obj_set_style_text_font(details, &lv_font_montserrat_28, 0); lv_label_set_long_mode(details, LV_LABEL_LONG_WRAP); render(NULL); } diff --git a/main/main.c b/main/main.c index ab4718f..170b4ec 100644 --- a/main/main.c +++ b/main/main.c @@ -5951,7 +5951,7 @@ static void i2c_update_controls(void) if (i2c_register_label) lv_label_set_text_fmt(i2c_register_label, "Register: 0x%02X", i2c_selected_register); if (i2c_speed_label) - lv_label_set_text_fmt(i2c_speed_label, "Register speed: %lu kHz", + lv_label_set_text_fmt(i2c_speed_label, "Speed: %lu kHz", (unsigned long)(i2c_bus_speed_hz / 1000)); if (i2c_watch_label) lv_label_set_text(i2c_watch_label, i2c_watch_enabled ? "WATCH 1 Hz: ON" : "WATCH 1 Hz: OFF"); @@ -6194,11 +6194,11 @@ static lv_obj_t *i2c_step_button(lv_obj_t *parent, const char *text, lv_event_cb return control; } -static lv_obj_t *i2c_step_row(lv_event_cb_t callback) +static lv_obj_t *i2c_step_row(lv_obj_t *parent, lv_event_cb_t callback) { - lv_obj_t *row = lv_obj_create(content); + lv_obj_t *row = lv_obj_create(parent); lv_obj_remove_style_all(row); - lv_obj_set_size(row, 620, 62); + lv_obj_set_size(row, 620, 64); lv_obj_set_flex_flow(row, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(row, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); i2c_step_button(row, "-0x10", callback, -0x10); @@ -6486,50 +6486,63 @@ static void ble_clicked(lv_event_t *event) ble_tool_show(content, wifi_ready, sd_ready, ble_scan, ble_products_idle, sd_record_error); } +static lv_obj_t *i2c_panel(void) +{ + lv_obj_t *panel = lv_obj_create(content); + lv_obj_set_size(panel, 660, LV_SIZE_CONTENT); + lv_obj_set_style_bg_color(panel, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(panel, 0, 0); + lv_obj_set_style_radius(panel, 16, 0); + lv_obj_set_style_pad_all(panel, 20, 0); + lv_obj_set_style_pad_row(panel, 16, 0); + lv_obj_set_flex_flow(panel, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(panel, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_remove_flag(panel, LV_OBJ_FLAG_SCROLLABLE); + return panel; +} + static void show_i2c(void) { clear_content(); - lv_obj_set_style_pad_row(content, 12, 0); + lv_obj_set_style_pad_row(content, 20, 0); lv_obj_t *title = lv_label_create(content); - lv_label_set_text(title, "External I2C Inspector"); + lv_label_set_text(title, "I2C Tool"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(content); - lv_obj_set_width(help, 620); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_font(help, &lv_font_montserrat_14, 0); - lv_label_set_text(help, "Grove/EXT: SDA G53, SCL G54; external 5V stays off.\n" - "Share ground. Use 3.3V pull-ups or level-shift a 5V bus.\n" - "Read 1-32 bytes after an 8-bit register pointer.\n" - "Reads can have side effects; check the device's auto-increment rules.\n" - "Raw writes can reconfigure hardware; verify the register and value first."); - - lv_obj_t *scan = button(content, LV_SYMBOL_REFRESH " SCAN", i2c_scan_clicked); - lv_obj_set_size(scan, 620, 90); - i2c_status = lv_label_create(content); + lv_obj_t *scan_panel = i2c_panel(); + lv_obj_t *pins = lv_label_create(scan_panel); + lv_label_set_text(pins, "SDA G53 / SCL G54 / 3.3 V"); + lv_obj_set_style_text_font(pins, &lv_font_montserrat_28, 0); + + lv_obj_t *scan = button(scan_panel, LV_SYMBOL_REFRESH " SCAN", i2c_scan_clicked); + lv_obj_set_size(scan, 620, 72); + i2c_status = lv_label_create(scan_panel); lv_obj_set_width(i2c_status, 620); + lv_obj_set_style_text_font(i2c_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(i2c_status, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(i2c_status, "Ready; tap SCAN to probe addresses 0x08-0x77"); - i2c_devices = lv_label_create(content); + lv_label_set_text(i2c_status, "Not scanned"); + i2c_devices = lv_label_create(scan_panel); lv_obj_set_width(i2c_devices, 620); + lv_obj_set_style_text_font(i2c_devices, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(i2c_devices, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(i2c_devices, "No scan performed this visit"); - lv_obj_t *speed = button(content, "", i2c_speed_clicked); + lv_label_set_text(i2c_devices, ""); + lv_obj_t *read_panel = i2c_panel(); + lv_obj_t *speed = button(read_panel, "", i2c_speed_clicked); lv_obj_set_size(speed, 620, 70); i2c_speed_label = lv_obj_get_child(speed, 0); - i2c_address_label = lv_label_create(content); + i2c_address_label = lv_label_create(read_panel); lv_obj_set_style_text_font(i2c_address_label, &lv_font_montserrat_28, 0); - i2c_step_row(i2c_address_step_clicked); - i2c_register_label = lv_label_create(content); + i2c_step_row(read_panel, i2c_address_step_clicked); + i2c_register_label = lv_label_create(read_panel); lv_obj_set_style_text_font(i2c_register_label, &lv_font_montserrat_28, 0); - i2c_step_row(i2c_register_step_clicked); - lv_obj_t *length_row = lv_obj_create(content); + i2c_step_row(read_panel, i2c_register_step_clicked); + lv_obj_t *length_row = lv_obj_create(read_panel); lv_obj_remove_style_all(length_row); lv_obj_set_size(length_row, 620, 64); lv_obj_set_flex_flow(length_row, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(length_row, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); lv_obj_t *length_label = lv_label_create(length_row); - lv_label_set_text(length_label, "One-shot bytes:"); + lv_label_set_text(length_label, "Read bytes"); lv_obj_set_style_text_font(length_label, &lv_font_montserrat_28, 0); lv_obj_t *length_select = lv_dropdown_create(length_row); lv_obj_set_size(length_select, 240, 60); @@ -6542,11 +6555,7 @@ static void show_i2c(void) lv_dropdown_set_options(length_select, lengths); lv_dropdown_set_selected(length_select, (uint32_t)i2c_read_length - 1); lv_obj_add_event_cb(length_select, i2c_length_changed, LV_EVENT_VALUE_CHANGED, NULL); - lv_obj_t *read_help = lv_label_create(content); - lv_obj_set_width(read_help, 620); - lv_obj_set_style_text_font(read_help, &lv_font_montserrat_14, 0); - lv_label_set_text(read_help, "Watch/CSV always sample one byte at 1 Hz. READ ONCE stops Watch and saves its CSV."); - lv_obj_t *read_row = lv_obj_create(content); + lv_obj_t *read_row = lv_obj_create(read_panel); lv_obj_remove_style_all(read_row); lv_obj_set_size(read_row, 620, 72); lv_obj_set_flex_flow(read_row, LV_FLEX_FLOW_ROW); @@ -6556,23 +6565,27 @@ static void show_i2c(void) lv_obj_t *watch = button(read_row, "", i2c_watch_clicked); lv_obj_set_size(watch, 300, 70); i2c_watch_label = lv_obj_get_child(watch, 0); - i2c_read_result = lv_label_create(content); + i2c_read_result = lv_label_create(read_panel); lv_obj_set_width(i2c_read_result, 620); + lv_obj_set_style_text_font(i2c_read_result, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(i2c_read_result, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(i2c_read_result, "Select an address and register, then read once"); - i2c_result_show(content, i2c_result_action); - lv_obj_t *capture = button(content, "", i2c_capture_clicked); + lv_label_set_text(i2c_read_result, "No read yet"); + i2c_result_show(read_panel, i2c_result_action); + lv_obj_t *capture_panel = i2c_panel(); + lv_obj_t *capture = button(capture_panel, "", i2c_capture_clicked); lv_obj_set_size(capture, 620, 70); i2c_capture_label = lv_obj_get_child(capture, 0); - i2c_capture_status = lv_label_create(content); + i2c_capture_status = lv_label_create(capture_panel); lv_obj_set_width(i2c_capture_status, 620); + lv_obj_set_style_text_font(i2c_capture_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(i2c_capture_status, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(i2c_capture_status, i2c_capture_notice[0] ? i2c_capture_notice : - "Optional 1 Hz CSV logging to the SD card"); - i2c_value_label = lv_label_create(content); + "1 byte / 1 Hz / SD card"); + lv_obj_t *write_panel = i2c_panel(); + i2c_value_label = lv_label_create(write_panel); lv_obj_set_style_text_font(i2c_value_label, &lv_font_montserrat_28, 0); - i2c_step_row(i2c_value_step_clicked); - lv_obj_t *write = button(content, "", i2c_write_clicked); + i2c_step_row(write_panel, i2c_value_step_clicked); + lv_obj_t *write = button(write_panel, "", i2c_write_clicked); lv_obj_set_size(write, 620, 80); i2c_write_label = lv_obj_get_child(write, 0); i2c_update_controls(); From 65dae8aed6c4a6f389667a2cced303fb5c01caa6 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:15 -0500 Subject: [PATCH 18/55] =?UTF-8?q?Serial:=20Improve=20Serial=E2=80=99s=20vi?= =?UTF-8?q?sual=20hierarchy=20and=20touchscreen=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/uart_tool.c | 73 ++++++++++++++++++++++++------------------------ 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/main/uart_tool.c b/main/uart_tool.c index 895533d..32ef720 100644 --- a/main/uart_tool.c +++ b/main/uart_tool.c @@ -130,19 +130,15 @@ static void render_rx_capture(void) else lv_obj_add_state(rx_copy_button, LV_STATE_DISABLED); } if (rx_capture_state == RX_CAPTURE_EMPTY) { - lv_label_set_text(rx_info_label, "RX capture is empty. Start Serial, then CAPTURE RX before sending.\n" - "Freeze to copy up to 128 bytes. Frame boundaries are not detected."); + lv_label_set_text(rx_info_label, "RX capture is empty"); return; } const char *state = rx_capture_state == RX_CAPTURE_ACTIVE ? "Collecting" : rx_capture_state == RX_CAPTURE_FROZEN ? "Frozen" : rx_capture_state == RX_CAPTURE_OVERFLOW ? "Overflow" : "Read failed"; - const char *hint = rx_capture_state == RX_CAPTURE_ACTIVE ? "FREEZE RX ends this window. COPY RX is available after freezing." : - rx_capture_state == RX_CAPTURE_FROZEN ? "Raw bytes; verify that the window includes the entire intended reply." : - rx_capture_state == RX_CAPTURE_OVERFLOW ? "Window exceeded 128 bytes; no partial copy. Start a new capture." : - "RX could not be drained; no copy is available. Start a new capture."; + const char *hint = rx_capture_state == RX_CAPTURE_OVERFLOW ? "\nWindow exceeded 128 bytes; capture again." : ""; static const char parity_letters[] = "NEO"; - lv_label_set_text_fmt(rx_info_label, "%s RX | %s %u 8%c%u | %u/128 bytes\n%s", state, + lv_label_set_text_fmt(rx_info_label, "%s RX | %s %u 8%c%u | %u/128 bytes%s", state, rx_capture_rs485 ? "RS-485" : "UART", rx_capture_baud, parity_letters[rx_capture_parity], rx_capture_stop + 1, (unsigned)rx_capture_length, hint); @@ -192,10 +188,10 @@ static void render_tx_info(void) uart_tx_status_t status = read_draft(&data); if (status == UART_TX_OK) { static const char *const suffix_names[] = {"no suffix", "LF appended", "CR appended", "CRLF appended"}; - lv_label_set_text_fmt(tx_info_label, "Ready: %u TX bytes | %s | %s. SEND transmits once.", + lv_label_set_text_fmt(tx_info_label, "Ready: %u TX bytes | %s | %s.", (unsigned)data.length, tx_mode == UART_TX_HEX ? "Hex" : "ASCII", suffix_names[data.ending]); - } else lv_label_set_text(tx_info_label, uart_tx_error(status)); + } else lv_label_set_text(tx_info_label, status == UART_TX_EMPTY ? "0 / 256 TX bytes" : uart_tx_error(status)); if (send_button) { if (driver_running && status == UART_TX_OK) lv_obj_remove_state(send_button, LV_STATE_DISABLED); else lv_obj_add_state(send_button, LV_STATE_DISABLED); @@ -421,16 +417,14 @@ static esp_err_t start_driver(bool route_pins) static void update_controls(void) { - if (title_label) lv_label_set_text(title_label, rs485_interface ? "Onboard RS-485 Terminal" : - "UART1 Terminal"); + if (title_label) lv_label_set_text(title_label, rs485_interface ? "Serial / RS-485" : "Serial / UART"); if (help_label) { if (rs485_interface) { - lv_label_set_text(help_label, "J7: pin 1 GND, pin 3 A, pin 4 B. Leave VIN pin 2 disconnected on USB.\n" - "The 120-ohm terminator is the physical switch; enable it only at a bus end.\n" - "SIT3088 direction is automatic. Stop returns to receive-safe/high-impedance GPIO."); + lv_label_set_text(help_label, "J7: 1 GND / 3 A / 4 B; leave VIN 2 disconnected on USB.\n" + "120-ohm switch: bus ends only. Automatic direction."); } else { - lv_label_set_text(help_label, "M5-Bus TX G47 / RX G48, 3.3 V logic only. Share ground.\n" - "Pins are high-impedance while stopped. Settings are 8 data bits, no flow control."); + lv_label_set_text(help_label, "TX G47 / RX G48 / 3.3 V / common GND / 8 data bits\n" + "No flow control; pins released when stopped."); } } if (interface_label) lv_label_set_text(interface_label, rs485_interface ? "Link\nRS-485" : "Link\nUART"); @@ -852,6 +846,10 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, { lv_obj_t *control = lv_button_create(parent); lv_obj_set_size(control, width, 72); + lv_obj_set_style_pad_all(control, 6, 0); + lv_obj_set_style_radius(control, 12, 0); + lv_obj_set_style_bg_color(control, lv_color_hex(0x202938), 0); + lv_obj_set_style_shadow_width(control, 0, 0); lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); @@ -867,6 +865,7 @@ static lv_obj_t *row(lv_obj_t *parent, int height) lv_obj_t *container = lv_obj_create(parent); lv_obj_remove_style_all(container); lv_obj_set_size(container, 640, height); + lv_obj_remove_flag(container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -877,10 +876,10 @@ static lv_obj_t *dropdown(lv_obj_t *parent, const char *caption, const char *opt { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, 310, 82); + lv_obj_set_size(block, 310, 92); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(block, 4, 0); + lv_obj_set_style_pad_row(block, 10, 0); lv_obj_t *label = lv_label_create(block); lv_obj_set_style_text_font(label, &lv_font_montserrat_14, 0); lv_label_set_text(label, caption); @@ -904,7 +903,7 @@ void uart_tool_show(lv_obj_t *parent, bool available, output_text = heap_caps_calloc(1, UART_TOOL_OUTPUT_CAPACITY, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); - lv_obj_set_style_pad_row(parent, 10, 0); + lv_obj_set_style_pad_row(parent, 12, 0); title_label = lv_label_create(parent); lv_obj_set_style_text_font(title_label, &lv_font_montserrat_28, 0); @@ -920,15 +919,21 @@ void uart_tool_show(lv_obj_t *parent, bool available, small_button(settings, "", 148, setting_clicked, (void *)2, &stop_label); lv_obj_t *actions = row(parent, 76); - small_button(actions, "", 118, start_clicked, NULL, &start_label); + lv_obj_t *start_button = small_button(actions, "", 118, start_clicked, NULL, &start_label); + lv_obj_set_style_bg_color(start_button, lv_color_hex(0x5E35B1), 0); small_button(actions, "LINE\nTEST", 118, loopback_clicked, NULL, NULL); small_button(actions, "CLEAR", 118, clear_clicked, NULL, NULL); small_button(actions, "", 118, view_clicked, NULL, &view_label); small_button(actions, "", 118, log_clicked, NULL, &log_label); output_area = lv_textarea_create(parent); - lv_obj_set_size(output_area, 640, 240); - lv_obj_set_style_text_font(output_area, &lv_font_montserrat_14, 0); + lv_obj_set_size(output_area, 640, 280); + lv_obj_set_style_text_font(output_area, &lv_font_montserrat_28, 0); + lv_obj_set_style_bg_color(output_area, lv_color_hex(0x18202B), 0); + lv_obj_set_style_text_color(output_area, lv_color_hex(0xE6EDF3), 0); + lv_obj_set_style_border_color(output_area, lv_color_hex(0x364152), 0); + lv_obj_set_style_pad_all(output_area, 16, 0); + lv_textarea_set_placeholder_text(output_area, "No serial traffic"); lv_textarea_set_text(output_area, ""); lv_textarea_set_cursor_click_pos(output_area, false); @@ -937,28 +942,29 @@ void uart_tool_show(lv_obj_t *parent, bool available, rx_copy_button = small_button(capture_row, "COPY RX", 200, copy_rx_clicked, NULL, NULL); small_button(capture_row, "CLEAR RX", 200, clear_rx_clicked, NULL, NULL); rx_info_label = lv_label_create(parent); - lv_obj_set_size(rx_info_label, 640, 42); + lv_obj_set_size(rx_info_label, 640, 36); lv_obj_set_style_text_font(rx_info_label, &lv_font_montserrat_14, 0); - lv_obj_t *tx_options = row(parent, 82); - tx_mode_select = dropdown(tx_options, "Transmit format", "Literal ASCII\nHex byte pairs", tx_mode_changed); - ending_select = dropdown(tx_options, "Append to ASCII", "None\nLF (0A)\nCR (0D)\nCRLF (0D 0A)", ending_changed); + lv_obj_t *tx_options = row(parent, 92); + tx_mode_select = dropdown(tx_options, "TX format", "Literal ASCII\nHex byte pairs", tx_mode_changed); + ending_select = dropdown(tx_options, "ASCII ending", "None\nLF (0A)\nCR (0D)\nCRLF (0D 0A)", ending_changed); tx_info_label = lv_label_create(parent); - lv_obj_set_size(tx_info_label, 640, 42); + lv_obj_set_size(tx_info_label, 640, 36); lv_obj_set_style_text_font(tx_info_label, &lv_font_montserrat_14, 0); input_area = lv_textarea_create(parent); lv_obj_set_size(input_area, 640, 96); lv_obj_set_style_text_font(input_area, &lv_font_montserrat_28, 0); - lv_textarea_set_placeholder_text(input_area, "TX draft; line endings are explicit"); + lv_textarea_set_placeholder_text(input_area, "Transmit bytes"); lv_obj_add_event_cb(input_area, input_event, LV_EVENT_ALL, NULL); lv_obj_t *send_row = row(parent, 76); small_button(send_row, "PREV", 200, previous_clicked, NULL, NULL); small_button(send_row, "PASTE", 200, paste_clicked, NULL, NULL); send_button = small_button(send_row, "SEND", 200, send_clicked, NULL, NULL); + lv_obj_set_style_bg_color(send_button, lv_color_hex(0x5E35B1), 0); keyboard = lv_keyboard_create(parent); - lv_obj_set_size(keyboard, 640, 240); + lv_obj_set_size(keyboard, 640, 280); lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_USER_1, hex_keys, hex_controls); lv_keyboard_set_textarea(keyboard, input_area); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); @@ -966,18 +972,13 @@ void uart_tool_show(lv_obj_t *parent, bool available, lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); status_label = lv_label_create(parent); - lv_obj_set_size(status_label, 640, 42); + lv_obj_set_size(status_label, 640, 60); lv_obj_set_style_text_font(status_label, &lv_font_montserrat_14, 0); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(status_label, output_text ? "Ready; press START to connect" : + lv_label_set_text(status_label, output_text ? "Disconnected" : "Output buffer allocation failed"); receive_timer = lv_timer_create(receive_tick, 20, NULL); if (!receive_timer) lv_label_set_text(status_label, "Receive timer allocation failed. Return Home and reopen."); - lv_obj_t *note = lv_label_create(parent); - lv_obj_set_width(note, 640); - lv_obj_set_style_text_font(note, &lv_font_montserrat_14, 0); - lv_label_set_text(note, "256 TX bytes including suffix; no escape expansion. VIEW changes new display lines only.\n" - "PREV restores sent bytes/format. PASTE replaces Hex TX. Drafts/history stay in RAM."); apply_tx_mode(); update_controls(); } From c576d657e414460bfb9df52fc060d3a2bafa4409 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:19 -0500 Subject: [PATCH 19/55] SPI Master: Improve SPI Master layout, readability, and idle state --- main/spi_tool.c | 68 +++++++++++++++++++++++++++-------------- tests/offline_ui_test.c | 10 +++--- 2 files changed, 50 insertions(+), 28 deletions(-) diff --git a/main/spi_tool.c b/main/spi_tool.c index 185b66d..5c29ed3 100644 --- a/main/spi_tool.c +++ b/main/spi_tool.c @@ -130,6 +130,8 @@ static void keyboard_visible(bool visible) { if (!keyboard) return; lv_keyboard_set_textarea(keyboard, visible ? input_area : NULL); + lv_obj_set_height(input_area, visible ? 112 : 144); + lv_obj_set_height(result_area, visible ? 120 : 240); if (visible) lv_obj_remove_flag(keyboard, LV_OBJ_FLAG_HIDDEN); else { lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); @@ -265,6 +267,8 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, { lv_obj_t *control = lv_button_create(parent); lv_obj_set_size(control, width, 72); + lv_obj_set_style_radius(control, 14, 0); + lv_obj_set_style_bg_color(control, lv_color_hex(0x263343), 0); lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); @@ -325,11 +329,13 @@ static void render_transfer(void) if (!result_area || !identity_label || !copy_rx_button) return; if (!saved_transfer.length) { lv_textarea_set_text(result_area, ""); - lv_label_set_text(identity_label, "No completed transfer saved.\nCOPY RX copies received bytes to Byte Lab."); + lv_obj_set_style_text_font(identity_label, &lv_font_montserrat_28, 0); + lv_label_set_text(identity_label, "Result"); lv_obj_add_state(copy_rx_button, LV_STATE_DISABLED); return; } - lv_label_set_text_fmt(identity_label, "Saved: mode %u | %d Hz | %u bytes\nCS G45; RX has one byte per transmitted byte.", + lv_obj_set_style_text_font(identity_label, &lv_font_montserrat_14, 0); + lv_label_set_text_fmt(identity_label, "Saved: mode %u | %d Hz | %u bytes", saved_transfer.mode, saved_transfer.clock_hz, (unsigned)saved_transfer.length); lv_obj_remove_state(copy_rx_button, LV_STATE_DISABLED); char result[256]; @@ -424,56 +430,73 @@ static void transfer_clicked(lv_event_t *event) void spi_tool_show(lv_obj_t *parent) { - lv_obj_set_style_pad_row(parent, 10, 0); + lv_obj_set_style_pad_row(parent, 16, 0); lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "SPI Master Console"); + lv_label_set_text(title, "SPI Master"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(parent); - lv_obj_set_width(help, 640); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_font(help, &lv_font_montserrat_14, 0); - lv_label_set_text(help, "M5-Bus: MOSI G18, MISO G19, SCK G5, CS G45; 3.3 V logic only.\n" - "Share ground. Pins are high-impedance until START and after STOP/Home.\n" - "Each full-duplex transfer is limited to 32 bytes; verify target voltage and mode first."); + lv_obj_t *pins = lv_label_create(parent); + lv_obj_set_width(pins, 640); + lv_obj_set_style_text_font(pins, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_align(pins, LV_TEXT_ALIGN_CENTER, 0); + lv_label_set_text(pins, "MOSI 18 MISO 19 SCK 5 CS 45\n3.3 V only / Common GND"); lv_obj_t *settings = row(parent); small_button(settings, "", 200, setting_clicked, (void *)0, &mode_label); small_button(settings, "", 200, setting_clicked, (void *)1, &speed_label); - small_button(settings, "", 200, start_clicked, NULL, &start_label); + lv_obj_t *start = small_button(settings, "", 200, start_clicked, NULL, &start_label); + lv_obj_set_style_bg_color(start, lv_color_hex(0xAD4B00), 0); + + lv_obj_t *tx_title = lv_label_create(parent); + lv_obj_set_width(tx_title, 640); + lv_obj_set_style_text_font(tx_title, &lv_font_montserrat_28, 0); + lv_label_set_text(tx_title, "TX (hex, 32 bytes max)"); input_area = lv_textarea_create(parent); - lv_obj_set_size(input_area, 640, 128); + lv_obj_set_size(input_area, 640, 144); + lv_obj_set_style_bg_color(input_area, lv_color_hex(0x1C2531), 0); + lv_obj_set_style_text_color(input_area, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_border_color(input_area, lv_color_hex(0x455468), 0); + lv_obj_set_style_radius(input_area, 14, 0); + lv_obj_set_style_pad_all(input_area, 16, 0); lv_obj_set_style_text_font(input_area, &lv_font_montserrat_28, 0); /* Retain invalid characters/newlines and one excess character. Reject an * overlong draft instead of silently sending a valid truncated prefix. */ lv_textarea_set_max_length(input_area, SPI_TOOL_MAX_TEXT + 1); - lv_textarea_set_placeholder_text(input_area, "TX hex pairs: 9F 00 00 00"); + lv_textarea_set_placeholder_text(input_area, "9F 00 00 00"); /* Restore before attaching the callback: LVGL emits per-character events * during set_text, which must not overwrite the source being restored. */ lv_textarea_set_text(input_area, saved_input); lv_obj_add_event_cb(input_area, input_event, LV_EVENT_ALL, NULL); lv_obj_t *actions = row(parent); - small_button(actions, "TRANSFER", 200, transfer_clicked, NULL, NULL); - small_button(actions, "PASTE\nBYTES", 200, paste_clicked, NULL, NULL); + lv_obj_t *transfer = small_button(actions, "TRANSFER", 200, transfer_clicked, NULL, NULL); + lv_obj_set_style_bg_color(transfer, lv_color_hex(0x2196F3), 0); + small_button(actions, "PASTE", 200, paste_clicked, NULL, NULL); small_button(actions, "CLEAR TX", 200, clear_tx_clicked, NULL, NULL); - lv_obj_t *result_controls = row(parent); - copy_rx_button = small_button(result_controls, "COPY RX", 310, copy_rx_clicked, NULL, NULL); - small_button(result_controls, "CLEAR RESULT", 310, clear_clicked, NULL, NULL); identity_label = lv_label_create(parent); lv_obj_set_size(identity_label, 640, 34); lv_obj_set_style_text_font(identity_label, &lv_font_montserrat_14, 0); lv_label_set_long_mode(identity_label, LV_LABEL_LONG_WRAP); result_area = lv_textarea_create(parent); - lv_obj_set_size(result_area, 640, 220); + lv_obj_set_size(result_area, 640, 240); + lv_obj_set_style_bg_color(result_area, lv_color_hex(0x1C2531), 0); + lv_obj_set_style_text_color(result_area, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_border_color(result_area, lv_color_hex(0x455468), 0); + lv_obj_set_style_radius(result_area, 14, 0); + lv_obj_set_style_pad_all(result_area, 16, 0); + lv_textarea_set_placeholder_text(result_area, "No transfer yet"); lv_obj_set_style_text_font(result_area, &lv_font_montserrat_28, 0); lv_textarea_set_text(result_area, ""); lv_textarea_set_cursor_click_pos(result_area, false); + lv_obj_t *result_controls = row(parent); + copy_rx_button = small_button(result_controls, "COPY RX", 310, copy_rx_clicked, NULL, NULL); + small_button(result_controls, "CLEAR RESULT", 310, clear_clicked, NULL, NULL); + keyboard = lv_keyboard_create(parent); lv_obj_set_size(keyboard, 640, 240); lv_obj_set_style_text_font(keyboard, &lv_font_montserrat_28, LV_PART_ITEMS); @@ -486,9 +509,8 @@ void spi_tool_show(lv_obj_t *parent) status_label = lv_label_create(parent); lv_obj_set_width(status_label, 640); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); - lv_obj_set_style_text_font(status_label, &lv_font_montserrat_14, 0); - lv_label_set_text(status_label, "Tap TX for hex keys. Select mode/clock, then START.\n" - "Done only hides the keyboard; TRANSFER sends the draft."); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_28, 0); + lv_label_set_text(status_label, "SPI stopped"); update_controls(); render_transfer(); } diff --git a/tests/offline_ui_test.c b/tests/offline_ui_test.c index a02d0f5..944f2b0 100644 --- a/tests/offline_ui_test.c +++ b/tests/offline_ui_test.c @@ -311,9 +311,9 @@ static void spi_checks(void) spi_copy_enabled(false); assert(click("COPY RX")); /* Direct events must also validate disabled controls. */ assert(!payload_clipboard_peek()); - assert(click("PASTE\nBYTES")); assert(has_text(content, "Byte clipboard is empty")); + assert(click("PASTE")); assert(has_text(content, "Byte clipboard is empty")); assert(payload_clipboard_store((const uint8_t *)"\x00\x00\xc0\x3f", 4)); - assert(click("PASTE\nBYTES")); + assert(click("PASTE")); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "00 00 C0 3F")); assert(click("COPY RX")); spi_expect_copy((const uint8_t *)"\x00\x00\xc0\x3f", 4); assert(!spi_host_starts && !spi_host_transfers && !spi_host_gpio_writes); @@ -322,7 +322,7 @@ static void spi_checks(void) const size_t rejected[] = {0, 33, 128}; for (size_t i = 0; i < sizeof(rejected) / sizeof(rejected[0]); i++) { assert(payload_clipboard_store(bytes, rejected[i])); - assert(click("PASTE\nBYTES")); assert(has_text(content, "draft unchanged")); + assert(click("PASTE")); assert(has_text(content, "draft unchanged")); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "00 00 C0 3F")); } assert(!spi_host_starts && !spi_host_transfers && !spi_host_gpio_writes); @@ -340,7 +340,7 @@ static void spi_checks(void) set_input(0, excessive); /* UI retains the 96th character: parser must reject. */ assert(strlen(lv_textarea_get_text(nth(&lv_textarea_class, 0))) == 96); assert(click("TRANSFER")); assert(!spi_host_transfers); - assert(payload_clipboard_store(bytes, 32)); assert(click("PASTE\nBYTES")); + assert(payload_clipboard_store(bytes, 32)); assert(click("PASTE")); assert(!spi_host_transfers && spi_host_starts == 1); for (size_t i = 0; i < 32; i++) spi_host_reply[i] = (uint8_t)(255 - i); spi_host_reply_length = 32; @@ -1236,7 +1236,7 @@ int main(int argc, char **argv) reset_content(); spi_tool_show(content); refresh(); - assert(click("PASTE\nBYTES")); + assert(click("PASTE")); assert(!spi_tool_busy() && spi_host_starts == spi_starts && spi_host_transfers == spi_transfers); spi_tool_stop(); spi_tool_stop(); From 616565a1dc433e43c6ff20c195278c45e4894cff Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:23 -0500 Subject: [PATCH 20/55] Signal Gen: Improve Signal Gen with grouped controls and clearer output status --- main/signal_tool.c | 95 ++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/main/signal_tool.c b/main/signal_tool.c index b71b0da..ea95d6f 100644 --- a/main/signal_tool.c +++ b/main/signal_tool.c @@ -209,7 +209,7 @@ static void start_clicked(lv_event_t *event) uint32_t actual = ledc_get_freq(LEDC_LOW_SPEED_MODE, SIGNAL_TIMER); lv_label_set_text_fmt(output_label, "Output: %lu Hz at %u%% on G6", (unsigned long)actual, duty_choices[duty_index]); - set_status("PWM active for at most five minutes; press STOP or Home when finished"); + set_status("PWM active · 5 min limit"); } static void setting_clicked(lv_event_t *event) @@ -226,7 +226,7 @@ static void setting_clicked(lv_event_t *event) else pulse_index = (pulse_index + 1) % (sizeof(pulse_choices_us) / sizeof(pulse_choices_us[0])); update_controls(); - set_status("Settings selected; start PWM or send one pulse"); + set_status("G6 released"); } static void pulse_clicked(lv_event_t *event) @@ -260,7 +260,9 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback, void *user_data, lv_obj_t **label_out) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, width, 76); + lv_obj_set_size(control, width, 96); + lv_obj_set_style_radius(control, 16, 0); + lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -274,54 +276,73 @@ static lv_obj_t *row(lv_obj_t *parent) { lv_obj_t *container = lv_obj_create(parent); lv_obj_remove_style_all(container); - lv_obj_set_size(container, 640, 80); + lv_obj_set_size(container, 592, 100); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); return container; } +static lv_obj_t *signal_card(lv_obj_t *parent) +{ + lv_obj_t *card = lv_obj_create(parent); + lv_obj_set_size(card, 640, LV_SIZE_CONTENT); + lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(card, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(card, 0, 0); + lv_obj_set_style_radius(card, 18, 0); + lv_obj_set_style_pad_all(card, 24, 0); + lv_obj_set_style_pad_row(card, 20, 0); + lv_obj_set_style_text_color(card, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); + lv_obj_set_flex_align(card, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + return card; +} + void signal_tool_show(lv_obj_t *parent) { - lv_obj_set_style_pad_row(parent, 18, 0); + lv_obj_set_style_pad_row(parent, 20, 0); lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "PWM & Pulse Generator"); + lv_label_set_text(title, "Signal Gen"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(parent); - lv_obj_set_width(help, 640); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(help, "M5-Bus G6 output, 3.3 V logic only; share ground.\n" - "Use a buffer for loads. Output is low before routing and high-impedance while stopped.\n" - "Measure the real waveform; single-pulse width is requested timing, not calibrated timing."); - - lv_obj_t *settings = row(parent); - small_button(settings, "", 200, setting_clicked, (void *)0, &frequency_label); - small_button(settings, "", 200, setting_clicked, (void *)1, &duty_label); - small_button(settings, "", 200, setting_clicked, (void *)2, &pulse_label); - - lv_obj_t *actions = row(parent); - small_button(actions, "", 310, start_clicked, NULL, &start_label); - small_button(actions, "SINGLE PULSE", 310, pulse_clicked, NULL, NULL); - - lv_obj_t *card = lv_obj_create(parent); - lv_obj_set_size(card, 640, 300); - lv_obj_clear_flag(card, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(card, LV_FLEX_FLOW_COLUMN); - lv_obj_set_flex_align(card, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - output_label = lv_label_create(card); + lv_obj_t *output = signal_card(parent); + output_label = lv_label_create(output); + lv_obj_set_width(output_label, 592); + lv_obj_set_style_text_align(output_label, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(output_label, "Output: stopped"); lv_obj_set_style_text_font(output_label, &lv_font_montserrat_28, 0); - lv_obj_t *limits = lv_label_create(card); - lv_obj_set_width(limits, 560); - lv_obj_set_style_text_align(limits, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(limits, "PWM automatically stops after five minutes.\n" - "Stop before rewiring. Never drive motors, relays, LEDs, or 5 V logic directly."); - - status_label = lv_label_create(parent); - lv_obj_set_width(status_label, 640); + status_label = lv_label_create(output); + lv_obj_set_width(status_label, 592); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(status_label, "Ready; choose frequency/duty or pulse width"); + lv_obj_set_style_text_color(status_label, lv_color_hex(0xCBD5E1), 0); + lv_label_set_text(status_label, "G6 released"); + + lv_obj_t *pwm = signal_card(parent); + lv_obj_t *heading = lv_label_create(pwm); + lv_label_set_text(heading, "PWM"); + lv_obj_set_style_text_font(heading, &lv_font_montserrat_28, 0); + lv_obj_t *settings = row(pwm); + small_button(settings, "", 286, setting_clicked, (void *)0, &frequency_label); + small_button(settings, "", 286, setting_clicked, (void *)1, &duty_label); + small_button(pwm, "", 592, start_clicked, NULL, &start_label); + + lv_obj_t *pulse = signal_card(parent); + heading = lv_label_create(pulse); + lv_label_set_text(heading, "Single pulse"); + lv_obj_set_style_text_font(heading, &lv_font_montserrat_28, 0); + lv_obj_t *actions = row(pulse); + small_button(actions, "", 286, setting_clicked, (void *)2, &pulse_label); + small_button(actions, "SEND PULSE", 286, pulse_clicked, NULL, NULL); + + lv_obj_t *limits = lv_label_create(parent); + lv_obj_set_width(limits, 640); + lv_obj_set_style_text_color(limits, lv_color_hex(0xCBD5E1), 0); + lv_label_set_text(limits, "M5-Bus G6 · 3.3 V logic · Common ground\n" + "PWM stops after 5 minutes. Stop before rewiring.\n" + "Use a buffer for loads; never drive motors, relays, LEDs or 5 V logic directly.\n" + "Stopped: high impedance. Low before routing.\n" + "Pulse timing is requested, not calibrated; measure the waveform."); update_controls(); } From 1ebe112a7abd822dbaac41e85671a3154906a075 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:27 -0500 Subject: [PATCH 21/55] HTTP Tool: Improve HTTP Tool readability and touch layout --- main/http_tool.c | 67 ++++++++++++++++++++++++++++++------------------ 1 file changed, 42 insertions(+), 25 deletions(-) diff --git a/main/http_tool.c b/main/http_tool.c index 102d740..7ae4777 100644 --- a/main/http_tool.c +++ b/main/http_tool.c @@ -589,7 +589,9 @@ static lv_obj_t *action_button(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback, lv_obj_t **label_out) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, width, 68); + lv_obj_set_size(control, width, 80); + lv_obj_set_style_radius(control, 14, 0); + lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, NULL); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -602,10 +604,14 @@ static lv_obj_t *action_button(lv_obj_t *parent, const char *text, int width, static lv_obj_t *row(lv_obj_t *parent) { lv_obj_t *container = lv_obj_create(parent); - lv_obj_set_size(container, 640, 78); + lv_obj_set_size(container, 640, 80); + lv_obj_set_style_bg_opa(container, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(container, 0, 0); + lv_obj_set_style_pad_all(container, 0, 0); + lv_obj_set_style_pad_column(container, 12, 0); lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_EVENLY, + lv_obj_set_flex_align(container, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); return container; } @@ -810,24 +816,16 @@ void http_tool_show(lv_obj_t *parent, bool connected, bool sd_available, storage_error_cb = error_cb; lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "HTTP Console"); + lv_label_set_text(title, "HTTP Tool"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(parent); - lv_obj_set_width(help, 640); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(help, "HTTPS certificates are verified; redirects are shown but not followed.\n" - "4 KiB body preview; 8 KiB response headers; four custom headers maximum.\n" - "15-second request budget; Cancel/Home stops cooperatively, including DNS waits.\n" - "SD logs are opt-in metadata only: no headers, bodies, queries, or response content."); + lv_obj_set_style_pad_row(parent, 12, 0); lv_obj_t *controls = row(parent); - action_button(controls, "", 110, method_clicked, &method_label); - action_button(controls, "", 110, log_clicked, &log_label); - action_button(controls, "CLEAR", 110, clear_clicked, NULL); - cancel_button = action_button(controls, "CANCEL", 110, cancel_clicked, NULL); - lv_obj_t *send = action_button(controls, "", 110, send_clicked, &send_label); - if (!connected) lv_obj_add_state(send, LV_STATE_DISABLED); + action_button(controls, "", 204, method_clicked, &method_label); + action_button(controls, "", 206, log_clicked, &log_label); + lv_obj_t *clear = action_button(controls, "CLEAR", 206, clear_clicked, NULL); + lv_obj_set_style_bg_color(clear, lv_color_hex(0x303b49), 0); url_area = lv_textarea_create(parent); lv_obj_set_size(url_area, 640, 72); @@ -837,32 +835,51 @@ void http_tool_show(lv_obj_t *parent, bool connected, bool sd_available, lv_textarea_set_placeholder_text(url_area, "https://device.local/api"); headers_area = lv_textarea_create(parent); - lv_obj_set_size(headers_area, 640, 132); + lv_obj_set_size(headers_area, 640, 120); lv_textarea_set_max_length(headers_area, HTTP_HEADERS_MAX); - lv_textarea_set_placeholder_text(headers_area, "Optional headers, one Name: value per line (maximum four)"); + lv_textarea_set_placeholder_text(headers_area, "Headers (Name: value)"); body_area = lv_textarea_create(parent); - lv_obj_set_size(body_area, 640, 170); + lv_obj_set_size(body_area, 640, 144); lv_textarea_set_max_length(body_area, HTTP_BODY_MAX); - lv_textarea_set_placeholder_text(body_area, "POST/PUT body (default Content-Type: application/json)"); + lv_textarea_set_placeholder_text(body_area, "Body (POST / PUT)"); + + lv_obj_t *actions = row(parent); + cancel_button = action_button(actions, "CANCEL", 204, cancel_clicked, NULL); + lv_obj_set_style_bg_color(cancel_button, lv_color_hex(0x303b49), 0); + lv_obj_t *send = action_button(actions, "", 424, send_clicked, &send_label); + if (!connected) lv_obj_add_state(send, LV_STATE_DISABLED); request_label = lv_label_create(parent); lv_obj_set_width(request_label, 640); lv_label_set_long_mode(request_label, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(request_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_align(request_label, LV_TEXT_ALIGN_LEFT, 0); show_request(NULL); status_label = lv_label_create(parent); lv_obj_set_width(status_label, 640); lv_label_set_long_mode(status_label, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_LEFT, 0); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_28, 0); lv_label_set_text(status_label, http_tool_busy() ? "Finishing the previous request..." : connected ? "Ready" : "Connect to Wi-Fi first"); response_area = lv_textarea_create(parent); - lv_obj_set_size(response_area, 640, 300); + lv_obj_set_size(response_area, 640, 280); lv_textarea_set_cursor_click_pos(response_area, false); - lv_textarea_set_placeholder_text(response_area, "Response body preview"); + lv_textarea_set_placeholder_text(response_area, "Response"); + + lv_obj_t *fields[] = {url_area, headers_area, body_area, response_area}; + for (size_t i = 0; i < sizeof(fields) / sizeof(fields[0]); ++i) { + lv_obj_set_style_text_font(fields[i], &lv_font_montserrat_28, 0); + lv_obj_set_style_bg_color(fields[i], lv_color_hex(0x1f2937), 0); + lv_obj_set_style_text_color(fields[i], lv_color_white(), 0); + lv_obj_set_style_text_color(fields[i], lv_color_hex(0xb7c3d0), LV_PART_TEXTAREA_PLACEHOLDER); + lv_obj_set_style_border_color(fields[i], lv_color_hex(0x526171), 0); + lv_obj_set_style_border_color(fields[i], lv_palette_main(LV_PALETTE_BLUE), LV_STATE_FOCUSED); + lv_obj_set_style_radius(fields[i], 12, 0); + lv_obj_set_style_pad_all(fields[i], 16, 0); + } keyboard = lv_keyboard_create(parent); lv_obj_set_size(keyboard, 640, 300); From 46bd9eea9c7f5ae6ed91b278730df9b414489e47 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:32 -0500 Subject: [PATCH 22/55] MQTT: Simplify the MQTT layout and enlarge touch controls --- main/mqtt_tool.c | 82 ++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/main/mqtt_tool.c b/main/mqtt_tool.c index da54b65..1f196c2 100644 --- a/main/mqtt_tool.c +++ b/main/mqtt_tool.c @@ -790,7 +790,7 @@ static void update_controls(void) if (copyable) lv_obj_remove_state(copy_receive_button, LV_STATE_DISABLED); else lv_obj_add_state(copy_receive_button, LV_STATE_DISABLED); if (!receive.present) - lv_label_set_text(receive_label, "No complete RX saved. COPY RX shares 0-128 raw bytes with Byte Lab."); + lv_label_set_text(receive_label, "No complete RX saved"); else lv_label_set_text_fmt(receive_label, "Latest complete RX: %u bytes | QoS %u%s%s\n%s\n%s", (unsigned)receive.length, receive.qos, receive.retained ? " | retained" : "", @@ -1150,10 +1150,12 @@ static lv_obj_t *row(lv_obj_t *parent, int height) { lv_obj_t *container = lv_obj_create(parent); lv_obj_set_size(container, 640, height); - lv_obj_set_style_pad_all(container, 2, 0); + lv_obj_set_style_pad_all(container, 0, 0); + lv_obj_set_style_border_width(container, 0, 0); + lv_obj_set_style_bg_opa(container, LV_OPA_TRANSP, 0); lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_EVENLY, + lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); return container; } @@ -1616,26 +1618,9 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, mac[3], mac[4], mac[5]); lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "MQTT Console"); + lv_label_set_text(title, "MQTT"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(parent); - lv_obj_set_width(help, 640); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(help, "TLS/WSS certificates are verified; plain transports require two taps.\n" - "TLS profiles save explicitly to unencrypted developer settings; cleartext stays memory-only.\n" - "SD logs are opt-in metadata and never contain credentials or payloads.\n" - "PASTE BYTES prepares 0-128 bytes from Byte Lab; review, then PUBLISH.\n" - "The default public test broker/topic is observable: never send secrets."); - - lv_obj_t *controls = row(parent, 78); - connect_button = action_button(controls, "", 140, connect_clicked, &connect_label); - action_button(controls, "", 120, qos_clicked, &qos_label); - action_button(controls, "", 140, retain_clicked, &retain_label); - action_button(controls, "", 140, log_clicked, &log_label); - if (!wifi_connected) lv_obj_add_state(connect_button, LV_STATE_DISABLED); - uri_area = lv_textarea_create(parent); - lv_obj_set_size(uri_area, 640, 72); lv_textarea_set_one_line(uri_area, true); lv_textarea_set_max_length(uri_area, MQTT_URI_MAX + 1); lv_textarea_set_text(uri_area, "mqtts://test.mosquitto.org:8886"); @@ -1643,25 +1628,31 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_obj_t *credentials = row(parent, 78); username_area = lv_textarea_create(credentials); - lv_obj_set_size(username_area, 292, 68); + lv_obj_set_size(username_area, 312, 64); lv_textarea_set_one_line(username_area, true); lv_textarea_set_max_length(username_area, MQTT_CREDENTIAL_MAX + 1); - lv_textarea_set_placeholder_text(username_area, "Username (optional)"); + lv_textarea_set_placeholder_text(username_area, "Username"); password_area = lv_textarea_create(credentials); - lv_obj_set_size(password_area, 292, 68); + lv_obj_set_size(password_area, 312, 64); lv_textarea_set_one_line(password_area, true); lv_textarea_set_password_mode(password_area, true); lv_textarea_set_max_length(password_area, MQTT_CREDENTIAL_MAX + 1); - lv_textarea_set_placeholder_text(password_area, "Password (never exported)"); + lv_textarea_set_placeholder_text(password_area, "Password"); + + lv_obj_t *controls = row(parent, 78); + connect_button = action_button(controls, "", 140, connect_clicked, &connect_label); + action_button(controls, "", 120, qos_clicked, &qos_label); + action_button(controls, "", 140, retain_clicked, &retain_label); + action_button(controls, "", 140, log_clicked, &log_label); + if (!wifi_connected) lv_obj_add_state(connect_button, LV_STATE_DISABLED); lv_obj_t *profile_actions = row(parent, 78); - save_profile_button = action_button(profile_actions, "SAVE PROFILE", 270, + save_profile_button = action_button(profile_actions, "SAVE PROFILE", 312, save_profile_clicked, NULL); - delete_profile_button = action_button(profile_actions, "DELETE PROFILE", 270, + delete_profile_button = action_button(profile_actions, "DELETE PROFILE", 312, delete_profile_clicked, NULL); topic_area = lv_textarea_create(parent); - lv_obj_set_size(topic_area, 640, 72); lv_textarea_set_one_line(topic_area, true); lv_textarea_set_max_length(topic_area, MQTT_TOPIC_MAX + 1); lv_textarea_set_text(topic_area, profile_loaded ? profile.topic : default_topic); @@ -1674,21 +1665,19 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, } mbedtls_platform_zeroize(&profile, sizeof(profile)); - lv_obj_t *actions = row(parent, 78); - subscribe_button = action_button(actions, "SUBSCRIBE", 140, subscribe_clicked, NULL); - publish_button = action_button(actions, "PUBLISH", 140, publish_clicked, NULL); - action_button(actions, "CLEAR", 140, clear_clicked, NULL); - copy_receive_button = action_button(actions, "COPY RX", 140, copy_receive_clicked, NULL); - payload_area = lv_textarea_create(parent); lv_obj_set_size(payload_area, 640, 140); lv_textarea_set_max_length(payload_area, MQTT_PAYLOAD_MAX + 1); lv_textarea_set_text(payload_area, "hello from Tab5 OS"); lv_textarea_set_placeholder_text(payload_area, "Text publish payload (maximum 512 UTF-8 bytes)"); + lv_obj_t *actions = row(parent, 78); + subscribe_button = action_button(actions, "SUBSCRIBE", 312, subscribe_clicked, NULL); + publish_button = action_button(actions, "PUBLISH", 312, publish_clicked, NULL); + lv_obj_t *payload_actions = row(parent, 78); - payload_mode_button = action_button(payload_actions, "", 270, payload_mode_clicked, &payload_mode_label); - paste_payload_button = action_button(payload_actions, "PASTE BYTES", 270, paste_payload_clicked, NULL); + payload_mode_button = action_button(payload_actions, "", 312, payload_mode_clicked, &payload_mode_label); + paste_payload_button = action_button(payload_actions, "PASTE BYTES", 312, paste_payload_clicked, NULL); payload_bytes_label = lv_label_create(parent); lv_obj_set_width(payload_bytes_label, 640); lv_obj_set_style_text_font(payload_bytes_label, &lv_font_montserrat_14, 0); @@ -1710,6 +1699,11 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, else lv_label_set_text(status_label, wifi_connected ? "Ready; connect explicitly" : "Connect to Wi-Fi first"); + lv_obj_move_to_index(status_label, 1); + + lv_obj_t *history_actions = row(parent, 78); + action_button(history_actions, "CLEAR", 312, clear_clicked, NULL); + copy_receive_button = action_button(history_actions, "COPY RX", 312, copy_receive_clicked, NULL); receive_label = lv_label_create(parent); lv_obj_set_width(receive_label, 640); lv_obj_set_style_text_font(receive_label, &lv_font_montserrat_14, 0); @@ -1718,7 +1712,21 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, history_area = lv_textarea_create(parent); lv_obj_set_size(history_area, 640, 300); lv_textarea_set_cursor_click_pos(history_area, false); - lv_textarea_set_placeholder_text(history_area, "Received and published messages"); + lv_textarea_set_placeholder_text(history_area, "No messages"); + + /* One-line textareas derive their height from the font; apply the touch + * height after enabling one-line mode so LVGL does not shrink them. */ + lv_obj_t *fields[] = {uri_area, username_area, password_area, topic_area, payload_area, history_area}; + for (size_t i = 0; i < sizeof(fields) / sizeof(fields[0]); i++) { + lv_obj_set_style_text_font(fields[i], &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_all(fields[i], 16, 0); + lv_obj_set_style_radius(fields[i], 12, 0); + } + lv_obj_set_style_text_font(history_area, &lv_font_montserrat_14, 0); + lv_obj_set_size(uri_area, 640, 64); + lv_obj_set_size(username_area, 312, 64); + lv_obj_set_size(password_area, 312, 64); + lv_obj_set_size(topic_area, 640, 64); keyboard = lv_keyboard_create(parent); lv_obj_set_size(keyboard, 640, 360); From e4eb275b6f3ec70154891fe89308d2b828e20d96 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:36 -0500 Subject: [PATCH 23/55] BLE GATT: Simplify BLE GATT with clearer controls and readable device lists --- main/ble_tool.c | 60 ++++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/main/ble_tool.c b/main/ble_tool.c index 39ac48f..6531472 100644 --- a/main/ble_tool.c +++ b/main/ble_tool.c @@ -609,10 +609,15 @@ static lv_obj_t *action_button(lv_obj_t *parent, const char *text, int width, { lv_obj_t *button = lv_button_create(parent); lv_obj_set_size(button, width, 72); + lv_obj_set_style_radius(button, 16, 0); + lv_obj_set_style_bg_color(button, lv_color_hex(0x2196F3), 0); + lv_obj_set_style_text_color(button, lv_color_white(), 0); + lv_obj_set_style_text_font(button, &lv_font_montserrat_28, 0); + lv_obj_set_style_shadow_width(button, 0, 0); lv_obj_add_event_cb(button, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(button); lv_obj_set_width(label, width - 20); - lv_label_set_long_mode(label, LV_LABEL_LONG_DOT); + lv_label_set_long_mode(label, LV_LABEL_LONG_WRAP); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(label, text); lv_obj_center(label); @@ -623,6 +628,10 @@ static lv_obj_t *row(lv_obj_t *parent, int height) { lv_obj_t *container = lv_obj_create(parent); lv_obj_set_size(container, 640, height); + lv_obj_set_style_bg_opa(container, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(container, 0, 0); + lv_obj_set_style_pad_all(container, 0, 0); + lv_obj_set_style_pad_column(container, 16, 0); lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_EVENLY, @@ -1093,11 +1102,11 @@ static void render_scan_view(void) portEXIT_CRITICAL(&tool_lock); lv_obj_t *controls = row(screen_parent, 84); - lv_obj_t *scan = action_button(controls, scanning ? "STOP SCAN" : "START SCAN", 250, + lv_obj_t *scan = action_button(controls, scanning ? "STOP SCAN" : "START SCAN", 302, scan_clicked, NULL); if (!available || pending) lv_obj_add_state(scan, LV_STATE_DISABLED); if (selected >= 0 && (size_t)selected < count) { - lv_obj_t *connect = action_button(controls, "CONNECT", 250, connect_clicked, NULL); + lv_obj_t *connect = action_button(controls, "CONNECT", 302, connect_clicked, NULL); if (pending) lv_obj_add_state(connect, LV_STATE_DISABLED); } for (size_t i = 0; i < count; i++) { @@ -1109,14 +1118,19 @@ static void render_scan_view(void) address, snapshot[i].rssi); lv_obj_t *device = action_button(screen_parent, text, 620, device_clicked, (void *)(intptr_t)i); - lv_obj_set_height(device, 86); + lv_obj_set_height(device, 104); + lv_obj_set_style_bg_color(device, lv_color_hex((int)i == selected ? 0x6A4C93 : 0x202938), 0); + lv_obj_set_style_border_color(device, lv_color_hex(0xA98BD4), 0); + lv_obj_set_style_border_width(device, (int)i == selected ? 2 : 0, 0); } if (!count) { lv_obj_t *empty = lv_label_create(screen_parent); lv_obj_set_width(empty, 620); lv_obj_set_style_text_align(empty, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(empty, scanning ? "Listening for advertisements..." : - "No scan results. Scanning never starts automatically."); + lv_obj_set_style_text_font(empty, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(empty, lv_color_hex(0xB8C4D4), 0); + lv_obj_set_style_pad_top(empty, 48, 0); + lv_label_set_text(empty, scanning ? "Scanning..." : "No devices found"); } } @@ -1158,24 +1172,17 @@ static void render_characteristic_detail(const ble_tool_characteristic_t *charac lv_label_set_long_mode(value_label, LV_LABEL_LONG_WRAP); copy_value_button = action_button(screen_parent, "COPY LATEST VALUE", 620, copy_value_clicked, NULL); update_value_panel(); - lv_obj_t *copy_help = lv_label_create(screen_parent); - lv_obj_set_width(copy_help, 620); - lv_obj_set_style_text_font(copy_help, &lv_font_montserrat_14, 0); - lv_label_set_text(copy_help, "Copy the latest received payload (0-64 bytes); no BLE traffic.\n" - "The handle above identifies its source, even when another is selected.\n" - "READ returns one ATT response; long values are not assembled."); - lv_obj_t *warning = lv_label_create(screen_parent); lv_obj_set_width(warning, 620); lv_obj_set_style_text_align(warning, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(warning, "Raw writes can change or damage a device.\n" - "The exact same value must be tapped twice within five seconds."); + "Tap WRITE RAW BYTES twice within 5 seconds to confirm."); write_area = lv_textarea_create(screen_parent); lv_obj_set_size(write_area, 620, 72); lv_textarea_set_one_line(write_area, true); lv_textarea_set_max_length(write_area, BLE_TOOL_WRITE_MAX * 3 - 1); lv_textarea_set_accepted_chars(write_area, "0123456789abcdefABCDEF "); - lv_textarea_set_placeholder_text(write_area, "Hex bytes, for example: 01 AF 00"); + lv_textarea_set_placeholder_text(write_area, "Hex bytes: 01 AF 00"); lv_obj_t *write = action_button(screen_parent, "WRITE RAW BYTES", 620, write_clicked, NULL); if (!(characteristic->properties & (BLE_GATT_CHR_PROP_WRITE | BLE_GATT_CHR_PROP_WRITE_NO_RSP)) || busy) lv_obj_add_state(write, LV_STATE_DISABLED); @@ -1211,8 +1218,8 @@ static void render_connected_view(void) lv_obj_t *controls = row(screen_parent, 82); lv_obj_t *disconnect = action_button(controls, disconnecting ? "DISCONNECTING..." : "DISCONNECT", - 260, disconnect_clicked, NULL); - lv_obj_t *save = action_button(controls, "SAVE EVIDENCE", 260, + 302, disconnect_clicked, NULL); + lv_obj_t *save = action_button(controls, "SAVE EVIDENCE", 302, save_evidence_clicked, NULL); if (disconnecting) lv_obj_add_state(disconnect, LV_STATE_DISABLED); if (!sd_available || in_discovery || disconnecting || busy) @@ -1225,7 +1232,7 @@ static void render_connected_view(void) lv_obj_set_width(summary, 620); lv_obj_set_style_text_align(summary, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text_fmt(summary, in_discovery ? "Discovering GATT database..." : - "%u services, %u characteristics. Tap one to inspect.", + "%u services / %u characteristics", (unsigned)services_found, (unsigned)count); for (size_t i = 0; i < count; i++) { char service_uuid[BLE_UUID_STR_LEN]; @@ -1240,7 +1247,10 @@ static void render_connected_view(void) service_uuid, characteristic_snapshot[i].val_handle, uuid, properties); lv_obj_t *button = action_button(screen_parent, text, 620, characteristic_clicked, (void *)(intptr_t)i); - lv_obj_set_height(button, 94); + lv_obj_set_height(button, 180); + lv_obj_set_style_bg_color(button, lv_color_hex(0x202938), 0); + lv_obj_t *label = lv_obj_get_child(button, 0); + lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_LEFT, 0); } } @@ -1250,19 +1260,13 @@ static void render(void) lv_obj_clean(screen_parent); status_label = value_label = copy_value_button = write_area = NULL; lv_obj_t *title = lv_label_create(screen_parent); - lv_label_set_text(title, "BLE GATT Explorer"); + lv_label_set_text(title, "BLE GATT"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(screen_parent); - lv_obj_set_width(help, 620); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(help, "Scanning and connections are always explicit.\n" - "Only connect to devices you own; pairing is not automated.\n" - "Discovery is capped at 8 devices, 16 services, and 32 characteristics.\n" - "A saved snapshot includes nearby device names and addresses."); status_label = lv_label_create(screen_parent); lv_obj_set_width(status_label, 620); lv_label_set_long_mode(status_label, LV_LABEL_LONG_WRAP); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_color(status_label, lv_color_hex(0xB8C4D4), 0); char status[sizeof(status_text)]; bool connected_snapshot; portENTER_CRITICAL(&tool_lock); @@ -1331,7 +1335,7 @@ void ble_tool_show(lv_obj_t *parent, bool available, bool sd_available, bool pending = connecting || connected || stopping; portEXIT_CRITICAL(&tool_lock); set_status(pending ? "Previous BLE connection is still stopping..." : - available ? "Ready; scanning and connections are opt-in" : + available ? "Ready" : "Bluetooth hardware is unavailable"); render(); ui_timer = lv_timer_create(tick, 200, NULL); From c516a1ab8d127378bde9d69c20e6f8379915f523 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:40 -0500 Subject: [PATCH 24/55] Network: Make Network easier to read and use by touch --- main/network_tool.c | 51 ++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/main/network_tool.c b/main/network_tool.c index 3bdd072..b426d5e 100644 --- a/main/network_tool.c +++ b/main/network_tool.c @@ -352,7 +352,7 @@ static bool update_link(void) if (dns.ip.type == ESP_IPADDR_TYPE_V4) snprintf(dns_text, sizeof(dns_text), IPSTR, IP2STR(&dns.ip.u_addr.ip4)); lv_label_set_text_fmt(link_label, - "%s Ch %u %d dBm\nIP " IPSTR " Gateway " IPSTR "\nMask " IPSTR " DNS %s", + "%s\nCh %u %d dBm\nIP " IPSTR "\nGateway " IPSTR "\nMask " IPSTR "\nDNS %s", access_point.ssid, (unsigned)access_point.primary, access_point.rssi, IP2STR(&ip.ip), IP2STR(&ip.gw), IP2STR(&ip.netmask), dns_text); return true; @@ -375,7 +375,9 @@ static void network_tick(lv_timer_t *timer) static lv_obj_t *action_button(lv_obj_t *parent, const char *text, lv_event_cb_t callback) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, 110, 68); + lv_obj_set_size(control, 202, 72); + lv_obj_set_style_radius(control, 14, 0); + lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, NULL); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -410,47 +412,66 @@ void network_tool_stop(void) void network_tool_show(lv_obj_t *parent, bool connected) { - lv_obj_set_style_pad_row(parent, 16, 0); + lv_obj_set_style_pad_row(parent, 12, 0); lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "Network Diagnostics"); + lv_label_set_text(title, "Network"); + lv_obj_set_width(title, 640); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); link_label = lv_label_create(parent); - lv_obj_set_size(link_label, 640, 100); - lv_obj_set_style_text_align(link_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_size(link_label, 640, LV_SIZE_CONTENT); + lv_obj_set_style_text_font(link_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(link_label, 6, 0); + lv_obj_set_style_bg_color(link_label, lv_color_hex(0x1f2937), 0); + lv_obj_set_style_bg_opa(link_label, LV_OPA_COVER, 0); + lv_obj_set_style_radius(link_label, 14, 0); + lv_obj_set_style_pad_all(link_label, 16, 0); bool link_connected = update_link(); network_connected = connected && link_connected; host_area = lv_textarea_create(parent); lv_obj_set_size(host_area, 640, 72); + lv_obj_set_style_text_font(host_area, &lv_font_montserrat_28, 0); + lv_obj_set_style_radius(host_area, 14, 0); lv_textarea_set_one_line(host_area, true); lv_textarea_set_max_length(host_area, NETWORK_HOST_MAX + 1); lv_textarea_set_text(host_area, pending_host); lv_textarea_set_placeholder_text(host_area, "Hostname or IP address"); lv_obj_t *actions = lv_obj_create(parent); - lv_obj_set_size(actions, 640, 82); - lv_obj_set_style_pad_all(actions, 4, 0); + lv_obj_set_size(actions, 640, 156); + lv_obj_set_style_bg_opa(actions, LV_OPA_TRANSP, 0); + lv_obj_set_style_border_width(actions, 0, 0); + lv_obj_set_style_pad_all(actions, 0, 0); + lv_obj_set_style_pad_gap(actions, 12, 0); lv_obj_clear_flag(actions, LV_OBJ_FLAG_SCROLLABLE); - lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW); - lv_obj_set_flex_align(actions, LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); + lv_obj_set_flex_flow(actions, LV_FLEX_FLOW_ROW_WRAP); + lv_obj_set_flex_align(actions, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_START); operation_buttons[0] = action_button(actions, "LOOK UP", lookup_clicked); operation_buttons[1] = action_button(actions, "PING x4", ping_clicked); operation_buttons[2] = action_button(actions, "mDNS", mdns_clicked); action_button(actions, "REFRESH", refresh_clicked); cancel_button = action_button(actions, "CANCEL", cancel_clicked); - result_label = lv_label_create(parent); - lv_obj_set_size(result_label, 640, 220); + lv_obj_t *results = lv_obj_create(parent); + lv_obj_set_size(results, 640, 180); + lv_obj_set_style_bg_color(results, lv_color_hex(0x1f2937), 0); + lv_obj_set_style_border_width(results, 0, 0); + lv_obj_set_style_radius(results, 14, 0); + lv_obj_set_style_pad_all(results, 16, 0); + lv_obj_set_scroll_dir(results, LV_DIR_VER); + result_label = lv_label_create(results); + lv_obj_set_width(result_label, LV_PCT(100)); + lv_obj_set_style_text_font(result_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_line_space(result_label, 6, 0); lv_label_set_long_mode(result_label, LV_LABEL_LONG_WRAP); - lv_obj_set_style_text_align(result_label, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(result_label, network_connected ? "Enter a target, then look it up or ping it" : "Connect to Wi-Fi first"); + lv_label_set_text(result_label, network_connected ? "Ready" : "Connect to Wi-Fi first"); if (network_tool_busy()) lv_label_set_text(result_label, "Cancelling the previous network check..."); show_finished_operation(); update_controls(); network_keyboard = lv_keyboard_create(parent); - lv_obj_set_size(network_keyboard, 640, 420); + lv_obj_set_size(network_keyboard, 640, 360); lv_keyboard_set_textarea(network_keyboard, host_area); network_timer = lv_timer_create(network_tick, 200, NULL); } From 17c09f44d520c02316cf7b44dd8ad71c649266de Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:44 -0500 Subject: [PATCH 25/55] Ender 3: Center and simplify the Ender 3 controls for touch use --- main/ender3_tool.c | 88 ++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/main/ender3_tool.c b/main/ender3_tool.c index 3f8938b..f8bb23a 100644 --- a/main/ender3_tool.c +++ b/main/ender3_tool.c @@ -483,6 +483,14 @@ static void update_controls(void) if (swap_label) lv_label_set_text(swap_label, swap_axes ? "SWAP\nX/Y" : "SWAP\nOFF"); if (invert_x_label) lv_label_set_text(invert_x_label, invert_x ? "INV X\nON" : "INV X\nOFF"); if (invert_y_label) lv_label_set_text(invert_y_label, invert_y ? "INV Y\nON" : "INV Y\nOFF"); + lv_obj_t *labels[] = {motor_label, swap_label, invert_x_label, invert_y_label}; + bool active[] = {motors_enabled, swap_axes, invert_x, invert_y}; + for (size_t i = 0; i < sizeof(labels) / sizeof(labels[0]); ++i) { + if (!labels[i]) continue; + lv_obj_t *button = lv_obj_get_parent(labels[i]); + if (active[i]) lv_obj_add_state(button, LV_STATE_CHECKED); + else lv_obj_remove_state(button, LV_STATE_CHECKED); + } } static void set_status(const char *format, ...) @@ -500,13 +508,12 @@ static void update_status(void) { if (!status_label) return; if (connected_flag) { - set_status(init_pending ? "Connected - sending setup commands..." : - "Connected to Ender 3 (USB-A host port)"); + set_status(init_pending ? "Connected · Setting up..." : + "Connected · USB-A"); } else if (host_error != ESP_OK) { set_status("USB host error: %s", esp_err_to_name(host_error)); } else { - set_status("Searching for Ender 3 on the USB-A port...\n" - "Plug the printer USB cable (A to B) into the tablet."); + set_status("Waiting for printer · USB-A"); } float x = 0.0f, y = 0.0f; @@ -525,10 +532,10 @@ static void update_status(void) if (pos_label) { if (valid) { char position_text[128]; - snprintf(position_text, sizeof(position_text), "X %+7.1f Y %+7.1f ok:%u", (double)x, (double)y, acks); + snprintf(position_text, sizeof(position_text), "X %+.1f Y %+.1f ACK %u", (double)x, (double)y, acks); lv_label_set_text(pos_label, position_text); } else { - lv_label_set_text_fmt(pos_label, "X ? Y ? ok:%u", acks); + lv_label_set_text_fmt(pos_label, "X — Y — ACK %u", acks); } } if (response_label) { @@ -748,9 +755,13 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, { lv_obj_t *control = lv_button_create(parent); lv_obj_set_size(control, width, 72); + lv_obj_set_style_radius(control, 16, 0); + lv_obj_set_style_bg_color(control, lv_color_hex(0x263544), 0); + lv_obj_set_style_bg_color(control, lv_color_hex(0x2196F3), LV_STATE_CHECKED); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); + if (width >= 140) lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_center(label); if (label_out) *label_out = label; @@ -761,10 +772,10 @@ static lv_obj_t *pad_button(lv_obj_t *parent, const char *text, uint32_t color, ender3_dir_t dir) { lv_obj_t *control = lv_button_create(parent); - lv_obj_set_size(control, 196, 196); + lv_obj_set_size(control, 144, 144); lv_obj_set_style_radius(control, 16, 0); lv_obj_set_style_bg_color(control, lv_color_hex(color), 0); - lv_obj_set_style_bg_color(control, lv_color_hex(color), LV_STATE_PRESSED); + lv_obj_set_style_bg_color(control, lv_color_darken(lv_color_hex(color), LV_OPA_20), LV_STATE_PRESSED); lv_obj_set_style_bg_opa(control, LV_OPA_COVER, LV_STATE_PRESSED); lv_obj_add_event_cb(control, dir_pressed, LV_EVENT_PRESSED, (void *)(uintptr_t)dir); lv_obj_add_event_cb(control, dir_released, LV_EVENT_RELEASED, (void *)(uintptr_t)dir); @@ -816,16 +827,9 @@ void ender3_tool_show(lv_obj_t *parent) lv_obj_set_style_pad_row(parent, 10, 0); lv_obj_t *title = lv_label_create(parent); - lv_label_set_text(title, "Ender 3 Robot Controller"); + lv_label_set_text(title, "Ender 3"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); - lv_obj_t *help = lv_label_create(parent); - lv_obj_set_width(help, 640); - lv_obj_set_style_text_align(help, LV_TEXT_ALIGN_CENTER, 0); - lv_label_set_text(help, "Hold FWD/BACK to drive, LEFT/RIGHT to spin in place. STOP halts motion.\n" - "X = left wheel, Y = right wheel. Use SWAP / INV X / INV Y to match your wiring.\n" - "Connect sets gentle acceleration (M201 X10 Y10) for the heavy chassis."); - status_label = lv_label_create(parent); lv_obj_set_width(status_label, 640); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); @@ -838,6 +842,7 @@ void ender3_tool_show(lv_obj_t *parent) pos_label = lv_label_create(parent); lv_obj_set_width(pos_label, 640); + lv_obj_set_style_text_font(pos_label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(pos_label, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(pos_label, "X ? Y ?"); @@ -846,40 +851,32 @@ void ender3_tool_show(lv_obj_t *parent) lv_obj_set_style_text_align(response_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_color(response_label, lv_color_hex(0x90A4AE), 0); - // D-pad: FWD top, LEFT/STOP/RIGHT middle, BACK bottom. + // Explicit positions keep Forward and Back aligned with Stop. lv_obj_t *pad = lv_obj_create(parent); lv_obj_remove_style_all(pad); - lv_obj_set_size(pad, 620, 620); - lv_obj_set_flex_flow(pad, LV_FLEX_FLOW_ROW_WRAP); - lv_obj_set_flex_align(pad, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); - lv_obj_set_style_pad_gap(pad, 10, 0); - pad_button(pad, LV_SYMBOL_UP "\nFWD", 0x2E7D32, E3_DIR_FWD); - lv_obj_t *spacer = lv_obj_create(pad); - lv_obj_remove_style_all(spacer); - lv_obj_set_size(spacer, 196, 196); - spacer = lv_obj_create(pad); - lv_obj_remove_style_all(spacer); - lv_obj_set_size(spacer, 196, 196); - pad_button(pad, LV_SYMBOL_LEFT "\nLEFT", 0x1565C0, E3_DIR_LEFT); + lv_obj_set_size(pad, 640, 456); + lv_obj_t *forward = pad_button(pad, LV_SYMBOL_UP "\nFWD", 0x2E7D32, E3_DIR_FWD); + lv_obj_set_pos(forward, 248, 0); + lv_obj_t *left = pad_button(pad, LV_SYMBOL_LEFT "\nLEFT", 0x1565C0, E3_DIR_LEFT); + lv_obj_set_pos(left, 92, 156); lv_obj_t *stop_button = pad_button(pad, "STOP", 0xC62828, E3_DIR_NONE); + lv_obj_set_pos(stop_button, 248, 156); lv_obj_remove_event_cb(stop_button, dir_pressed); lv_obj_remove_event_cb(stop_button, dir_released); lv_obj_add_event_cb(stop_button, stop_clicked, LV_EVENT_CLICKED, NULL); - pad_button(pad, LV_SYMBOL_RIGHT "\nRIGHT", 0x1565C0, E3_DIR_RIGHT); - spacer = lv_obj_create(pad); - lv_obj_remove_style_all(spacer); - lv_obj_set_size(spacer, 196, 196); - pad_button(pad, LV_SYMBOL_DOWN "\nBACK", 0x2E7D32, E3_DIR_BACK); - spacer = lv_obj_create(pad); - lv_obj_remove_style_all(spacer); - lv_obj_set_size(spacer, 196, 196); + lv_obj_t *right = pad_button(pad, LV_SYMBOL_RIGHT "\nRIGHT", 0x1565C0, E3_DIR_RIGHT); + lv_obj_set_pos(right, 404, 156); + lv_obj_t *back = pad_button(pad, LV_SYMBOL_DOWN "\nBACK", 0x2E7D32, E3_DIR_BACK); + lv_obj_set_pos(back, 248, 312); // Speed slider. lv_obj_t *speed_row = row(parent, 80); + lv_obj_set_style_text_font(speed_row, &lv_font_montserrat_28, 0); lv_obj_t *speed_title = lv_label_create(speed_row); lv_label_set_text(speed_title, "Speed"); lv_obj_t *slider = lv_slider_create(speed_row); - lv_obj_set_size(slider, 340, 18); + lv_obj_set_size(slider, 400, 24); + lv_obj_set_ext_click_area(slider, 18); lv_slider_set_range(slider, 1, 100); lv_slider_set_value(slider, 20, LV_ANIM_OFF); lv_obj_add_event_cb(slider, speed_changed, LV_EVENT_VALUE_CHANGED, NULL); @@ -895,9 +892,9 @@ void ender3_tool_show(lv_obj_t *parent) // Quick commands. lv_obj_t *quick_row = row(parent, 76); - small_button(quick_row, "ZERO", 200, quick_clicked, (void *)"G92 X0 Y0", NULL); - small_button(quick_row, "M114", 200, quick_clicked, (void *)"M114", NULL); - small_button(quick_row, "M119", 200, quick_clicked, (void *)"M119", NULL); + small_button(quick_row, "Zero X/Y", 200, quick_clicked, (void *)"G92 X0 Y0", NULL); + small_button(quick_row, "Position", 200, quick_clicked, (void *)"M114", NULL); + small_button(quick_row, "Endstops", 200, quick_clicked, (void *)"M119", NULL); // Raw G-code line. lv_obj_t *send_row = row(parent, 76); @@ -905,8 +902,9 @@ void ender3_tool_show(lv_obj_t *parent) lv_obj_set_size(input_area, 400, 72); lv_textarea_set_one_line(input_area, true); lv_textarea_set_max_length(input_area, E3_LINE_CAP - 1); - lv_textarea_set_placeholder_text(input_area, "Raw G-code (e.g. M114)"); - small_button(send_row, "SEND", 120, send_clicked, NULL, NULL); + lv_textarea_set_placeholder_text(input_area, "G-code"); + lv_obj_t *send_button = small_button(send_row, "SEND", 120, send_clicked, NULL, NULL); + lv_obj_set_style_bg_color(send_button, lv_color_hex(0x2196F3), 0); small_button(send_row, "CLEAR", 100, clear_clicked, NULL, NULL); lv_obj_t *keyboard = lv_keyboard_create(parent); @@ -916,6 +914,7 @@ void ender3_tool_show(lv_obj_t *parent) output_area = lv_textarea_create(parent); lv_obj_set_size(output_area, 640, 220); lv_textarea_set_text(output_area, ""); + lv_textarea_set_placeholder_text(output_area, "No printer activity"); lv_textarea_set_cursor_click_pos(output_area, false); update_controls(); @@ -944,8 +943,7 @@ void ender3_tool_show(lv_obj_t *parent) update_status(); return; } - set_status("Searching for Ender 3 on the USB-A port...\n" - "Plug the printer USB cable (A to B) into the tablet."); + set_status("Waiting for printer · USB-A"); } bool ender3_tool_busy(void) From ea229713030d3fd5b59717379b5c87149e8362cc Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:49 -0500 Subject: [PATCH 26/55] Electronics: Improve Electronics layout with larger controls and clearer results --- main/electronics_tool.c | 69 +++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/main/electronics_tool.c b/main/electronics_tool.c index d19a83e..a9f665c 100644 --- a/main/electronics_tool.c +++ b/main/electronics_tool.c @@ -26,9 +26,7 @@ static lv_obj_t *unknown_select; static lv_obj_t *field_rows[3]; static lv_obj_t *field_labels[3]; static lv_obj_t *fields[3]; -static lv_obj_t *help_label; static lv_obj_t *result_label; -static lv_obj_t *note_label; static lv_obj_t *keyboard; static lv_obj_t *keys_label; static bool updating; @@ -152,22 +150,6 @@ static void update_mode(void) {"Supply (V)", "LED forward (V)", "LED current (mA)"}, {"Resistance (ohm)", "Capacitance (uF)", ""}, }; - static const char *const help[] = { - "Find one unknown from two values. V = I x R; P = V x I.", - "Vin -- Top R -- Vout -- Bottom R -- GND\nOutput is measured across the bottom resistor, with no load.", - "Supply -- series resistor -- one LED -- GND\nUse the LED's forward voltage at your intended current.", - "Vin -- R -- Vout; C from Vout to GND.\nCapacitance is in microfarads: 0.1 uF = 100 nF.", - }; - static const char *const notes[] = { - "Ideal DC resistor calculation. Inputs are retained until restart.\nDecimal inputs: 0.000000001 to 1000000000000; up to 24 characters.", - "A connected load changes Vout. Check actual component tolerances.\nDecimal inputs: 0.000000001 to 1000000000000; up to 24 characters.", - "Choose an equal or higher resistance and a power rating above the\n" - "calculated dissipation. Values assume a fixed LED forward voltage.\n" - "Decimal inputs: 0.000000001 to 1000000000000; up to 24 characters.", - "Ideal RC low-pass: zero source impedance and no output load.\n" - "Settling means within 1% of the final step value. Actual component\n" - "tolerances and loading change the result. Inputs stay in RAM.", - }; updating = true; for (unsigned i = 0; i < MODE_COUNT; i++) { if (i == mode) lv_obj_add_state(mode_buttons[i], LV_STATE_CHECKED); @@ -187,8 +169,6 @@ static void update_mode(void) } else { lv_obj_remove_flag(field_rows[2], LV_OBJ_FLAG_HIDDEN); } - lv_label_set_text(help_label, help[mode]); - lv_label_set_text(note_label, notes[mode]); lv_keyboard_set_textarea(keyboard, fields[0]); updating = false; calculate(); @@ -223,7 +203,8 @@ static lv_obj_t *button(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback, void *user_data) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, width, 60); + lv_obj_set_size(object, width, 72); + lv_obj_set_style_radius(object, 14, 0); lv_obj_t *label = lv_label_create(object); lv_label_set_text(label, text); lv_obj_center(label); @@ -231,12 +212,11 @@ static lv_obj_t *button(lv_obj_t *parent, const char *text, int width, return object; } -static lv_obj_t *label(lv_obj_t *parent, const char *text, bool small) +static lv_obj_t *label(lv_obj_t *parent, const char *text) { lv_obj_t *object = lv_label_create(parent); lv_obj_set_width(object, 640); lv_label_set_long_mode(object, LV_LABEL_LONG_WRAP); - if (small) lv_obj_set_style_text_font(object, &lv_font_montserrat_14, 0); lv_label_set_text(object, text); return object; } @@ -248,9 +228,7 @@ void electronics_tool_stop(void) keys_label = NULL; unknown_row = NULL; unknown_select = NULL; - help_label = NULL; result_label = NULL; - note_label = NULL; for (unsigned i = 0; i < MODE_COUNT; i++) mode_buttons[i] = NULL; for (unsigned i = 0; i < 3; i++) { field_rows[i] = NULL; @@ -269,45 +247,62 @@ void electronics_tool_show(lv_obj_t *parent) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 12, 0); + lv_obj_set_style_pad_row(column, 20, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); - label(column, "Electronics Calculator", false); + label(column, "Electronics"); lv_obj_t *modes = NULL; static const char *const names[] = {"Ohm's law", "Divider", "LED resistor", "RC filter"}; for (unsigned i = 0; i < MODE_COUNT; i++) { - if (i % 2 == 0) modes = row(column, 60); + if (i % 2 == 0) modes = row(column, 72); mode_buttons[i] = button(modes, names[i], 310, mode_clicked, (void *)(uintptr_t)i); + lv_obj_set_style_bg_color(mode_buttons[i], lv_color_hex(0x202938), 0); lv_obj_set_style_bg_color(mode_buttons[i], lv_color_hex(0x00695C), LV_STATE_CHECKED); + lv_obj_set_style_border_width(mode_buttons[i], 2, LV_STATE_CHECKED); + lv_obj_set_style_border_color(mode_buttons[i], lv_color_hex(0x00BFA5), LV_STATE_CHECKED); } - unknown_row = row(column, 60); + unknown_row = row(column, 72); lv_obj_t *solve = lv_label_create(unknown_row); lv_label_set_text(solve, "Solve for"); unknown_select = lv_dropdown_create(unknown_row); - lv_obj_set_size(unknown_select, 400, 60); + lv_obj_set_size(unknown_select, 400, 72); + lv_obj_set_style_pad_ver(unknown_select, 18, 0); + lv_obj_set_style_text_font(lv_dropdown_get_list(unknown_select), &lv_font_montserrat_28, 0); + lv_obj_set_style_pad_ver(lv_dropdown_get_list(unknown_select), 12, 0); + lv_obj_set_style_text_line_space(lv_dropdown_get_list(unknown_select), 20, 0); lv_dropdown_set_options(unknown_select, "Voltage (V)\nCurrent (mA)\nResistance (ohm)"); lv_dropdown_set_selected(unknown_select, unknown); lv_obj_add_event_cb(unknown_select, unknown_changed, LV_EVENT_VALUE_CHANGED, NULL); - help_label = label(column, "", true); for (unsigned i = 0; i < 3; i++) { - field_rows[i] = row(column, 64); + field_rows[i] = row(column, 76); field_labels[i] = lv_label_create(field_rows[i]); lv_obj_set_width(field_labels[i], 275); fields[i] = lv_textarea_create(field_rows[i]); - lv_obj_set_size(fields[i], 354, 64); + lv_obj_set_size(fields[i], 354, 76); + lv_obj_set_style_pad_all(fields[i], 18, 0); + lv_obj_set_style_radius(fields[i], 12, 0); /* Preserve pasted newlines; the decimal parser rejects them. */ lv_textarea_set_max_length(fields[i], ELECTRONICS_INPUT_MAX + 1); lv_obj_add_event_cb(fields[i], field_event, LV_EVENT_ALL, (void *)(uintptr_t)i); } - lv_obj_t *actions = row(column, 60); + lv_obj_t *actions = row(column, 72); button(actions, "Calculate", 310, calculate_clicked, NULL); lv_obj_t *keys = button(actions, "Hide keys", 310, keys_clicked, NULL); + lv_obj_set_style_bg_color(keys, lv_color_hex(0x202938), 0); keys_label = lv_obj_get_child(keys, 0); - result_label = label(column, "", false); - lv_obj_set_height(result_label, 160); - note_label = label(column, "", true); + lv_obj_t *results = lv_obj_create(column); + lv_obj_set_size(results, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(results, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(results, lv_color_hex(0x202938), 0); + lv_obj_set_style_text_color(results, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_border_width(results, 0, 0); + lv_obj_set_style_radius(results, 14, 0); + lv_obj_set_style_pad_all(results, 24, 0); + result_label = label(results, ""); + lv_obj_set_width(result_label, 592); + lv_obj_set_style_text_line_space(result_label, 12, 0); keyboard = lv_keyboard_create(column); lv_obj_set_size(keyboard, 640, 246); lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_NUMBER); From 0af23fe734379425159f02f3bf2ce02f626a5ea7 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:53 -0500 Subject: [PATCH 27/55] Byte Lab: Improve Byte Lab readability and layout --- main/byte_tool.c | 94 +++++++++++++++++------------------------ tests/offline_ui_test.c | 6 +-- 2 files changed, 42 insertions(+), 58 deletions(-) diff --git a/main/byte_tool.c b/main/byte_tool.c index d0c2c30..cb9732e 100644 --- a/main/byte_tool.c +++ b/main/byte_tool.c @@ -30,7 +30,6 @@ static lv_obj_t *type_select; static lv_obj_t *order_select; static lv_obj_t *use_hex_button; static lv_obj_t *input_area; -static lv_obj_t *help_label; static lv_obj_t *result_label; static lv_obj_t *preview_label; static lv_obj_t *keyboard; @@ -104,10 +103,12 @@ static void render_result(void) } if (status != BYTE_DATA_OK) { lv_label_set_text(result_label, byte_data_error(status)); - lv_label_set_text(preview_label, "Fix the input to calculate checksums and preview bytes."); + lv_label_set_text(preview_label, ""); + lv_obj_add_flag(lv_obj_get_parent(preview_label), LV_OBJ_FLAG_HIDDEN); return; } + lv_obj_remove_flag(lv_obj_get_parent(preview_label), LV_OBJ_FLAG_HIDDEN); char heading[100] = ""; if (input_mode == INPUT_NUMBER) { char value[32]; @@ -151,7 +152,7 @@ static void render_result(void) i + 1 == data.length ? "" : " "); } used += (size_t)snprintf(preview + used, sizeof(preview) - used, - "%s\n\nASCII (non-printable = .)\n", data.length ? "" : "(empty)"); + "%s\n\nASCII\n", data.length ? "" : "(empty)"); if (!data.length) { snprintf(preview + used, sizeof(preview) - used, "(empty)"); } else { @@ -164,26 +165,6 @@ static void render_result(void) lv_label_set_text(preview_label, preview); } -static void update_help(void) -{ - if (input_mode == INPUT_NUMBER) { - static const char *const limits[] = { - "0 to 255", "-128 to 127", "0 to 65535", "-32768 to 32767", - "0 to 4294967295", "-2147483648 to 2147483647", "decimal, exponent, NaN or +/-Inf" - }; - char text[224]; - snprintf(text, sizeof(text), "%s: %s. Up to 32 characters; no spaces or units.\n%s", - number_names[number_type], limits[number_type], number_type == BYTE_NUMBER_FLOAT32 ? - "Result shows the rounded Float32 value. Nonzero underflow to zero is rejected." : - "Decimal integers only. Signed types use two's complement."); - lv_label_set_text(help_label, text); - return; - } - lv_label_set_text(help_label, input_mode == BYTE_DATA_HEX ? - "Hex byte pairs: 01 03 or 0103. Whitespace between bytes is OK. No 0x prefix. Maximum 128 bytes." : - "Literal 7-bit ASCII, maximum 128 bytes. Newlines count; backslash escapes are not expanded. Use hex for binary data."); -} - static void render_later(void *context) { (void)context; @@ -231,13 +212,12 @@ static void apply_mode(void) lv_obj_add_flag(number_controls, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(use_hex_button, LV_OBJ_FLAG_HIDDEN); } - lv_obj_set_height(input_area, input_mode == INPUT_NUMBER ? 64 : 120); - lv_obj_set_style_text_font(preview_label, input_mode == INPUT_NUMBER ? - &lv_font_montserrat_28 : &lv_font_montserrat_14, 0); + lv_obj_set_height(input_area, input_mode == INPUT_NUMBER ? 72 : 144); + lv_textarea_set_placeholder_text(input_area, input_mode == INPUT_NUMBER ? "0" : + input_mode == BYTE_DATA_HEX ? "00 01 02" : "ASCII text"); lv_textarea_set_max_length(input_area, input_mode == INPUT_NUMBER ? BYTE_NUMBER_MAX_TEXT + 1 : input_mode == BYTE_DATA_ASCII ? BYTE_DATA_MAX_BYTES + 1 : BYTE_DATA_MAX_TEXT + 1); update_keyboard_mode(); - update_help(); set_input_text(input_mode == INPUT_NUMBER ? saved_number : saved_input[input_mode]); } @@ -253,7 +233,6 @@ static void number_changed(lv_event_t *event) (void)event; number_type = (byte_number_type_t)lv_dropdown_get_selected(type_select); little_endian = lv_dropdown_get_selected(order_select) != 0; - update_help(); render_result(); } @@ -280,13 +259,11 @@ static void update_clipboard(void) if (copy) { lv_obj_remove_state(paste_button, LV_STATE_DISABLED); lv_obj_remove_state(clear_copy_button, LV_STATE_DISABLED); - lv_label_set_text_fmt(clipboard_label, "Byte clipboard: %u bytes in RAM. Paste replaces the Hex draft.\n" - "Shared across bench tools. Copy and paste never send.", (unsigned)copy->length); + lv_label_set_text_fmt(clipboard_label, "Clipboard: %u bytes", (unsigned)copy->length); } else { lv_obj_add_state(paste_button, LV_STATE_DISABLED); lv_obj_add_state(clear_copy_button, LV_STATE_DISABLED); - lv_label_set_text(clipboard_label, "Byte clipboard is empty. Copy bytes to share across bench tools.\n" - "Paste replaces the Hex draft. Clipboard clears on restart."); + lv_label_set_text(clipboard_label, "Clipboard empty"); } } @@ -376,7 +353,6 @@ void byte_tool_stop(void) loading_input = false; mode_select = number_controls = type_select = order_select = use_hex_button = NULL; input_area = NULL; - help_label = NULL; result_label = NULL; preview_label = NULL; keyboard = NULL; @@ -385,7 +361,7 @@ void byte_tool_stop(void) void byte_tool_show(lv_obj_t *parent) { - lv_obj_set_style_pad_row(parent, 14, 0); + lv_obj_set_style_pad_row(parent, 20, 0); lv_obj_t *title = lv_label_create(parent); lv_label_set_text(title, "Byte Lab"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); @@ -406,10 +382,6 @@ void byte_tool_show(lv_obj_t *parent) button(controls, "EXAMPLE", example_clicked); button(controls, "CLEAR", clear_clicked); - help_label = lv_label_create(parent); - lv_obj_set_width(help_label, 640); - update_help(); - number_controls = lv_obj_create(parent); lv_obj_remove_style_all(number_controls); lv_obj_set_size(number_controls, 640, 64); @@ -432,7 +404,8 @@ void byte_tool_show(lv_obj_t *parent) lv_obj_add_event_cb(order_select, number_changed, LV_EVENT_VALUE_CHANGED, NULL); input_area = lv_textarea_create(parent); - lv_obj_set_size(input_area, 640, 120); + lv_obj_set_size(input_area, 640, 144); + lv_obj_set_style_pad_all(input_area, 18, 0); lv_obj_set_style_text_font(input_area, &lv_font_montserrat_28, 0); lv_obj_add_event_cb(input_area, input_changed, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_add_event_cb(input_area, input_focused, LV_EVENT_FOCUSED, NULL); @@ -452,7 +425,8 @@ void byte_tool_show(lv_obj_t *parent) lv_obj_set_width(clear_copy_button, 206); clipboard_label = lv_label_create(parent); lv_obj_set_width(clipboard_label, 640); - lv_obj_set_style_text_font(clipboard_label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(clipboard_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(clipboard_label, lv_color_hex(0xAAB6C6), 0); update_clipboard(); keyboard = lv_keyboard_create(parent); @@ -465,27 +439,37 @@ void byte_tool_show(lv_obj_t *parent) lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); - result_label = lv_label_create(parent); - lv_obj_set_width(result_label, 640); - lv_obj_set_style_text_font(result_label, &lv_font_montserrat_28, 0); - lv_label_set_long_mode(result_label, LV_LABEL_LONG_WRAP); - lv_obj_t *preview = lv_obj_create(parent); - lv_obj_set_size(preview, 640, 225); + lv_obj_set_size(preview, 640, LV_SIZE_CONTENT); + lv_obj_set_style_min_height(preview, 200, 0); + lv_obj_set_style_max_height(preview, 320, 0); + lv_obj_set_style_bg_color(preview, lv_color_hex(0x202938), 0); + lv_obj_set_style_border_width(preview, 0, 0); + lv_obj_set_style_radius(preview, 16, 0); + lv_obj_set_style_pad_all(preview, 20, 0); preview_label = lv_label_create(preview); lv_obj_set_width(preview_label, LV_PCT(100)); + lv_obj_set_style_text_font(preview_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(preview_label, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_text_line_space(preview_label, 6, 0); lv_label_set_long_mode(preview_label, LV_LABEL_LONG_WRAP); - use_hex_button = button(parent, "USE AS HEX (replaces Hex draft)", use_hex_clicked); + use_hex_button = button(parent, "Use as hex", use_hex_clicked); lv_obj_set_width(use_hex_button, 640); - lv_obj_t *footnote = lv_label_create(parent); - lv_obj_set_width(footnote, 640); - lv_label_set_text(footnote, "Offline calculation only. Inputs stay in RAM until restart.\n" - "Tap the payload for keys; Done hides them. BE = big endian, LE = little endian.\n" - "Integer views need 1, 2 or 4 bytes; IEEE 754 Float32 needs exactly 4.\n" - "SUM8 wraps modulo 256; checksums cover every decoded byte.\n" - "MODBUS: init FFFF, reflected A001, xor 0000.\n" - "CRC-32: init/xor FFFFFFFF, reflected EDB88320."); + lv_obj_t *results = lv_obj_create(parent); + lv_obj_set_size(results, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(results, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_style_bg_color(results, lv_color_hex(0x18212C), 0); + lv_obj_set_style_border_width(results, 0, 0); + lv_obj_set_style_radius(results, 16, 0); + lv_obj_set_style_pad_all(results, 20, 0); + result_label = lv_label_create(results); + lv_obj_set_width(result_label, LV_PCT(100)); + lv_obj_set_style_text_font(result_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(result_label, lv_color_hex(0xFFFFFF), 0); + lv_obj_set_style_text_line_space(result_label, 8, 0); + lv_label_set_long_mode(result_label, LV_LABEL_LONG_WRAP); + apply_mode(); } diff --git a/tests/offline_ui_test.c b/tests/offline_ui_test.c index a02d0f5..96a18a2 100644 --- a/tests/offline_ui_test.c +++ b/tests/offline_ui_test.c @@ -178,7 +178,7 @@ static void byte_number_checks(void) assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "1.5")); assert(lv_obj_has_flag(keyboard, LV_OBJ_FLAG_HIDDEN)); set_input(0, "0.1"); assert(has_text(content, "Encoded Float32 LE: 0.100000001")); - assert(click("USE AS HEX (replaces Hex draft)")); + assert(click("Use as hex")); assert(lv_dropdown_get_selected(nth(&lv_dropdown_class, 0)) == 0); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "CD CC CC 3D")); assert(has_text(content, "Float32 LE: 0.100000001")); @@ -199,7 +199,7 @@ static void byte_number_checks(void) set_input(0, bad[i]); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), bad[i])); assert(!has_text(content, "Encoded ") && !has_text(content, "CRC-32/")); - lv_obj_t *use = lv_obj_get_parent(label_find(content, "USE AS HEX (replaces Hex draft)")); + lv_obj_t *use = lv_obj_get_parent(label_find(content, "Use as hex")); assert(lv_obj_has_state(use, LV_STATE_DISABLED)); lv_obj_send_event(use, LV_EVENT_CLICKED, NULL); assert(lv_dropdown_get_selected(nth(&lv_dropdown_class, 0)) == 2); @@ -255,7 +255,7 @@ static void byte_clipboard_checks(void) select_dropdown(0, 1); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "keep ASCII")); select_dropdown(0, 2); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), "1.5")); byte_tool_stop(); reset_content(); byte_tool_show(content); refresh(); - assert(has_text(content, "Byte clipboard: 4 bytes in RAM")); + assert(has_text(content, "Clipboard: 4 bytes")); assert(click("Paste hex")); assert(click("CLEAR")); assert(click("Copy bytes")); assert(copy->length == 0 && payload_clipboard_peek()); From b727cc551ed0675ef7f50c3533d900b17a15bad1 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:01:58 -0500 Subject: [PATCH 28/55] Modbus TCP: Improve Modbus TCP readability and touch layout --- main/modbus_tool.c | 58 ++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/main/modbus_tool.c b/main/modbus_tool.c index 4f87b35..e91e3d7 100644 --- a/main/modbus_tool.c +++ b/main/modbus_tool.c @@ -260,6 +260,8 @@ static void refresh(lv_timer_t *timer) set_enabled(test_button, !busy); set_enabled(stop_button, busy); render_values(&job, busy); + if (job.present) lv_obj_remove_flag(identity_label, LV_OBJ_FLAG_HIDDEN); + else lv_obj_add_flag(identity_label, LV_OBJ_FLAG_HIDDEN); if (!job.present) return; char identity[192]; if (job.probe) @@ -467,11 +469,11 @@ static lv_obj_t *field_block(lv_obj_t *parent, const char *name, int width) { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, width, 80); + lv_obj_set_size(block, width, 100); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(block, 4, 0); - lv_obj_t *caption = label(block, name, true); + lv_obj_set_style_pad_row(block, 6, 0); + lv_obj_t *caption = label(block, name, false); lv_obj_set_width(caption, width); return block; } @@ -490,7 +492,7 @@ static void input(lv_obj_t *parent, const char *name, unsigned index, int width) static lv_obj_t *button(lv_obj_t *parent, const char *text, lv_event_cb_t callback, void *user_data) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, 206, 60); + lv_obj_set_size(object, 206, 68); lv_obj_t *caption = lv_label_create(object); lv_label_set_text(caption, text); lv_obj_center(caption); @@ -540,15 +542,13 @@ void modbus_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 10, 0); + lv_obj_set_style_pad_row(column, 12, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); - label(column, "Modbus TCP Inspector", false); - label(column, "Read coils, discrete inputs or registers from a device you manage.\n" - "One request per read. TCP test opens a connection without sending data.", true); - lv_obj_t *destination = row(column, 80); - input(destination, "Device IPv4 address", 0, 430); - input(destination, "TCP port (1-65535)", 1, 198); - lv_obj_t *operation = row(column, 80); + label(column, "Modbus TCP", false); + lv_obj_t *destination = row(column, 100); + input(destination, "Device IPv4", 0, 430); + input(destination, "TCP port", 1, 198); + lv_obj_t *operation = row(column, 100); lv_obj_t *function = field_block(operation, "Read function", 430); function_select = lv_dropdown_create(function); readable_options(function_select); @@ -556,10 +556,10 @@ void modbus_tool_show(lv_obj_t *parent, bool connected) lv_dropdown_set_options(function_select, "01 Coils\n02 Discrete inputs\n03 Holding registers\n04 Input registers"); lv_dropdown_set_selected(function_select, function_index); lv_obj_add_event_cb(function_select, function_changed, LV_EVENT_VALUE_CHANGED, NULL); - input(operation, "Unit ID (0-255)", 2, 198); - lv_obj_t *range = row(column, 80); - input(range, "Zero-based start address (0-65535)", 3, 430); - input(range, "Count (1-16)", 4, 198); + input(operation, "Unit ID", 2, 198); + lv_obj_t *range = row(column, 100); + input(range, "Start address (0-based)", 3, 430); + input(range, "Count", 4, 198); keyboard = lv_keyboard_create(column); lv_obj_set_style_text_font(keyboard, &lv_font_montserrat_28, LV_PART_ITEMS); lv_obj_set_size(keyboard, 640, 220); @@ -567,39 +567,37 @@ void modbus_tool_show(lv_obj_t *parent, bool connected) lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); - lv_obj_t *actions = row(column, 60); + lv_obj_t *actions = row(column, 68); read_button = button(actions, "READ", start_clicked, NULL); read_label = lv_obj_get_child(read_button, 0); test_button = button(actions, "TEST TCP", start_clicked, (void *)1); stop_button = button(actions, "STOP", stop_clicked, NULL); - status_label = label(column, connected ? "Ready. READ requires a second tap for cleartext confirmation." : - "Connect to Wi-Fi before starting. You can configure the request now.", true); - lv_obj_set_height(status_label, 44); - identity_label = label(column, "No request has been sent.", true); - lv_obj_set_height(identity_label, 44); - lv_obj_t *views = row(column, 80); - lv_obj_t *view_block = field_block(views, "Saved reply: value view", 310); + lv_obj_set_style_bg_color(test_button, lv_color_hex(0x263445), 0); + lv_obj_set_style_bg_color(stop_button, lv_color_hex(0x263445), 0); + status_label = label(column, connected ? "Ready" : "Wi-Fi disconnected", false); + lv_obj_set_style_min_height(status_label, 68, 0); + label(column, "Results", false); + identity_label = label(column, "", true); + lv_obj_t *views = row(column, 100); + lv_obj_t *view_block = field_block(views, "Value view", 310); view_select = lv_dropdown_create(view_block); readable_options(view_select); lv_obj_set_size(view_select, 310, 60); lv_dropdown_set_options(view_select, "16-bit registers\nUnsigned 32-bit\nSigned 32-bit\nFloat32"); lv_dropdown_set_selected(view_select, value_view); lv_obj_add_event_cb(view_select, view_changed, LV_EVENT_VALUE_CHANGED, NULL); - lv_obj_t *order_block = field_block(views, "32-bit byte order", 310); + lv_obj_t *order_block = field_block(views, "Byte order", 310); order_select = lv_dropdown_create(order_block); readable_options(order_select); lv_obj_set_size(order_select, 310, 60); lv_dropdown_set_options(order_select, "ABCD\nCDAB\nBADC\nDCBA"); lv_dropdown_set_selected(order_select, byte_order); lv_obj_add_event_cb(order_select, view_changed, LV_EVENT_VALUE_CHANGED, NULL); - label(column, "A B = first register bytes; C D = next register bytes.\n" - "Pairs start at the read address. Check the device's mapping and scaling.", true); result_box = lv_obj_create(column); - lv_obj_set_size(result_box, 640, 250); + lv_obj_set_size(result_box, 640, 280); lv_obj_set_style_pad_all(result_box, 16, 0); lv_obj_set_scroll_dir(result_box, LV_DIR_VER); - result_label = label(result_box, "Results appear here. After a register read, choose a value view.\n" - "Changing the view reinterprets the saved reply without sending a request.", true); + result_label = label(result_box, "No reply yet", false); lv_obj_set_width(result_label, 596); rendered_revision = UINT32_MAX; refresh(NULL); From 7891a068630bda6b71cf599c31d1740613541a1b Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:02 -0500 Subject: [PATCH 29/55] NTP Lab: Simplify NTP Lab with larger controls and clearer timing results --- main/ntp_tool.c | 62 +++++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/main/ntp_tool.c b/main/ntp_tool.c index f10e7b1..00fb8f9 100644 --- a/main/ntp_tool.c +++ b/main/ntp_tool.c @@ -317,7 +317,7 @@ static void refresh(lv_timer_t *timer) result->leap, result->reference_id[0], result->reference_id[1], result->reference_id[2], result->reference_id[3]); } else { lv_label_set_text(summary_label, "No valid timing samples"); - snprintf(text, sizeof(text), "%u valid | %u failed/missing | %u not sampled\nNo server quality metadata from a valid sample.", + snprintf(text, sizeof(text), "%u valid | %u failed/missing | %u not sampled", valid, attempted - valid, NTP_SAMPLE_COUNT - attempted); } lv_label_set_text(metadata_label, text); @@ -416,7 +416,7 @@ static void keyboard_done(lv_event_t *event) static lv_obj_t *label(lv_obj_t *parent, const char *text, bool small) { lv_obj_t *object = lv_label_create(parent); - lv_obj_set_width(object, 640); + lv_obj_set_width(object, lv_pct(100)); if (small) lv_obj_set_style_text_font(object, &lv_font_montserrat_14, 0); lv_label_set_long_mode(object, LV_LABEL_LONG_WRAP); lv_label_set_text(object, text); @@ -438,15 +438,15 @@ static lv_obj_t *input(lv_obj_t *parent, const char *caption, const char *value, { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, width, 80); + lv_obj_set_size(block, width, 96); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(block, 4, 0); + lv_obj_set_style_pad_row(block, 8, 0); lv_obj_t *name = label(block, caption, true); lv_obj_set_width(name, width); lv_obj_t *area = lv_textarea_create(block); /* Preserve pasted newlines; validation rejects them instead of joining lines. */ - lv_obj_set_size(area, width, 60); + lv_obj_set_size(area, width, 72); lv_textarea_set_max_length(area, maximum + 1); lv_textarea_set_text(area, value); lv_obj_add_event_cb(area, field_event, LV_EVENT_ALL, NULL); @@ -456,7 +456,7 @@ static lv_obj_t *input(lv_obj_t *parent, const char *caption, const char *value, static lv_obj_t *button(lv_obj_t *parent, const char *text, lv_event_cb_t callback) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, 310, 60); + lv_obj_set_size(object, 310, 72); lv_obj_t *caption = lv_label_create(object); lv_label_set_text(caption, text); lv_obj_center(caption); @@ -492,38 +492,40 @@ void ntp_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 12, 0); + lv_obj_set_style_pad_row(column, 20, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); label(column, "NTP Lab", false); - label(column, "Compare a server's time with this tablet using four UDP exchanges.\n" - "Plain 48-byte NTPv3/v4 replies only; this app never sets the clock.", true); - lv_obj_t *destination = row(column, 80); - host_area = input(destination, "Server IPv4 address", saved_host, 430, 15); - lv_textarea_set_placeholder_text(host_area, "e.g. 192.168.1.10"); - port_area = input(destination, "UDP port (1-65535)", saved_port, 198, 5); + lv_obj_t *destination = row(column, 96); + host_area = input(destination, "Server IPv4", saved_host, 430, 15); + lv_textarea_set_placeholder_text(host_area, "192.168.1.10"); + port_area = input(destination, "UDP port", saved_port, 198, 5); keyboard = lv_keyboard_create(column); lv_obj_set_size(keyboard, 640, 220); lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_NUMBER); lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); - lv_obj_t *actions = row(column, 60); - start_button = button(actions, "SAMPLE 4", start_clicked); - stop_button = button(actions, "STOP", stop_clicked); - status_label = label(column, connected ? "Ready. Choose a server and tap SAMPLE 4." : "Connect to Wi-Fi before sampling.", true); - lv_obj_set_height(status_label, 44); - identity_label = label(column, "No samples sent.", true); - lv_obj_set_height(identity_label, 40); - summary_label = label(column, "Minimum delay and clock offset\nwill appear here.", false); - lv_obj_set_height(summary_label, 80); - metadata_label = label(column, "Server stratum, leap indicator and reference ID appear after a valid reply.", true); - lv_obj_set_height(metadata_label, 44); - samples_label = label(column, "#1 Not sampled\n\n#2 Not sampled\n\n#3 Not sampled\n\n#4 Not sampled", true); - lv_obj_set_height(samples_label, 168); - label(column, "Positive offset means the server is ahead of the tablet. Delay removes\n" - "server processing time; RTT is measured with a monotonic clock.\n" - "Unauthenticated estimates, not a calibration. Local clock must be 2020-2099.\n" - "Clock steps over 5ms reject samples; small negative delay is clamped to 1us.", true); + lv_obj_t *actions = row(column, 72); + start_button = button(actions, "Sample 4", start_clicked); + stop_button = button(actions, "Stop", stop_clicked); + status_label = label(column, connected ? "Ready" : "Connect to Wi-Fi before sampling.", false); + lv_obj_set_style_text_color(status_label, lv_color_hex(0x9BCBEE), 0); + + lv_obj_t *results = lv_obj_create(column); + lv_obj_set_size(results, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(results, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(results, LV_FLEX_FLOW_COLUMN); + lv_obj_set_style_bg_color(results, lv_color_hex(0x202938), 0); + lv_obj_set_style_bg_opa(results, LV_OPA_COVER, 0); + lv_obj_set_style_border_width(results, 0, 0); + lv_obj_set_style_radius(results, 16, 0); + lv_obj_set_style_pad_all(results, 20, 0); + lv_obj_set_style_pad_row(results, 16, 0); + identity_label = label(results, "No samples yet", true); + summary_label = label(results, "Min delay -- ms\nOffset -- ms", false); + metadata_label = label(results, "", true); + label(column, "Samples", false); + samples_label = label(column, "#1 --\n\n#2 --\n\n#3 --\n\n#4 --", false); rendered_revision = UINT32_MAX; refresh(NULL); ui_timer = lv_timer_create(refresh, 100, NULL); From e5e03d7b223555fe918a130423cf438d94f8d4bc Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:06 -0500 Subject: [PATCH 30/55] Wake-on-LAN: Improve Wake-on-LAN layout, readability, and touch controls --- main/wol_tool.c | 52 ++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/main/wol_tool.c b/main/wol_tool.c index 51a2f4a..ae9edcc 100644 --- a/main/wol_tool.c +++ b/main/wol_tool.c @@ -215,6 +215,7 @@ static void refresh(lv_timer_t *timer) "UDP destination %s:%u | %s | %lu ms", job.mac[0], job.mac[1], job.mac[2], job.mac[3], job.mac[4], job.mac[5], job.destination, job.port, busy ? "Sending" : "Socket closed", (unsigned long)job.duration_ms); + lv_obj_remove_flag(identity_label, LV_OBJ_FLAG_HIDDEN); lv_label_set_text(identity_label, identity); lv_label_set_text(result_label, job.status); lv_label_set_text(status_label, busy ? "CANCEL or Home stops an unsent packet." : @@ -349,12 +350,14 @@ static void input(lv_obj_t *parent, const char *caption, unsigned index, int wid { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, width, 82); + lv_obj_set_size(block, width, 112); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(block, 4, 0); - lv_obj_set_width(label(block, caption, true), width); + lv_obj_set_style_pad_row(block, 10, 0); + lv_obj_set_width(label(block, caption, false), width); fields[index] = lv_textarea_create(block); - lv_obj_set_size(fields[index], width, 60); + lv_obj_set_size(fields[index], width, 72); + lv_obj_set_style_radius(fields[index], 12, 0); + lv_obj_set_style_pad_all(fields[index], 16, 0); /* Keep pasted newlines so the parser can reject the original draft. */ lv_textarea_set_max_length(fields[index], 32); lv_textarea_set_text(fields[index], saved_inputs[index]); @@ -364,7 +367,8 @@ static void input(lv_obj_t *parent, const char *caption, unsigned index, int wid static lv_obj_t *button(lv_obj_t *parent, const char *caption, lv_event_cb_t callback) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, 310, 64); + lv_obj_set_size(object, 310, 76); + lv_obj_set_style_radius(object, 12, 0); lv_obj_t *text = lv_label_create(object); lv_label_set_text(text, caption); lv_obj_center(text); @@ -399,15 +403,13 @@ void wol_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 12, 0); + lv_obj_set_style_pad_row(column, 24, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); label(column, "Wake-on-LAN", false); - label(column, "Send one magic packet to a device you manage. The target needs Wake-on-LAN enabled.\n" - "Choose its subnet broadcast or an explicit IPv4 destination; no scanning or retries.", true); - input(column, "Target MAC (colon, hyphen or 12 hex digits)", 0, 640); - lv_obj_t *destination = row(column, 82); + input(column, "Target MAC", 0, 640); + lv_obj_t *destination = row(column, 112); input(destination, "Destination IPv4", 1, 430); - input(destination, "UDP port (1-65535)", 2, 198); + input(destination, "UDP port", 2, 198); keyboard = lv_keyboard_create(column); lv_obj_set_size(keyboard, 640, 240); lv_keyboard_set_map(keyboard, LV_KEYBOARD_MODE_USER_2, mac_keys, mac_controls); @@ -415,18 +417,28 @@ void wol_tool_show(lv_obj_t *parent, bool connected) lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); - lv_obj_t *actions = row(column, 64); + lv_obj_t *actions = row(column, 76); send_button = button(actions, "SEND", send_clicked); send_label = lv_obj_get_child(send_button, 0); cancel_button = button(actions, "CANCEL", cancel_clicked); - status_label = label(column, connected ? "Enter the target. SEND reviews it; a second tap confirms within 5 seconds." : - "Connect to Wi-Fi before sending. You can enter the target now.", true); - lv_obj_set_height(status_label, 56); - identity_label = label(column, "No packet has been sent.", true); - lv_obj_set_height(identity_label, 50); - result_label = label(column, "A successful UDP send cannot confirm that the device woke up.", false); - label(column, "Inputs and the last result stay in RAM until restart.\n" - "No SecureOn password. CANCEL/Home can stop an unsent packet only.", true); + status_label = label(column, connected ? "Ready to send" : "Connect to Wi-Fi before sending.", false); + lv_obj_set_style_min_height(status_label, 100, 0); + lv_obj_t *result = lv_obj_create(column); + lv_obj_set_size(result, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(result, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(result, LV_FLEX_FLOW_COLUMN); + lv_obj_set_style_bg_color(result, lv_color_hex(0x1F2937), 0); + lv_obj_set_style_bg_opa(result, LV_OPA_COVER, 0); + lv_obj_set_style_border_width(result, 0, 0); + lv_obj_set_style_radius(result, 16, 0); + lv_obj_set_style_pad_all(result, 24, 0); + lv_obj_set_style_pad_row(result, 16, 0); + lv_obj_set_width(label(result, "Last packet", false), LV_PCT(100)); + identity_label = label(result, "", false); + lv_obj_set_width(identity_label, LV_PCT(100)); + lv_obj_add_flag(identity_label, LV_OBJ_FLAG_HIDDEN); + result_label = label(result, "No packet sent", false); + lv_obj_set_width(result_label, LV_PCT(100)); rendered_revision = UINT32_MAX; ui_timer = lv_timer_create(refresh, 100, NULL); refresh(NULL); From e8f4ef0421984a4c3a3b39c508f3113836e76981 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:10 -0500 Subject: [PATCH 31/55] =?UTF-8?q?Subnet=20Lab:=20Improve=20Subnet=20Lab?= =?UTF-8?q?=E2=80=99s=20touch=20layout=20and=20result=20readability?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/subnet_tool.c | 66 +++++++++++++++++++++++++++-------------- tests/offline_ui_test.c | 2 +- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/main/subnet_tool.c b/main/subnet_tool.c index 407d6b9..ea5e5a6 100644 --- a/main/subnet_tool.c +++ b/main/subnet_tool.c @@ -32,13 +32,20 @@ _Static_assert(sizeof(key_map) / sizeof(key_map[0]) == sizeof(key_controls) / sizeof(key_controls[0]) + 3, "Subnet keyboard map and controls must match"); +static void set_result_text(lv_obj_t *object, const char *text) +{ + lv_label_set_text(object, text); + if (*text) lv_obj_remove_flag(object, LV_OBJ_FLAG_HIDDEN); + else lv_obj_add_flag(object, LV_OBJ_FLAG_HIDDEN); +} + static void calculate(void) { if (!result_label) return; subnet_data_t data; subnet_status_t status = subnet_calculate(inputs[0], inputs[1], inputs[2], &data); - lv_label_set_text(peer_label, ""); - lv_label_set_text(note_label, ""); + set_result_text(peer_label, ""); + set_result_text(note_label, ""); if (status != SUBNET_OK) { lv_label_set_text(result_label, subnet_error(status)); return; @@ -68,9 +75,9 @@ static void calculate(void) data.peer_role == SUBNET_BROADCAST_ADDRESS ? "inside; broadcast address" : "inside; host slot"; snprintf(text, sizeof(text), "Peer %s:\n%s", inputs[2], membership); - lv_label_set_text(peer_label, text); + set_result_text(peer_label, text); } else { - lv_label_set_text(peer_label, "Enter a peer to check subnet membership."); + set_result_text(peer_label, ""); } const char *note = data.prefix == 31 ? "/31: two endpoints on a point-to-point link; no directed broadcast." : @@ -78,7 +85,7 @@ static void calculate(void) data.address_role == SUBNET_NETWORK_ADDRESS ? "The input is the network address, not a host slot." : data.address_role == SUBNET_BROADCAST_ADDRESS ? "The input is the broadcast address, not a host slot." : "The input falls in a host slot for this mask."; - lv_label_set_text(note_label, note); + set_result_text(note_label, note); } static void set_keyboard_visible(bool visible) @@ -122,8 +129,8 @@ static void field_event(lv_event_t *event) unsigned index = (unsigned)(uintptr_t)lv_event_get_user_data(event); snprintf(inputs[index], sizeof(inputs[index]), "%s", lv_textarea_get_text(field)); lv_label_set_text(result_label, "Inputs changed. Tap Calculate."); - lv_label_set_text(peer_label, ""); - lv_label_set_text(note_label, ""); + set_result_text(peer_label, ""); + set_result_text(note_label, ""); } } @@ -145,7 +152,7 @@ static lv_obj_t *row(lv_obj_t *parent) { lv_obj_t *object = lv_obj_create(parent); lv_obj_remove_style_all(object); - lv_obj_set_size(object, 640, 64); + lv_obj_set_size(object, 640, 76); lv_obj_remove_flag(object, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(object, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(object, LV_FLEX_ALIGN_SPACE_BETWEEN, @@ -153,12 +160,11 @@ static lv_obj_t *row(lv_obj_t *parent) return object; } -static lv_obj_t *label(lv_obj_t *parent, const char *text, bool small) +static lv_obj_t *label(lv_obj_t *parent, const char *text) { lv_obj_t *object = lv_label_create(parent); lv_obj_set_width(object, 640); lv_label_set_long_mode(object, LV_LABEL_LONG_WRAP); - if (small) lv_obj_set_style_text_font(object, &lv_font_montserrat_14, 0); lv_label_set_text(object, text); return object; } @@ -166,7 +172,8 @@ static lv_obj_t *label(lv_obj_t *parent, const char *text, bool small) static lv_obj_t *button(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, width, 60); + lv_obj_set_size(object, width, 72); + lv_obj_set_style_radius(object, 14, 0); lv_obj_t *caption = lv_label_create(object); lv_label_set_text(caption, text); lv_obj_center(caption); @@ -195,19 +202,19 @@ void subnet_tool_show(lv_obj_t *parent) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 12, 0); + lv_obj_set_style_pad_row(column, 16, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); - label(column, "Subnet Lab", false); - label(column, "IPv4 subnet calculator. Use a prefix (24 or /24) or netmask\n" - "(255.255.255.0). Peer comparison is optional.", true); + label(column, "Subnet Lab"); static const char *const names[] = {"IPv4 address", "Prefix / netmask", "Peer (optional)"}; for (unsigned i = 0; i < 3; i++) { lv_obj_t *field_row = row(column); lv_obj_t *caption = lv_label_create(field_row); - lv_obj_set_width(caption, 270); + lv_obj_set_width(caption, 228); lv_label_set_text(caption, names[i]); fields[i] = lv_textarea_create(field_row); - lv_obj_set_size(fields[i], 354, 64); + lv_obj_set_size(fields[i], 400, 76); + lv_obj_set_style_radius(fields[i], 12, 0); + lv_obj_set_style_pad_all(fields[i], 16, 0); /* Preserve pasted newlines; the address/mask parser rejects them. */ lv_textarea_set_max_length(fields[i], SUBNET_INPUT_MAX); lv_textarea_set_text(fields[i], inputs[i]); @@ -226,11 +233,24 @@ void subnet_tool_show(lv_obj_t *parent) lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); set_keyboard_visible(false); - result_label = label(column, "", false); - peer_label = label(column, "", false); - note_label = label(column, "", true); - label(column, "Offline math only. Inputs stay in RAM until restart. Host slots do not\n" - "exclude special-use addresses or confirm availability. Membership uses\n" - "this mask only; routing, VLANs and the peer's settings still matter.", true); + lv_obj_t *results = lv_obj_create(column); + lv_obj_set_size(results, 640, LV_SIZE_CONTENT); + lv_obj_remove_flag(results, LV_OBJ_FLAG_SCROLLABLE); + lv_obj_set_flex_flow(results, LV_FLEX_FLOW_COLUMN); + lv_obj_set_style_bg_color(results, lv_color_hex(0x1f2937), 0); + lv_obj_set_style_bg_opa(results, LV_OPA_COVER, 0); + lv_obj_set_style_text_color(results, lv_color_hex(0xffffff), 0); + lv_obj_set_style_border_width(results, 0, 0); + lv_obj_set_style_radius(results, 16, 0); + lv_obj_set_style_pad_all(results, 20, 0); + lv_obj_set_style_pad_row(results, 16, 0); + result_label = label(results, ""); + lv_obj_set_width(result_label, 600); + lv_obj_set_style_text_line_space(result_label, 10, 0); + peer_label = label(results, ""); + lv_obj_set_width(peer_label, 600); + lv_obj_set_style_text_color(peer_label, lv_color_hex(0x64b5f6), 0); + note_label = label(results, ""); + lv_obj_set_width(note_label, 600); calculate(); } diff --git a/tests/offline_ui_test.c b/tests/offline_ui_test.c index a02d0f5..8a4398b 100644 --- a/tests/offline_ui_test.c +++ b/tests/offline_ui_test.c @@ -1114,7 +1114,7 @@ int main(int argc, char **argv) assert(has_text(content, "inside; broadcast address")); set_input(2, ""); assert(click("Calculate")); - assert(has_text(content, "Enter a peer to check")); + assert(!has_text(content, "inside; broadcast address")); set_input(1, "255.0.255.0"); assert(click("Calculate")); assert(has_text(content, "Netmask bits must be contiguous")); From 83b77332f2e848640c3a823600ff35049c356ab8 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:14 -0500 Subject: [PATCH 32/55] UDP Console: Improve UDP Console readability and touch layout --- main/udp_tool.c | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/main/udp_tool.c b/main/udp_tool.c index c29f9ef..4830366 100644 --- a/main/udp_tool.c +++ b/main/udp_tool.c @@ -541,11 +541,11 @@ static void field(lv_obj_t *parent, const char *caption, unsigned index, int wid { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, width, 82); + lv_obj_set_size(block, width, 100); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(block, 4, 0); - lv_obj_set_width(label(block, caption, true), width); + lv_obj_set_style_pad_row(block, 6, 0); + lv_obj_set_width(label(block, caption, false), width); fields[index] = lv_textarea_create(block); lv_obj_set_size(fields[index], width, 60); /* Keep pasted newlines so the parser can reject the original draft. */ @@ -558,6 +558,11 @@ static lv_obj_t *button(lv_obj_t *parent, const char *text, lv_event_cb_t callba { lv_obj_t *object = lv_button_create(parent); lv_obj_set_size(object, 310, 64); + lv_obj_set_style_radius(object, 12, 0); + if (callback != send_clicked) { + lv_obj_set_style_bg_color(object, lv_color_hex(0x263345), 0); + lv_obj_set_style_text_color(object, lv_color_white(), 0); + } lv_obj_t *caption = lv_label_create(object); lv_label_set_text(caption, text); lv_obj_center(caption); @@ -602,20 +607,18 @@ void udp_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_style_pad_row(column, 12, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); label(column, "UDP Console", false); - label(column, "One unencrypted datagram, then one reply from the same IPv4/port.\n" - "0-128 TX bytes; 512-byte RX preview; 3-second deadline; no retries.", true); - lv_obj_t *target = row(column, 82); - field(target, "Peer IPv4 (unicast)", 0, 430); + lv_obj_t *target = row(column, 100); + field(target, "Peer IPv4", 0, 430); field(target, "Peer port", 1, 198); - lv_obj_t *options = row(column, 82); - field(options, "Source port (0 = automatic)", 2, 310); + lv_obj_t *options = row(column, 100); + field(options, "Source (0 = auto)", 2, 310); lv_obj_t *mode_block = lv_obj_create(options); lv_obj_remove_style_all(mode_block); - lv_obj_set_size(mode_block, 310, 82); + lv_obj_set_size(mode_block, 310, 100); lv_obj_remove_flag(mode_block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(mode_block, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(mode_block, 4, 0); - lv_obj_set_width(label(mode_block, "Payload format", true), 310); + lv_obj_set_style_pad_row(mode_block, 6, 0); + lv_obj_set_width(label(mode_block, "Payload", false), 310); mode_select = lv_dropdown_create(mode_block); lv_obj_set_size(mode_select, 310, 60); lv_dropdown_set_options(mode_select, "Hex byte pairs\nLiteral ASCII"); @@ -639,24 +642,22 @@ void udp_tool_show(lv_obj_t *parent, bool connected) send_button = button(actions, "SEND", send_clicked); send_label = lv_obj_get_child(send_button, 0); cancel_button = button(actions, "CANCEL", cancel_clicked); - status_label = label(column, connected ? "Enter a peer. SEND reviews the request; a second tap confirms it." : - "Connect to Wi-Fi before sending. You can prepare the request now.", true); - lv_obj_set_height(status_label, 56); - identity_label = label(column, "No UDP exchange yet.", true); - lv_obj_set_height(identity_label, 42); - result_label = label(column, "Replies are unauthenticated. Empty input sends an empty datagram.", true); - lv_obj_set_height(result_label, 48); + status_label = label(column, connected ? "Ready" : "Wi-Fi disconnected", false); + lv_obj_set_style_min_height(status_label, 70, 0); + identity_label = label(column, "Last exchange", true); + result_label = label(column, "No exchange yet", false); preview_panel = lv_obj_create(column); - lv_obj_set_size(preview_panel, 640, 220); + lv_obj_set_size(preview_panel, 640, 240); + lv_obj_set_style_bg_color(preview_panel, lv_color_hex(0x1F2937), 0); + lv_obj_set_style_border_color(preview_panel, lv_color_hex(0x374151), 0); + lv_obj_set_style_text_color(preview_panel, lv_color_white(), 0); + lv_obj_set_style_radius(preview_panel, 12, 0); lv_obj_set_flex_flow(preview_panel, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(preview_panel, 12, 0); - tx_label = label(preview_panel, "Sent bytes and received bytes appear here in hex and ASCII.", true); - rx_label = label(preview_panel, "", true); + tx_label = label(preview_panel, "TX —\n\nRX —", false); + rx_label = label(preview_panel, "", false); lv_obj_set_width(tx_label, LV_PCT(100)); lv_obj_set_width(rx_label, LV_PCT(100)); - label(column, "Paste replaces the Hex draft; copy accepts complete replies up to 128 bytes.\n" - "Inputs, clipboard and last exchange stay in RAM until restart.\n" - "CANCEL/Home closes the exchange; transmitted data cannot be recalled.", true); rendered_revision = UINT32_MAX; ui_timer = lv_timer_create(refresh, 100, NULL); refresh(NULL); From f91330d8785a49c7adf56a382746d33aade72ae7 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:18 -0500 Subject: [PATCH 33/55] Resistor Lab: Improve Resistor Lab readability with larger controls and a clear result card --- main/resistor_tool.c | 59 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/main/resistor_tool.c b/main/resistor_tool.c index f9eaa47..2b6169a 100644 --- a/main/resistor_tool.c +++ b/main/resistor_tool.c @@ -26,7 +26,6 @@ static lv_obj_t *keyboard; static lv_obj_t *result_label; static lv_obj_t *range_label; static lv_obj_t *detail_label; -static lv_obj_t *note_label; static const resistor_color_t tolerances[] = { RESISTOR_BROWN, RESISTOR_RED, RESISTOR_GREEN, RESISTOR_BLUE, @@ -95,11 +94,12 @@ static void calculate(void) "Zero-ohm jumper marking.\nActual resistance and current rating depend on the part." : "Tolerance: not established by this marking.\nCheck the part's datasheet for limits."); lv_label_set_text(range_label, text); - const char *kind = data.kind == RESISTOR_BANDS ? (mode == 0 ? "Two significant digits" : "Three significant digits") : - data.kind == RESISTOR_NUMERIC ? "Numeric code: last digit is the exponent" : - data.kind == RESISTOR_R_DECIMAL ? "R marks the decimal point in ohms" : - data.kind == RESISTOR_EIA96 ? "EIA-96: indexed significant value + multiplier" : "Zero marking"; - snprintf(text, sizeof(text), "%s\n%u x 10^(%d) = %.12g ohm", kind, + const char *kind = data.kind == RESISTOR_BANDS ? "" : + data.kind == RESISTOR_NUMERIC ? "Numeric code\n" : + data.kind == RESISTOR_R_DECIMAL ? "R decimal\n" : + data.kind == RESISTOR_EIA96 ? "EIA-96: indexed significant value\n" : "Zero marking\n"; + snprintf(text, sizeof(text), "%s%u x 10^(%d) = %.12g ohm", + kind, data.significand, data.exponent10, data.ohms); lv_label_set_text(detail_label, text); } @@ -115,7 +115,7 @@ static void update_bands(void) visible(stripe_numbers[i], i < count); if (i >= count) continue; char caption[48]; - snprintf(caption, sizeof(caption), "Band %u / %s", i + 1, + snprintf(caption, sizeof(caption), "%u / %s", i + 1, i < count - 2 ? "digit" : i == count - 2 ? "multiplier" : "tolerance"); lv_label_set_text(band_captions[i], caption); unsigned selection = (unsigned)choices[mode][i]; @@ -156,11 +156,6 @@ static void update_mode(void) visible(keyboard, false); lv_keyboard_set_textarea(keyboard, NULL); if (mode < 2) update_bands(); - lv_label_set_text(note_label, mode < 2 ? - "Read from the first digit toward the separated tolerance band.\n" - "Four/five-band convention only; extra bands and unusual markings need a datasheet." : - "Examples: 103 = 10 kohm, 4R7 = 4.7 ohm, 10C = 12.4 kohm.\n" - "EIA-96 letters: A-H, X, Y, Z. Manufacturer-specific codes may differ."); calculate(); } @@ -252,7 +247,7 @@ void resistor_tool_stop(void) if (keyboard) lv_keyboard_set_textarea(keyboard, NULL); keyboard = NULL; mode_select = band_panel = smd_panel = code_field = NULL; - result_label = range_label = detail_label = note_label = NULL; + result_label = range_label = detail_label = NULL; for (unsigned i = 0; i < 5; i++) { band_blocks[i] = band_captions[i] = band_select[i] = NULL; stripes[i] = stripe_numbers[i] = NULL; @@ -267,10 +262,9 @@ void resistor_tool_show(lv_obj_t *parent) lv_obj_set_style_pad_row(column, 16, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); label(column, "Resistor Lab", false); - label(column, "Decode color bands or a printed SMD marking.\nOffline reference; selections update the result immediately.", true); mode_select = lv_dropdown_create(column); readable_options(mode_select); - lv_obj_set_size(mode_select, 640, 62); + lv_obj_set_size(mode_select, 640, 72); lv_dropdown_set_options(mode_select, "4 color bands\n5 color bands\nSMD marking"); lv_dropdown_set_selected(mode_select, mode); lv_obj_add_event_cb(mode_select, mode_changed, LV_EVENT_VALUE_CHANGED, NULL); @@ -291,31 +285,32 @@ void resistor_tool_show(lv_obj_t *parent) lv_label_set_text(stripe_numbers[i], text); } for (unsigned i = 0; i < 3; i++) { - band_rows[i] = plain(band_panel, 640, 88); + band_rows[i] = plain(band_panel, 640, 116); lv_obj_set_flex_flow(band_rows[i], LV_FLEX_FLOW_ROW); lv_obj_set_style_pad_column(band_rows[i], 20, 0); } for (unsigned i = 0; i < 5; i++) { - band_blocks[i] = plain(band_rows[i / 2], 310, 88); + band_blocks[i] = plain(band_rows[i / 2], 310, 116); lv_obj_set_flex_flow(band_blocks[i], LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(band_blocks[i], 6, 0); - band_captions[i] = label(band_blocks[i], "", true); + band_captions[i] = label(band_blocks[i], "", false); lv_obj_set_width(band_captions[i], 310); band_select[i] = lv_dropdown_create(band_blocks[i]); readable_options(band_select[i]); - lv_obj_set_size(band_select[i], 310, 62); + lv_obj_set_size(band_select[i], 310, 72); lv_obj_add_event_cb(band_select[i], band_changed, LV_EVENT_VALUE_CHANGED, (void *)(uintptr_t)i); } smd_panel = plain(column, 640, LV_SIZE_CONTENT); lv_obj_set_flex_flow(smd_panel, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(smd_panel, 12, 0); - label(smd_panel, "Printed code (up to four characters)", true); + label(smd_panel, "Printed code", false); code_field = lv_textarea_create(smd_panel); - lv_obj_set_size(code_field, 640, 62); + lv_obj_set_size(code_field, 640, 72); /* Preserve pasted newlines; they are invalid marking characters. */ /* Preserve an extra character and rejected Unicode so truncation cannot * silently turn an invalid longer code into a valid shorter code. */ lv_textarea_set_max_length(code_field, RESISTOR_CODE_MAX + 1); + lv_textarea_set_placeholder_text(code_field, "SMD marking"); lv_textarea_set_text(code_field, saved_code); lv_obj_add_event_cb(code_field, code_event, LV_EVENT_ALL, NULL); keyboard = lv_keyboard_create(smd_panel); @@ -325,16 +320,24 @@ void resistor_tool_show(lv_obj_t *parent) lv_keyboard_set_mode(keyboard, LV_KEYBOARD_MODE_USER_1); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_READY, NULL); lv_obj_add_event_cb(keyboard, keyboard_done, LV_EVENT_CANCEL, NULL); - result_label = label(column, "", false); - range_label = label(column, "", false); - detail_label = label(column, "", true); - note_label = label(column, "", true); + lv_obj_t *result = plain(column, 640, LV_SIZE_CONTENT); + lv_obj_set_flex_flow(result, LV_FLEX_FLOW_COLUMN); + lv_obj_set_style_pad_all(result, 24, 0); + lv_obj_set_style_pad_row(result, 16, 0); + lv_obj_set_style_bg_color(result, lv_color_hex(0x202938), 0); + lv_obj_set_style_bg_opa(result, LV_OPA_COVER, 0); + lv_obj_set_style_radius(result, 20, 0); + result_label = label(result, "", false); + lv_obj_set_width(result_label, 592); + lv_obj_set_style_text_font(result_label, &lv_font_montserrat_48, 0); + range_label = label(result, "", false); + lv_obj_set_width(range_label, 592); + detail_label = label(result, "", false); + lv_obj_set_width(detail_label, 592); lv_obj_t *example = lv_button_create(column); - lv_obj_set_size(example, 640, 62); + lv_obj_set_size(example, 640, 72); lv_obj_t *caption = lv_label_create(example); lv_label_set_text(caption, "Example"); lv_obj_center(caption); lv_obj_add_event_cb(example, example_clicked, LV_EVENT_CLICKED, NULL); - label(column, "Markings do not establish power/voltage ratings or prove a part is healthy.\n" - "Confirm ambiguous parts with a meter and datasheet. Inputs stay in RAM until restart.", true); update_mode(); } From 2b18862f8a5ce339325c08ed4eb394285d697fc2 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 14:02:22 -0500 Subject: [PATCH 34/55] RTU Frames: Improve RTU Frames readability and touch layout --- main/modbus_rtu_tool.c | 76 ++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/main/modbus_rtu_tool.c b/main/modbus_rtu_tool.c index 69b5c78..a125118 100644 --- a/main/modbus_rtu_tool.c +++ b/main/modbus_rtu_tool.c @@ -55,9 +55,9 @@ static void inputs_changed(void) * per-character result formatting or button-state animations. */ if (dirty || !status_label) return; dirty = true; - lv_label_set_text(frame_label, "Inputs changed. COPY REQUEST builds an 8-byte read frame."); - lv_label_set_text(status_label, "Inputs changed. DECODE checks the reply against the current request fields."); - lv_label_set_text(result_label, "No decoded reply for these inputs."); + lv_label_set_text(frame_label, "Request changed"); + lv_label_set_text(status_label, "Request changed. Decode again."); + lv_label_set_text(result_label, "No decoded values"); } static bool build_request(modbus_request_t *request, uint8_t bytes[MODBUS_RTU_REQUEST_BYTES]) @@ -76,10 +76,7 @@ static bool build_request(modbus_request_t *request, uint8_t bytes[MODBUS_RTU_RE return false; } char text[144]; - snprintf(text, sizeof(text), "Request: unit %u | FC %02u | address %u | count %u\n" - "%02X %02X %02X %02X %02X %02X %02X %02X (last 2 bytes: CRC)", - (unsigned)request->unit_id, (unsigned)request->function, - (unsigned)request->address, (unsigned)request->quantity, + snprintf(text, sizeof(text), "%02X %02X %02X %02X %02X %02X %02X %02X", (unsigned)bytes[0], (unsigned)bytes[1], (unsigned)bytes[2], (unsigned)bytes[3], (unsigned)bytes[4], (unsigned)bytes[5], (unsigned)bytes[6], (unsigned)bytes[7]); lv_label_set_text(frame_label, text); @@ -101,7 +98,7 @@ static void decode_clicked(lv_event_t *event) { (void)event; decoded = false; - lv_label_set_text(result_label, "No decoded reply for these inputs."); + lv_label_set_text(result_label, "No decoded values"); uint8_t request_bytes[MODBUS_RTU_REQUEST_BYTES]; modbus_request_t request; if (!build_request(&request, request_bytes)) return; @@ -239,7 +236,7 @@ static lv_obj_t *label(lv_obj_t *parent, const char *text) { lv_obj_t *object = lv_label_create(parent); lv_obj_set_width(object, 640); - lv_obj_set_style_text_font(object, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(object, &lv_font_montserrat_28, 0); lv_label_set_long_mode(object, LV_LABEL_LONG_WRAP); lv_label_set_text(object, text); return object; @@ -260,7 +257,7 @@ static lv_obj_t *field_block(lv_obj_t *parent, const char *name, int width) { lv_obj_t *object = lv_obj_create(parent); lv_obj_remove_style_all(object); - lv_obj_set_size(object, width, 80); + lv_obj_set_size(object, width, 98); lv_obj_remove_flag(object, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(object, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(object, 4, 0); @@ -272,7 +269,7 @@ static void input(lv_obj_t *parent, const char *name, unsigned index, int width) { lv_obj_t *block = field_block(parent, name, width); fields[index] = lv_textarea_create(block); - lv_obj_set_size(fields[index], width, 60); + lv_obj_set_size(fields[index], width, 64); lv_textarea_set_max_length(fields[index], 6); lv_textarea_set_text(fields[index], saved_fields[index]); lv_obj_add_event_cb(fields[index], input_event, LV_EVENT_ALL, (void *)(uintptr_t)index); @@ -282,7 +279,7 @@ static lv_obj_t *select_options(lv_obj_t *parent, const char *name, int width, const char *options, unsigned selected, lv_event_cb_t callback) { lv_obj_t *object = lv_dropdown_create(field_block(parent, name, width)); - lv_obj_set_size(object, width, 60); + lv_obj_set_size(object, width, 64); lv_dropdown_set_options(object, options); lv_dropdown_set_selected(object, selected); lv_obj_t *list = lv_dropdown_get_list(object); @@ -297,7 +294,11 @@ static lv_obj_t *select_options(lv_obj_t *parent, const char *name, int width, static void button(lv_obj_t *parent, const char *text, int width, lv_event_cb_t callback) { lv_obj_t *object = lv_button_create(parent); - lv_obj_set_size(object, width, 60); + lv_obj_set_size(object, width, 64); + if (callback == example_clicked || callback == clear_clicked || callback == paste_clicked) { + lv_obj_set_style_bg_color(object, lv_color_hex(0x283548), 0); + lv_obj_set_style_text_color(object, lv_color_white(), 0); + } lv_obj_t *caption = lv_label_create(object); lv_label_set_text(caption, text); lv_obj_center(caption); @@ -312,45 +313,48 @@ void modbus_rtu_tool_show(lv_obj_t *parent) lv_obj_set_size(column, 640, LV_SIZE_CONTENT); lv_obj_remove_flag(column, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(column, LV_FLEX_FLOW_COLUMN); - lv_obj_set_style_pad_row(column, 8, 0); + lv_obj_set_style_pad_row(column, 10, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); - lv_obj_set_style_text_font(label(column, "Modbus RTU Frames"), &lv_font_montserrat_28, 0); - label(column, "Build read frames and inspect captured replies offline.\nUse Serial to send bytes; this app does not open a port."); - lv_obj_t *operation = row(column, 80); - function_select = select_options(operation, "Read function", 430, + lv_obj_set_style_text_font(label(column, "RTU Frames"), &lv_font_montserrat_28, 0); + lv_obj_t *operation = row(column, 98); + function_select = select_options(operation, "Function", 430, "01 Coils\n02 Discrete inputs\n03 Holding registers\n04 Input registers", function_index, function_changed); - input(operation, "Unit (1-247)", UNIT, 198); - lv_obj_t *range = row(column, 80); - input(range, "Zero-based address (0-65535)", ADDRESS, 430); - input(range, "Count (1-16)", COUNT, 198); - frame_label = label(column, "COPY REQUEST builds the read frame with its CRC."); - lv_obj_set_height(frame_label, 40); - lv_obj_t *copy_actions = row(column, 60); + input(operation, "Unit 1-247", UNIT, 198); + lv_obj_t *range = row(column, 98); + input(range, "Address (zero-based)", ADDRESS, 430); + input(range, "Count 1-16", COUNT, 198); + frame_label = label(column, "Request"); + lv_obj_set_height(frame_label, 56); + lv_obj_set_style_bg_color(frame_label, lv_color_hex(0x202938), 0); + lv_obj_set_style_bg_opa(frame_label, LV_OPA_COVER, 0); + lv_obj_set_style_radius(frame_label, 12, 0); + lv_obj_set_style_pad_all(frame_label, 10, 0); + lv_obj_t *copy_actions = row(column, 64); button(copy_actions, "COPY REQUEST", 310, copy_clicked); button(copy_actions, "PASTE REPLY", 310, paste_clicked); - label(column, "Complete reply in Hex, including CRC (5-37 bytes)"); + label(column, "Reply (Hex + CRC)"); fields[REPLY] = lv_textarea_create(column); - lv_obj_set_size(fields[REPLY], 640, 84); + lv_obj_set_size(fields[REPLY], 640, 96); lv_textarea_set_max_length(fields[REPLY], BYTE_DATA_MAX_TEXT + 1); lv_textarea_set_text(fields[REPLY], saved_reply); lv_obj_add_event_cb(fields[REPLY], input_event, LV_EVENT_ALL, (void *)(uintptr_t)REPLY); - lv_obj_t *actions = row(column, 60); + lv_obj_t *actions = row(column, 64); button(actions, "DECODE", 206, decode_clicked); button(actions, "EXAMPLE", 206, example_clicked); button(actions, "CLEAR", 206, clear_clicked); - status_label = label(column, "Ready. Copy a request or enter a complete reply to decode."); - lv_obj_set_height(status_label, 40); - lv_obj_t *views = row(column, 80); - view_select = select_options(views, "Decoded values", 310, + status_label = label(column, ""); + lv_obj_set_height(status_label, 48); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_14, 0); + lv_obj_t *views = row(column, 98); + view_select = select_options(views, "Values", 310, "16-bit registers\nUnsigned 32-bit\nSigned 32-bit\nFloat32", value_view, view_changed); - order_select = select_options(views, "32-bit byte order", 310, + order_select = select_options(views, "32-bit order", 310, "ABCD\nCDAB\nBADC\nDCBA", byte_order, view_changed); - label(column, "A B = first register; C D = next. Pairs start at the requested address.\nA reply does not echo its address. Verify the request and device mapping."); result_box = lv_obj_create(column); - lv_obj_set_size(result_box, 640, 200); + lv_obj_set_size(result_box, 640, 180); lv_obj_set_style_pad_all(result_box, 16, 0); lv_obj_set_scroll_dir(result_box, LV_DIR_VER); - result_label = label(result_box, "No decoded reply for these inputs."); + result_label = label(result_box, "No decoded values"); lv_obj_set_width(result_label, 596); keyboard = lv_keyboard_create(column); lv_obj_set_size(keyboard, 640, 220); From 9fb9c6ade6e8716def3cf80f836ef5a2ef9bccd2 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 35/55] Counter: make the counter value readable on the dark card --- main/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/main.c b/main/main.c index 5e7b013..17029b4 100644 --- a/main/main.c +++ b/main/main.c @@ -4992,6 +4992,7 @@ static void counter_clicked(lv_event_t *event) counter_label = lv_label_create(value); lv_obj_set_width(counter_label, LV_PCT(100)); lv_obj_set_style_text_align(counter_label, LV_TEXT_ALIGN_CENTER, 0); + lv_obj_set_style_text_color(counter_label, lv_color_white(), 0); lv_obj_set_style_text_font(counter_label, &lv_font_montserrat_48, 0); update_counter(); lv_obj_center(counter_label); From 3b55b172fa76ac0c454f1b3caadd794aca09e270 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 36/55] AI Chat: hide the idle microphone level strip under the status --- main/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main/main.c b/main/main.c index ac85f75..f25d645 100644 --- a/main/main.c +++ b/main/main.c @@ -3520,6 +3520,8 @@ static void chat_tick(lv_timer_t *timer) { (void)timer; if (chat_wave && chat_wave_series) { + if (voice_recording) lv_obj_remove_flag(chat_wave, LV_OBJ_FLAG_HIDDEN); + else lv_obj_add_flag(chat_wave, LV_OBJ_FLAG_HIDDEN); lv_chart_set_next_value(chat_wave, chat_wave_series, voice_recording ? voice_level : 0); } if (chat_busy && chat_job == CHAT_JOB_VOICE && !voice_recording) { @@ -5255,6 +5257,7 @@ static void show_chat(void) lv_obj_set_style_text_color(chat_status, lv_color_hex(0xCDD5E2), 0); chat_wave = lv_chart_create(content); + if (!voice_recording) lv_obj_add_flag(chat_wave, LV_OBJ_FLAG_HIDDEN); lv_obj_set_size(chat_wave, 640, 48); lv_chart_set_type(chat_wave, LV_CHART_TYPE_LINE); lv_chart_set_point_count(chat_wave, 60); From 1754ad4f3d82d340f1885bb73c2086f8f958a333 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 37/55] Clock: make alarm times readable on the dark alarm cards --- main/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/main.c b/main/main.c index 56f9cd2..8c5acf6 100644 --- a/main/main.c +++ b/main/main.c @@ -5854,6 +5854,7 @@ static void show_clock(void) lv_obj_set_style_radius(card, 20, 0); lv_obj_set_style_pad_all(card, 20, 0); alarm_time_labels[i] = lv_label_create(card); + lv_obj_set_style_text_color(alarm_time_labels[i], lv_color_white(), 0); lv_obj_set_style_text_font(alarm_time_labels[i], &lv_font_montserrat_48, 0); lv_obj_align(alarm_time_labels[i], LV_ALIGN_TOP_LEFT, 0, 8); lv_obj_t *toggle = alarm_control(card, "OFF", 120, (i << 4) | 4, &alarm_enabled_labels[i]); From e042e3159c070d95607a85ebf1d487ec393bd120 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 38/55] System: replace unsupported middle dot in the charge chart title --- main/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index 252f652..1a3519f 100644 --- a/main/main.c +++ b/main/main.c @@ -5791,7 +5791,7 @@ static void system_clicked(lv_event_t *event) lv_label_set_text_fmt(battery_metrics, "%d.%03d V %+d mA %d%%", battery_millivolts / 1000, battery_millivolts % 1000, battery_milliamps, battery_percent); lv_obj_t *history_title = lv_label_create(battery); - lv_label_set_text(history_title, "Charge (%) · 5 min"); + lv_label_set_text(history_title, "Charge (%) | 5 min"); battery_chart = lv_chart_create(battery); lv_obj_set_size(battery_chart, LV_PCT(100), 220); lv_obj_set_style_bg_color(battery_chart, lv_color_hex(0x202838), 0); From ad4f6c709527c6953eb6ded610fbf0b812239a50 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 39/55] Weather: make the status next to Refresh readable --- main/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/main.c b/main/main.c index 0a90692..b5582b2 100644 --- a/main/main.c +++ b/main/main.c @@ -7830,6 +7830,8 @@ static void show_weather(void) lv_obj_set_style_pad_all(tools, 3, 0); weather_status = lv_label_create(tools); lv_obj_set_width(weather_status, 440); + lv_obj_set_style_text_color(weather_status, lv_color_hex(0xF5F7FA), 0); + lv_obj_set_style_text_font(weather_status, &lv_font_montserrat_28, 0); lv_label_set_text(weather_status, weather_busy ? "Updating forecast..." : weather_has_data ? "" : "No forecast"); lv_obj_t *refresh = button(tools, "Refresh", weather_refresh_clicked); lv_obj_set_size(refresh, 170, 64); From c2c1d5738e9157d8a0ffeff2420702dae5e8ad4b Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 40/55] Ring: replace unsupported middle dot and pad the heart-rate chart title --- main/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main/main.c b/main/main.c index 0545a36..b5d7444 100644 --- a/main/main.c +++ b/main/main.c @@ -7416,8 +7416,9 @@ static void show_ring(void) lv_obj_set_size(measure, 572, 82); lv_obj_align(measure, LV_ALIGN_BOTTOM_MID, 0, 0); lv_obj_t *chart_title = lv_label_create(content); - lv_label_set_text(chart_title, "Heart rate · 5 hours"); + lv_label_set_text(chart_title, "Heart rate - 5 hours"); lv_obj_set_width(chart_title, 620); + lv_obj_set_style_pad_left(chart_title, 24, 0); lv_obj_set_style_text_font(chart_title, &lv_font_montserrat_28, 0); ring_hr_chart = lv_chart_create(content); lv_obj_set_size(ring_hr_chart, 620, 240); From 664c1a095c14ef1837b3a4d874098656c6b98fa5 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 41/55] Cycling: use light text for the dashboard title, status, stats and history --- main/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main/main.c b/main/main.c index 1a2b5aa..b02e4d7 100644 --- a/main/main.c +++ b/main/main.c @@ -7208,6 +7208,7 @@ static void show_cycling(void) lv_obj_set_style_border_width(dashboard, 0, 0); lv_obj_set_style_pad_all(dashboard, 0, 0); lv_obj_set_style_pad_row(dashboard, 20, 0); + lv_obj_set_style_text_color(dashboard, lv_color_hex(0xE6EDF3), 0); lv_obj_clear_flag(dashboard, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(dashboard, LV_FLEX_FLOW_COLUMN); lv_obj_set_flex_align(dashboard, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -7215,6 +7216,7 @@ static void show_cycling(void) lv_label_set_text(title, "Cycling"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); ride_status = lv_label_create(dashboard); + lv_obj_set_style_text_color(ride_status, lv_color_hex(0xAAB4C3), 0); lv_obj_set_width(ride_status, 640); lv_obj_set_style_text_font(ride_status, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(ride_status, LV_TEXT_ALIGN_CENTER, 0); @@ -7243,6 +7245,7 @@ static void show_cycling(void) lv_obj_set_style_text_color(ride_hr_label, lv_color_hex(0xFF8095), 0); ride_stats = lv_label_create(dashboard); + lv_obj_set_style_text_color(ride_stats, lv_color_hex(0xAAB4C3), 0); lv_obj_set_width(ride_stats, 640); lv_obj_set_style_text_font(ride_stats, &lv_font_montserrat_28, 0); lv_obj_set_style_text_line_space(ride_stats, 14, 0); @@ -7270,6 +7273,7 @@ static void show_cycling(void) lv_obj_set_size(start, 640, 88); ride_button_label = lv_obj_get_child(start, 0); ride_history = lv_label_create(dashboard); + lv_obj_set_style_text_color(ride_history, lv_color_hex(0xAAB4C3), 0); lv_obj_set_width(ride_history, 640); lv_obj_set_style_text_font(ride_history, &lv_font_montserrat_28, 0); lv_obj_set_style_text_align(ride_history, LV_TEXT_ALIGN_CENTER, 0); From 8ca246eb49c771334f673995230081416d21d005 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 42/55] I2C Tool: use light text inside the dark panels --- main/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/main.c b/main/main.c index 170b4ec..e23f09d 100644 --- a/main/main.c +++ b/main/main.c @@ -6491,6 +6491,7 @@ static lv_obj_t *i2c_panel(void) lv_obj_t *panel = lv_obj_create(content); lv_obj_set_size(panel, 660, LV_SIZE_CONTENT); lv_obj_set_style_bg_color(panel, lv_color_hex(0x202938), 0); + lv_obj_set_style_text_color(panel, lv_color_hex(0xe6edf3), 0); lv_obj_set_style_border_width(panel, 0, 0); lv_obj_set_style_radius(panel, 16, 0); lv_obj_set_style_pad_all(panel, 20, 0); From 9d5c0c3cc66a76f633d68f5d0461c936f4cc6801 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 43/55] Serial: enlarge info, caption and status text with readable colors --- main/uart_tool.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/main/uart_tool.c b/main/uart_tool.c index 32ef720..331da9f 100644 --- a/main/uart_tool.c +++ b/main/uart_tool.c @@ -851,6 +851,7 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, lv_obj_set_style_bg_color(control, lv_color_hex(0x202938), 0); lv_obj_set_style_shadow_width(control, 0, 0); lv_obj_set_style_text_font(control, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(control, lv_color_hex(0xE6EDF3), 0); lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); @@ -876,12 +877,13 @@ static lv_obj_t *dropdown(lv_obj_t *parent, const char *caption, const char *opt { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, 310, 92); + lv_obj_set_size(block, 310, 106); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(block, 10, 0); lv_obj_t *label = lv_label_create(block); - lv_obj_set_style_text_font(label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(label, lv_color_hex(0xAAB4C3), 0); lv_label_set_text(label, caption); lv_obj_t *select = lv_dropdown_create(block); lv_obj_set_size(select, 310, 60); @@ -906,10 +908,12 @@ void uart_tool_show(lv_obj_t *parent, bool available, lv_obj_set_style_pad_row(parent, 12, 0); title_label = lv_label_create(parent); lv_obj_set_style_text_font(title_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(title_label, lv_color_hex(0xE6EDF3), 0); help_label = lv_label_create(parent); lv_obj_set_width(help_label, 640); - lv_obj_set_style_text_font(help_label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(help_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(help_label, lv_color_hex(0xAAB4C3), 0); lv_obj_set_style_text_align(help_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_t *settings = row(parent, 76); @@ -942,15 +946,17 @@ void uart_tool_show(lv_obj_t *parent, bool available, rx_copy_button = small_button(capture_row, "COPY RX", 200, copy_rx_clicked, NULL, NULL); small_button(capture_row, "CLEAR RX", 200, clear_rx_clicked, NULL, NULL); rx_info_label = lv_label_create(parent); - lv_obj_set_size(rx_info_label, 640, 36); - lv_obj_set_style_text_font(rx_info_label, &lv_font_montserrat_14, 0); + lv_obj_set_size(rx_info_label, 640, LV_SIZE_CONTENT); + lv_obj_set_style_text_font(rx_info_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(rx_info_label, lv_color_hex(0xAAB4C3), 0); - lv_obj_t *tx_options = row(parent, 92); + lv_obj_t *tx_options = row(parent, 106); tx_mode_select = dropdown(tx_options, "TX format", "Literal ASCII\nHex byte pairs", tx_mode_changed); ending_select = dropdown(tx_options, "ASCII ending", "None\nLF (0A)\nCR (0D)\nCRLF (0D 0A)", ending_changed); tx_info_label = lv_label_create(parent); - lv_obj_set_size(tx_info_label, 640, 36); - lv_obj_set_style_text_font(tx_info_label, &lv_font_montserrat_14, 0); + lv_obj_set_size(tx_info_label, 640, LV_SIZE_CONTENT); + lv_obj_set_style_text_font(tx_info_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(tx_info_label, lv_color_hex(0xAAB4C3), 0); input_area = lv_textarea_create(parent); lv_obj_set_size(input_area, 640, 96); @@ -972,8 +978,9 @@ void uart_tool_show(lv_obj_t *parent, bool available, lv_obj_add_flag(keyboard, LV_OBJ_FLAG_HIDDEN); status_label = lv_label_create(parent); - lv_obj_set_size(status_label, 640, 60); - lv_obj_set_style_text_font(status_label, &lv_font_montserrat_14, 0); + lv_obj_set_size(status_label, 640, LV_SIZE_CONTENT); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(status_label, lv_color_hex(0xAAB4C3), 0); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); lv_label_set_text(status_label, output_text ? "Disconnected" : "Output buffer allocation failed"); From a714836957a23494b86285e4127e595128a2b00b Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 44/55] Signal Gen: replace unsupported middle dots and enlarge the footer and pin status --- main/signal_tool.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main/signal_tool.c b/main/signal_tool.c index ea95d6f..26cc671 100644 --- a/main/signal_tool.c +++ b/main/signal_tool.c @@ -209,7 +209,7 @@ static void start_clicked(lv_event_t *event) uint32_t actual = ledc_get_freq(LEDC_LOW_SPEED_MODE, SIGNAL_TIMER); lv_label_set_text_fmt(output_label, "Output: %lu Hz at %u%% on G6", (unsigned long)actual, duty_choices[duty_index]); - set_status("PWM active · 5 min limit"); + set_status("PWM active | 5 min limit"); } static void setting_clicked(lv_event_t *event) @@ -317,6 +317,7 @@ void signal_tool_show(lv_obj_t *parent) lv_obj_set_width(status_label, 592); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_color(status_label, lv_color_hex(0xCBD5E1), 0); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_28, 0); lv_label_set_text(status_label, "G6 released"); lv_obj_t *pwm = signal_card(parent); @@ -339,7 +340,8 @@ void signal_tool_show(lv_obj_t *parent) lv_obj_t *limits = lv_label_create(parent); lv_obj_set_width(limits, 640); lv_obj_set_style_text_color(limits, lv_color_hex(0xCBD5E1), 0); - lv_label_set_text(limits, "M5-Bus G6 · 3.3 V logic · Common ground\n" + lv_obj_set_style_text_font(limits, &lv_font_montserrat_28, 0); + lv_label_set_text(limits, "M5-Bus G6 | 3.3 V logic | Common ground\n" "PWM stops after 5 minutes. Stop before rewiring.\n" "Use a buffer for loads; never drive motors, relays, LEDs or 5 V logic directly.\n" "Stopped: high impedance. Low before routing.\n" From ce691ec938e1aed761e8a1ed2e4fdca6cbb2b69b Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 45/55] MQTT: enlarge button and status text and keep disabled buttons readable --- main/mqtt_tool.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/main/mqtt_tool.c b/main/mqtt_tool.c index 1f196c2..6cfc717 100644 --- a/main/mqtt_tool.c +++ b/main/mqtt_tool.c @@ -1137,9 +1137,16 @@ static lv_obj_t *action_button(lv_obj_t *parent, const char *text, int width, { lv_obj_t *button = lv_button_create(parent); lv_obj_set_size(button, width, 68); + lv_obj_set_style_pad_all(button, 0, 0); + lv_obj_set_style_bg_color(button, lv_color_hex(0x334155), LV_STATE_DISABLED); + lv_obj_set_style_bg_opa(button, LV_OPA_COVER, LV_STATE_DISABLED); + lv_obj_set_style_opa(button, LV_OPA_COVER, LV_STATE_DISABLED); + lv_obj_set_style_text_color(button, lv_color_hex(0xe6edf3), LV_STATE_DISABLED); lv_obj_add_event_cb(button, callback, LV_EVENT_CLICKED, NULL); lv_obj_t *label = lv_label_create(button); lv_label_set_text(label, text); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(label, lv_color_hex(0xe6edf3), 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_center(label); if (label_out) *label_out = label; @@ -1153,6 +1160,7 @@ static lv_obj_t *row(lv_obj_t *parent, int height) lv_obj_set_style_pad_all(container, 0, 0); lv_obj_set_style_border_width(container, 0, 0); lv_obj_set_style_bg_opa(container, LV_OPA_TRANSP, 0); + lv_obj_set_style_text_color(container, lv_color_hex(0xe6edf3), 0); lv_obj_clear_flag(container, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_BETWEEN, @@ -1620,6 +1628,7 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_obj_t *title = lv_label_create(parent); lv_label_set_text(title, "MQTT"); lv_obj_set_style_text_font(title, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(title, lv_color_hex(0xe6edf3), 0); uri_area = lv_textarea_create(parent); lv_textarea_set_one_line(uri_area, true); lv_textarea_set_max_length(uri_area, MQTT_URI_MAX + 1); @@ -1640,10 +1649,11 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_textarea_set_placeholder_text(password_area, "Password"); lv_obj_t *controls = row(parent, 78); - connect_button = action_button(controls, "", 140, connect_clicked, &connect_label); - action_button(controls, "", 120, qos_clicked, &qos_label); - action_button(controls, "", 140, retain_clicked, &retain_label); - action_button(controls, "", 140, log_clicked, &log_label); + connect_button = action_button(controls, "", 312, connect_clicked, &connect_label); + action_button(controls, "", 312, qos_clicked, &qos_label); + controls = row(parent, 78); + action_button(controls, "", 312, retain_clicked, &retain_label); + action_button(controls, "", 312, log_clicked, &log_label); if (!wifi_connected) lv_obj_add_state(connect_button, LV_STATE_DISABLED); lv_obj_t *profile_actions = row(parent, 78); @@ -1680,12 +1690,15 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, paste_payload_button = action_button(payload_actions, "PASTE BYTES", 312, paste_payload_clicked, NULL); payload_bytes_label = lv_label_create(parent); lv_obj_set_width(payload_bytes_label, 640); - lv_obj_set_style_text_font(payload_bytes_label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(payload_bytes_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(payload_bytes_label, lv_color_hex(0xe6edf3), 0); lv_label_set_long_mode(payload_bytes_label, LV_LABEL_LONG_WRAP); refresh_payload(); status_label = lv_label_create(parent); lv_obj_set_width(status_label, 640); + lv_obj_set_style_text_font(status_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(status_label, lv_color_hex(0xe6edf3), 0); lv_label_set_long_mode(status_label, LV_LABEL_LONG_WRAP); lv_obj_set_style_text_align(status_label, LV_TEXT_ALIGN_CENTER, 0); if (stopping) lv_label_set_text(status_label, "Previous MQTT session is stopping in the background..."); @@ -1706,7 +1719,8 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, copy_receive_button = action_button(history_actions, "COPY RX", 312, copy_receive_clicked, NULL); receive_label = lv_label_create(parent); lv_obj_set_width(receive_label, 640); - lv_obj_set_style_text_font(receive_label, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_font(receive_label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(receive_label, lv_color_hex(0xe6edf3), 0); lv_label_set_long_mode(receive_label, LV_LABEL_LONG_WRAP); history_area = lv_textarea_create(parent); @@ -1722,7 +1736,7 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_obj_set_style_pad_all(fields[i], 16, 0); lv_obj_set_style_radius(fields[i], 12, 0); } - lv_obj_set_style_text_font(history_area, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_color(history_area, lv_color_hex(0x475569), LV_PART_TEXTAREA_PLACEHOLDER); lv_obj_set_size(uri_area, 640, 64); lv_obj_set_size(username_area, 312, 64); lv_obj_set_size(password_area, 312, 64); From 95a177c0776fd8eb8e264e874129627138e9b0bc Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 46/55] Network: make lookup results readable on the dark results box --- main/network_tool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/network_tool.c b/main/network_tool.c index b426d5e..8eae293 100644 --- a/main/network_tool.c +++ b/main/network_tool.c @@ -462,6 +462,7 @@ void network_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_scroll_dir(results, LV_DIR_VER); result_label = lv_label_create(results); lv_obj_set_width(result_label, LV_PCT(100)); + lv_obj_set_style_text_color(result_label, lv_color_white(), 0); lv_obj_set_style_text_font(result_label, &lv_font_montserrat_28, 0); lv_obj_set_style_text_line_space(result_label, 6, 0); lv_label_set_long_mode(result_label, LV_LABEL_LONG_WRAP); From d6991dd8cc2c1cb1bc2e7b8b539544aec4801c88 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 47/55] Ender 3: replace unsupported glyphs, enlarge G-code entry and set readable text colors --- main/ender3_tool.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/main/ender3_tool.c b/main/ender3_tool.c index f8bb23a..20aef85 100644 --- a/main/ender3_tool.c +++ b/main/ender3_tool.c @@ -508,12 +508,12 @@ static void update_status(void) { if (!status_label) return; if (connected_flag) { - set_status(init_pending ? "Connected · Setting up..." : - "Connected · USB-A"); + set_status(init_pending ? "Connected | Setting up..." : + "Connected | USB-A"); } else if (host_error != ESP_OK) { set_status("USB host error: %s", esp_err_to_name(host_error)); } else { - set_status("Waiting for printer · USB-A"); + set_status("Waiting for printer | USB-A"); } float x = 0.0f, y = 0.0f; @@ -535,7 +535,7 @@ static void update_status(void) snprintf(position_text, sizeof(position_text), "X %+.1f Y %+.1f ACK %u", (double)x, (double)y, acks); lv_label_set_text(pos_label, position_text); } else { - lv_label_set_text_fmt(pos_label, "X — Y — ACK %u", acks); + lv_label_set_text_fmt(pos_label, "X - Y - ACK %u", acks); } } if (response_label) { @@ -744,6 +744,7 @@ static lv_obj_t *row(lv_obj_t *parent, int height) lv_obj_t *container = lv_obj_create(parent); lv_obj_remove_style_all(container); lv_obj_set_size(container, 640, height); + lv_obj_set_style_text_color(container, lv_color_hex(0xe6edf3), 0); lv_obj_set_flex_flow(container, LV_FLEX_FLOW_ROW); lv_obj_set_flex_align(container, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); @@ -761,7 +762,9 @@ static lv_obj_t *small_button(lv_obj_t *parent, const char *text, int width, lv_obj_add_event_cb(control, callback, LV_EVENT_CLICKED, user_data); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); - if (width >= 140) lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(label, lv_color_white(), 0); + if (width < 140) lv_obj_set_style_pad_hor(control, 4, 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_center(label); if (label_out) *label_out = label; @@ -782,6 +785,7 @@ static lv_obj_t *pad_button(lv_obj_t *parent, const char *text, uint32_t color, lv_obj_add_event_cb(control, dir_released, LV_EVENT_PRESS_LOST, (void *)(uintptr_t)dir); lv_obj_t *label = lv_label_create(control); lv_label_set_text(label, text); + lv_obj_set_style_text_color(label, lv_color_white(), 0); lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_font(label, &lv_font_montserrat_28, 0); lv_obj_center(label); @@ -825,6 +829,8 @@ void ender3_tool_show(lv_obj_t *parent) output_text = heap_caps_calloc(1, E3_OUTPUT_CAPACITY, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); lv_obj_set_style_pad_row(parent, 10, 0); + lv_obj_set_style_text_font(parent, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_color(parent, lv_color_hex(0xe6edf3), 0); lv_obj_t *title = lv_label_create(parent); lv_label_set_text(title, "Ender 3"); @@ -900,6 +906,9 @@ void ender3_tool_show(lv_obj_t *parent) lv_obj_t *send_row = row(parent, 76); input_area = lv_textarea_create(send_row); lv_obj_set_size(input_area, 400, 72); + lv_obj_set_style_text_font(input_area, &lv_font_montserrat_28, 0); + lv_obj_set_style_text_color(input_area, lv_color_hex(0x18212b), 0); + lv_obj_set_style_text_color(input_area, lv_color_hex(0x52606d), LV_PART_TEXTAREA_PLACEHOLDER); lv_textarea_set_one_line(input_area, true); lv_textarea_set_max_length(input_area, E3_LINE_CAP - 1); lv_textarea_set_placeholder_text(input_area, "G-code"); @@ -913,6 +922,9 @@ void ender3_tool_show(lv_obj_t *parent) output_area = lv_textarea_create(parent); lv_obj_set_size(output_area, 640, 220); + lv_obj_set_style_text_font(output_area, &lv_font_montserrat_14, 0); + lv_obj_set_style_text_color(output_area, lv_color_hex(0x18212b), 0); + lv_obj_set_style_text_color(output_area, lv_color_hex(0x52606d), LV_PART_TEXTAREA_PLACEHOLDER); lv_textarea_set_text(output_area, ""); lv_textarea_set_placeholder_text(output_area, "No printer activity"); lv_textarea_set_cursor_click_pos(output_area, false); @@ -943,7 +955,7 @@ void ender3_tool_show(lv_obj_t *parent) update_status(); return; } - set_status("Waiting for printer · USB-A"); + set_status("Waiting for printer | USB-A"); } bool ender3_tool_busy(void) From 1f46a9bed585e43213251b1c26dc68c08ef18bea Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 48/55] NTP Lab: use light text for labels and the result card, enlarge field captions --- main/ntp_tool.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main/ntp_tool.c b/main/ntp_tool.c index 00fb8f9..7c19179 100644 --- a/main/ntp_tool.c +++ b/main/ntp_tool.c @@ -417,6 +417,7 @@ static lv_obj_t *label(lv_obj_t *parent, const char *text, bool small) { lv_obj_t *object = lv_label_create(parent); lv_obj_set_width(object, lv_pct(100)); + lv_obj_set_style_text_color(object, lv_color_hex(small ? 0xAAB4C3 : 0xE6EDF3), 0); if (small) lv_obj_set_style_text_font(object, &lv_font_montserrat_14, 0); lv_label_set_long_mode(object, LV_LABEL_LONG_WRAP); lv_label_set_text(object, text); @@ -438,11 +439,11 @@ static lv_obj_t *input(lv_obj_t *parent, const char *caption, const char *value, { lv_obj_t *block = lv_obj_create(parent); lv_obj_remove_style_all(block); - lv_obj_set_size(block, width, 96); + lv_obj_set_size(block, width, 110); lv_obj_remove_flag(block, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(block, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(block, 8, 0); - lv_obj_t *name = label(block, caption, true); + lv_obj_t *name = label(block, caption, false); lv_obj_set_width(name, width); lv_obj_t *area = lv_textarea_create(block); /* Preserve pasted newlines; validation rejects them instead of joining lines. */ @@ -495,7 +496,7 @@ void ntp_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_style_pad_row(column, 20, 0); lv_obj_set_style_text_font(column, &lv_font_montserrat_28, 0); label(column, "NTP Lab", false); - lv_obj_t *destination = row(column, 96); + lv_obj_t *destination = row(column, 110); host_area = input(destination, "Server IPv4", saved_host, 430, 15); lv_textarea_set_placeholder_text(host_area, "192.168.1.10"); port_area = input(destination, "UDP port", saved_port, 198, 5); From 2c5147e8885be77e12224298e3db85352e822f58 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 49/55] Wake-on-LAN: use light text in the status card --- main/wol_tool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main/wol_tool.c b/main/wol_tool.c index ae9edcc..0b46bca 100644 --- a/main/wol_tool.c +++ b/main/wol_tool.c @@ -428,6 +428,7 @@ void wol_tool_show(lv_obj_t *parent, bool connected) lv_obj_remove_flag(result, LV_OBJ_FLAG_SCROLLABLE); lv_obj_set_flex_flow(result, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_bg_color(result, lv_color_hex(0x1F2937), 0); + lv_obj_set_style_text_color(result, lv_color_hex(0xe6edf3), 0); lv_obj_set_style_bg_opa(result, LV_OPA_COVER, 0); lv_obj_set_style_border_width(result, 0, 0); lv_obj_set_style_radius(result, 16, 0); From 72caab1f920594d9bfad6d79903d88e15193e9aa Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Thu, 22 Oct 2026 16:49:43 -0500 Subject: [PATCH 50/55] UDP Console: replace unsupported dashes in TX/RX and enlarge the exchange label --- main/udp_tool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main/udp_tool.c b/main/udp_tool.c index 4830366..e1897bd 100644 --- a/main/udp_tool.c +++ b/main/udp_tool.c @@ -644,7 +644,7 @@ void udp_tool_show(lv_obj_t *parent, bool connected) cancel_button = button(actions, "CANCEL", cancel_clicked); status_label = label(column, connected ? "Ready" : "Wi-Fi disconnected", false); lv_obj_set_style_min_height(status_label, 70, 0); - identity_label = label(column, "Last exchange", true); + identity_label = label(column, "Last exchange", false); result_label = label(column, "No exchange yet", false); preview_panel = lv_obj_create(column); lv_obj_set_size(preview_panel, 640, 240); @@ -654,7 +654,7 @@ void udp_tool_show(lv_obj_t *parent, bool connected) lv_obj_set_style_radius(preview_panel, 12, 0); lv_obj_set_flex_flow(preview_panel, LV_FLEX_FLOW_COLUMN); lv_obj_set_style_pad_row(preview_panel, 12, 0); - tx_label = label(preview_panel, "TX —\n\nRX —", false); + tx_label = label(preview_panel, "TX -\n\nRX -", false); rx_label = label(preview_panel, "", false); lv_obj_set_width(tx_label, LV_PCT(100)); lv_obj_set_width(rx_label, LV_PCT(100)); From f711e6e6728dc6f651de43721cd2b4624958abe5 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:32:58 -0500 Subject: [PATCH 51/55] test: account for measured LVGL display array tails in MQTT soak checks --- tests/mqtt_ui/ui_test.c | 78 ++++++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 32 deletions(-) diff --git a/tests/mqtt_ui/ui_test.c b/tests/mqtt_ui/ui_test.c index f2904ab..6066e16 100644 --- a/tests/mqtt_ui/ui_test.c +++ b/tests/mqtt_ui/ui_test.c @@ -161,6 +161,37 @@ static void settle_ui(void) } assert(!lv_obj_is_scrolling(area(5)) && !lv_obj_is_scrolling(content)); } +typedef struct { + size_t block_bytes; + uint32_t count, capacity; +} display_memory_t; + +static display_memory_t display_memory(void) +{ + lv_array_t *events = &lv_display_get_default()->event_list.array; + size_t requested = (size_t)events->capacity * events->element_size; + size_t block_bytes = lv_tlsf_block_size(events->data); + /* After Home only the two permanent display callbacks remain. TLSF can + * absorb an unsplittable tail in this resized array without a new leak. */ + assert(requested == 16 && block_bytes >= requested && block_bytes - requested <= 32); + assert(lv_mem_test() == LV_RESULT_OK); + return (display_memory_t){block_bytes, events->size, events->capacity}; +} + +static void assert_home_memory(const lv_mem_monitor_t *before, const lv_mem_monitor_t *after, + display_memory_t display_before) +{ + display_memory_t display_after = display_memory(); + printf("Home memory: free=%zu -> %zu, allocations=%zu -> %zu, display_array=%zu -> %zu\n", + before->free_size, after->free_size, before->used_cnt, after->used_cnt, + display_before.block_bytes, display_after.block_bytes); fflush(stdout); + assert(display_before.count == display_after.count && display_before.capacity == display_after.capacity); + /* Account for the measured array block only; every other byte and live + * allocation must match. A blanket heap tolerance would hide real leaks. */ + assert(before->free_size + display_before.block_bytes == after->free_size + display_after.block_bytes); + assert(before->used_cnt == after->used_cnt); +} + static void wait_logging(LONG entries, bool with_ui) { int64_t until = esp_timer_get_time() + 1000000; @@ -453,6 +484,7 @@ static bool run_profile_case(void) /* Warm-up and measured cycles end after Save/Home; ending warm-up after * Load/Home leaves a different small LVGL allocator tail in the parent. */ lv_mem_monitor_t before, after; lv_mem_monitor(&before); + display_memory_t display_before = display_memory(); DWORD handles_before, handles_after; assert(GetProcessHandleCount(GetCurrentProcess(), &handles_before)); LONG tasks = host_tasks_started; for (unsigned i = 0; i < 25; i++) { @@ -463,7 +495,7 @@ static bool run_profile_case(void) lv_mem_monitor(&after); assert(GetProcessHandleCount(GetCurrentProcess(), &handles_after)); printf("Profile memory before assertion: free=%zu -> %zu, allocations=%zu -> %zu, animations=%u\n", before.free_size, after.free_size, before.used_cnt, after.used_cnt, lv_anim_count_running()); fflush(stdout); - assert(before.free_size == after.free_size && before.used_cnt == after.used_cnt); + assert_home_memory(&before, &after, display_before); assert(handles_before == handles_after && host_tasks_started == tasks && host_active_tasks == 1); printf("25 profile reload/delete/save cycles: LVGL free=%zu -> %zu, allocations=%zu -> %zu, handles=%lu -> %lu, standby workers=%ld\n", before.free_size, after.free_size, before.used_cnt, after.used_cnt, @@ -475,7 +507,8 @@ static void lifecycle(void) bool logged = !strcmp(mode, "logged-lifecycle"); connect_session(); if (logged) click("SD LOG\nOFF"); click("PUBLISH"); wait_action(false); mqtt_host_receive("fixture/rx", "bounded preview"); close_app(); finish(false); - lv_mem_monitor_t before, after; lv_mem_monitor(&before); DWORD handles_before, handles_after; + lv_mem_monitor_t before, after; lv_mem_monitor(&before); + display_memory_t display_before = display_memory(); DWORD handles_before, handles_after; assert(GetProcessHandleCount(GetCurrentProcess(), &handles_before)); LONG tasks_before = host_tasks_started; for (unsigned i = 0; i < 25; i++) { @@ -486,7 +519,7 @@ static void lifecycle(void) lv_mem_monitor(&after); assert(GetProcessHandleCount(GetCurrentProcess(), &handles_after)); printf("Session memory: free=%zu -> %zu, allocations=%zu -> %zu, animations=%u\n", before.free_size, after.free_size, before.used_cnt, after.used_cnt, lv_anim_count_running()); fflush(stdout); - assert(before.free_size == after.free_size && before.used_cnt == after.used_cnt); + assert_home_memory(&before, &after, display_before); assert(handles_before == handles_after && host_tasks_started == tasks_before); printf("25 sessions: LVGL free=%zu -> %zu, allocations=%zu, handles=%lu -> %lu, standby workers=%ld\n", before.free_size, after.free_size, after.used_cnt, (unsigned long)handles_before, (unsigned long)handles_after, host_active_tasks); @@ -927,10 +960,7 @@ static bool run_paste_case(void) } assert(!strcmp(mode, "paste-soak")); close_app(); finish(false); lv_mem_monitor_t before, after; lv_mem_monitor(&before); - lv_array_t *events = &lv_display_get_default()->event_list.array; - size_t first_display = lv_tlsf_block_size(events->data); - uint32_t event_count = events->size, event_capacity = events->capacity; - assert((size_t)event_capacity * events->element_size == 16); + display_memory_t display_before = display_memory(); DWORD before_handles, after_handles; assert(GetProcessHandleCount(GetCurrentProcess(), &before_handles)); LONG tasks = host_tasks_started; for (unsigned i = 0; i < 25; ++i) { @@ -941,13 +971,7 @@ static bool run_paste_case(void) close_app(); finish(false); } lv_mem_monitor(&after); assert(GetProcessHandleCount(GetCurrentProcess(), &after_handles)); - size_t last_display = lv_tlsf_block_size(events->data); - printf("PASTE_MEMORY free=%zu -> %zu used=%zu -> %zu display_array=%zu -> %zu requested=16 handles=%lu -> %lu\n", - before.free_size, after.free_size, before.used_cnt, after.used_cnt, first_display, last_display, - before_handles, after_handles); fflush(stdout); - assert(first_display >= 16 && first_display - 16 <= 32 && last_display >= 16 && last_display - 16 <= 32); - assert(before.free_size + first_display == after.free_size + last_display && before.used_cnt == after.used_cnt); - assert(events->size == event_count && events->capacity == event_capacity && lv_mem_test() == LV_RESULT_OK); + assert_home_memory(&before, &after, display_before); assert(before_handles == after_handles && tasks == host_tasks_started && !mqtt_host_allocations); return true; } @@ -1043,12 +1067,8 @@ static bool run_copy_case(void) } if (!strcmp(mode, "copy-soak")) { click("CLEAR"); settle_ui(); close_app(); finish(false); lv_mem_monitor_t before, after; - lv_mem_monitor(&before); DWORD handles_before, handles_after; - lv_array_t *display_events = &lv_display_get_default()->event_list.array; - size_t before_display_bytes = lv_tlsf_block_size(display_events->data); - uint32_t before_events = display_events->size, before_capacity = display_events->capacity; - assert((size_t)display_events->capacity * display_events->element_size == 16); - assert(before_display_bytes >= 16 && before_display_bytes - 16 <= 32); + lv_mem_monitor(&before); display_memory_t display_before = display_memory(); + DWORD handles_before, handles_after; assert(GetProcessHandleCount(GetCurrentProcess(), &handles_before)); LONG tasks = host_tasks_started; for (unsigned i = 0; i < 25; ++i) { open_app(); connect_session(); event = copy_message(bytes, 128); mqtt_host_data(&event); @@ -1056,15 +1076,7 @@ static bool run_copy_case(void) close_app(); finish(false); } lv_mem_monitor(&after); assert(GetProcessHandleCount(GetCurrentProcess(), &handles_after)); - printf("COPY_MEMORY free=%zu -> %zu used=%zu -> %zu display_array=%zu -> %zu requested=%zu handles=%lu -> %lu\n", - before.free_size, after.free_size, before.used_cnt, after.used_cnt, - before_display_bytes, lv_tlsf_block_size(display_events->data), - (size_t)display_events->capacity * display_events->element_size, handles_before, handles_after); - fflush(stdout); - size_t after_display_bytes = lv_tlsf_block_size(display_events->data); - assert(after_display_bytes >= 16 && after_display_bytes - 16 <= 32); - assert(before.free_size + before_display_bytes == after.free_size + after_display_bytes && before.used_cnt == after.used_cnt); - assert(display_events->size == before_events && display_events->capacity == before_capacity && lv_mem_test() == LV_RESULT_OK); + assert_home_memory(&before, &after, display_before); assert(handles_before == handles_after && host_tasks_started == tasks); printf("25 copied receives: LVGL free=%zu -> %zu, handles=%lu -> %lu\n", before.free_size, after.free_size, handles_before, handles_after); } @@ -1196,6 +1208,7 @@ static bool run_receive_case(void) } click("CLEAR"); settle_ui(); lv_mem_monitor_t live_before, live_after, before, after; lv_mem_monitor(&live_before); close_app(); finish(false); lv_mem_monitor(&before); + display_memory_t display_before = display_memory(); DWORD handles_before, handles_after; assert(GetProcessHandleCount(GetCurrentProcess(), &handles_before)); LONG tasks = host_tasks_started; open_app(); connect_session(); click("SD LOG\nOFF"); for (unsigned i = 0; i < 50; i++) { @@ -1206,7 +1219,7 @@ static bool run_receive_case(void) click("CLEAR"); settle_ui(); lv_mem_monitor(&live_after); assert(live_before.used_cnt == live_after.used_cnt && mqtt_host_allocations == 3); close_app(); finish(false); lv_mem_monitor(&after); assert(GetProcessHandleCount(GetCurrentProcess(), &handles_after)); - assert(before.free_size == after.free_size && before.used_cnt == after.used_cnt); + assert_home_memory(&before, &after, display_before); assert(handles_before == handles_after && host_tasks_started == tasks); printf("50 fragmented receives: LVGL free=%zu -> %zu, handles=%lu -> %lu, standby workers=%ld\n", before.free_size, after.free_size, (unsigned long)handles_before, (unsigned long)handles_after, host_active_tasks); @@ -1558,7 +1571,8 @@ static bool run_action_case(void) click("CLEAR"); settle_ui(); lv_mem_monitor_t before, after, warm_ui, used_ui; lv_mem_monitor(&warm_ui); close_app(); finish(false); - lv_mem_monitor(&before); DWORD handles_before, handles_after; + lv_mem_monitor(&before); display_memory_t display_before = display_memory(); + DWORD handles_before, handles_after; assert(GetProcessHandleCount(GetCurrentProcess(), &handles_before)); LONG tasks = host_tasks_started; open_app(); connect_session(); for (unsigned i = 0; i < 50; i++) { click(i % 2 ? "PUBLISH" : "SUBSCRIBE"); wait_action(true); } @@ -1570,7 +1584,7 @@ static bool run_action_case(void) printf("Action memory after Home: free=%zu -> %zu, allocations=%zu -> %zu; active UI allocations=%zu -> %zu\n", before.free_size, after.free_size, before.used_cnt, after.used_cnt, warm_ui.used_cnt, used_ui.used_cnt); fflush(stdout); - assert(before.free_size == after.free_size && before.used_cnt == after.used_cnt); + assert_home_memory(&before, &after, display_before); assert(handles_before == handles_after && host_tasks_started == tasks && !mqtt_host_allocations); printf("50 actions: LVGL free=%zu -> %zu, handles=%lu -> %lu, standby workers=%ld\n", before.free_size, after.free_size, (unsigned long)handles_before, (unsigned long)handles_after, host_active_tasks); From 25a01ea07a4e264aea20a3067080694381b5b27a Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:41:56 -0500 Subject: [PATCH 52/55] test: wait for finite MQTT UI animations to finish before heap checks --- tests/mqtt_ui/ui_test.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tests/mqtt_ui/ui_test.c b/tests/mqtt_ui/ui_test.c index 6066e16..45aafd2 100644 --- a/tests/mqtt_ui/ui_test.c +++ b/tests/mqtt_ui/ui_test.c @@ -5,6 +5,7 @@ #include "payload_clipboard.h" #include "byte_tool.h" #include "src/display/lv_display_private.h" +#include "src/core/lv_global.h" #include "src/stdlib/builtin/lv_tlsf.h" #include #include @@ -146,18 +147,31 @@ static void wait_action(bool with_ui) } } } +static unsigned transient_animations(bool diagnostic) +{ + unsigned count = 0; + lv_anim_t *animation; + LV_LL_READ(&LV_GLOBAL_DEFAULT()->anim_state.anim_ll, animation) { + if (animation->repeat_cnt == LV_ANIM_REPEAT_INFINITE) continue; + count++; + if (diagnostic) + fprintf(stderr, "Pending animation: duration=%ld elapsed=%ld repeats=%lu\n", + (long)animation->duration, (long)animation->act_time, (unsigned long)animation->repeat_cnt); + } + return count; +} static void settle_ui(void) { lv_obj_update_layout(content); - uint16_t animations = lv_anim_count_running(); - int64_t stable_since = esp_timer_get_time(), until = stable_since + 1500000; - /* Theme transitions include a delay; wait for their allocation count to - * settle across the 400 ms maximum scroll duration. Cursor blinking remains - * active. Do not delete animations to make a memory comparison pass. */ + int64_t stable_since = esp_timer_get_time(), until = stable_since + 3000000; + /* Wait for finite theme/scroll animations to finish, then remain idle for + * 500 ms. Infinite cursor blinking stays active; no animations are deleted + * to make a memory comparison pass. */ while (esp_timer_get_time() - stable_since < 500000) { + if (esp_timer_get_time() >= until) transient_animations(true); assert(esp_timer_get_time() < until); pump(); - uint16_t current = lv_anim_count_running(); - if (current != animations) { animations = current; stable_since = esp_timer_get_time(); } + if (transient_animations(false) || lv_obj_is_scrolling(area(5)) || lv_obj_is_scrolling(content)) + stable_since = esp_timer_get_time(); } assert(!lv_obj_is_scrolling(area(5)) && !lv_obj_is_scrolling(content)); } From 8ad9f8822b507d3cca62b43a46f451246d2c910b Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Fri, 23 Oct 2026 23:50:44 -0500 Subject: [PATCH 53/55] fix: fit MQTT field text inside touch controls without scroll oscillation --- main/mqtt_tool.c | 16 +++++++++------- tests/mqtt_ui/ui_test.c | 6 ++++++ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/main/mqtt_tool.c b/main/mqtt_tool.c index 6cfc717..8fb4d42 100644 --- a/main/mqtt_tool.c +++ b/main/mqtt_tool.c @@ -1637,12 +1637,12 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_obj_t *credentials = row(parent, 78); username_area = lv_textarea_create(credentials); - lv_obj_set_size(username_area, 312, 64); + lv_obj_set_size(username_area, 312, 72); lv_textarea_set_one_line(username_area, true); lv_textarea_set_max_length(username_area, MQTT_CREDENTIAL_MAX + 1); lv_textarea_set_placeholder_text(username_area, "Username"); password_area = lv_textarea_create(credentials); - lv_obj_set_size(password_area, 312, 64); + lv_obj_set_size(password_area, 312, 72); lv_textarea_set_one_line(password_area, true); lv_textarea_set_password_mode(password_area, true); lv_textarea_set_max_length(password_area, MQTT_CREDENTIAL_MAX + 1); @@ -1729,7 +1729,9 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_textarea_set_placeholder_text(history_area, "No messages"); /* One-line textareas derive their height from the font; apply the touch - * height after enabling one-line mode so LVGL does not shrink them. */ + * height after enabling one-line mode so LVGL does not shrink them. + * Leave room for the 30 px font line, 32 px padding and theme border; a + * shorter viewport repeatedly scrolls between the top and bottom of it. */ lv_obj_t *fields[] = {uri_area, username_area, password_area, topic_area, payload_area, history_area}; for (size_t i = 0; i < sizeof(fields) / sizeof(fields[0]); i++) { lv_obj_set_style_text_font(fields[i], &lv_font_montserrat_28, 0); @@ -1737,10 +1739,10 @@ void mqtt_tool_show(lv_obj_t *parent, bool wifi_connected, bool sd_available, lv_obj_set_style_radius(fields[i], 12, 0); } lv_obj_set_style_text_color(history_area, lv_color_hex(0x475569), LV_PART_TEXTAREA_PLACEHOLDER); - lv_obj_set_size(uri_area, 640, 64); - lv_obj_set_size(username_area, 312, 64); - lv_obj_set_size(password_area, 312, 64); - lv_obj_set_size(topic_area, 640, 64); + lv_obj_set_size(uri_area, 640, 72); + lv_obj_set_size(username_area, 312, 72); + lv_obj_set_size(password_area, 312, 72); + lv_obj_set_size(topic_area, 640, 72); keyboard = lv_keyboard_create(parent); lv_obj_set_size(keyboard, 640, 360); diff --git a/tests/mqtt_ui/ui_test.c b/tests/mqtt_ui/ui_test.c index 45aafd2..58c1b73 100644 --- a/tests/mqtt_ui/ui_test.c +++ b/tests/mqtt_ui/ui_test.c @@ -278,6 +278,12 @@ static void setup(void) } static void geometry(void) { + for (unsigned i = 0; i < 4; i++) { + lv_obj_t *field = area(i); + const lv_font_t *font = lv_obj_get_style_text_font(field, LV_PART_MAIN); + assert(lv_textarea_get_one_line(field)); + assert(lv_obj_get_content_height(field) >= lv_font_get_line_height(font)); + } const char *controls[] = {"CONNECT", "SUBSCRIBE", "PUBLISH", "SAVE PROFILE", "DELETE PROFILE", "CLEAR", "COPY RX", "PAYLOAD: TEXT", "PASTE BYTES"}; for (unsigned i = 0; i < sizeof(controls) / sizeof(controls[0]); i++) { From e7c1d8df01a8fe7485f1ba0b0788fd24684235b6 Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:13:06 -0500 Subject: [PATCH 54/55] test: align device network checks with the merged NTP button captions --- tests/device_network/device_test.c | 33 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/device_network/device_test.c b/tests/device_network/device_test.c index 09bdd28..de7bc13 100644 --- a/tests/device_network/device_test.c +++ b/tests/device_network/device_test.c @@ -67,6 +67,7 @@ static void expect(const char *text) static void click(const char *text) { lv_obj_t *label = find_text(content, text, true); + if (!label) { fprintf(stderr, "Missing button: %s\n", text); dump_text(content); } assert(label); lv_obj_t *button = lv_obj_get_parent(label); assert(!lv_obj_has_state(button, LV_STATE_DISABLED)); @@ -260,7 +261,7 @@ static void ntp_case(const char *scenario, const char *port) for (size_t i = 0; i < sizeof(bad_hosts) / sizeof(bad_hosts[0]); i++) { input(0, bad_hosts[i]); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), bad_hosts[i])); - click("SAMPLE 4"); expect("full decimal IPv4"); + click("Sample 4"); expect("full decimal IPv4"); assert(host_sockets_opened == 0 && host_tasks_started == 0 && !busy()); } input(0, "127.0.0.1"); @@ -268,41 +269,41 @@ static void ntp_case(const char *scenario, const char *port) for (size_t i = 0; i < sizeof(bad_ports) / sizeof(bad_ports[0]); i++) { input(1, bad_ports[i]); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 1)), bad_ports[i])); - click("SAMPLE 4"); expect("1 to 65535"); + click("Sample 4"); expect("1 to 65535"); assert(host_sockets_opened == 0 && host_tasks_started == 0); } clean_app(); open_app(); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 1)), "000001")); - click("SAMPLE 4"); expect("1 to 65535"); + click("Sample 4"); expect("1 to 65535"); char unicode[65]; for (unsigned i = 0; i < 16; i++) memcpy(unicode + 4 * i, "\xf0\x9f\x94\xa5", 4); unicode[64] = 0; input(0, unicode); clean_app(); open_app(); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 0)), unicode)); - click("SAMPLE 4"); expect("full decimal IPv4"); + click("Sample 4"); expect("full decimal IPv4"); input(0, "127.0.0.1"); unicode[24] = 0; input(1, unicode); clean_app(); open_app(); assert(!strcmp(lv_textarea_get_text(nth(&lv_textarea_class, 1)), unicode)); - click("SAMPLE 4"); expect("1 to 65535"); + click("Sample 4"); expect("1 to 65535"); assert(host_sockets_opened == 0 && host_tasks_started == 0 && !busy()); return; } if (!strcmp(scenario, "ntp-gates")) { - InterlockedExchange(&host_online, 0); click("SAMPLE 4"); expect("Connect to Wi-Fi"); + InterlockedExchange(&host_online, 0); click("Sample 4"); expect("Connect to Wi-Fi"); assert(host_sockets_opened == 0); InterlockedExchange(&host_online, 1); struct timeval time; host_gettimeofday(&time, NULL); InterlockedExchange64(&host_wall_offset_us, -(int64_t)time.tv_sec * 1000000); - click("SAMPLE 4"); expect("Tablet clock is not set"); assert(host_sockets_opened == 0); + click("Sample 4"); expect("Tablet clock is not set"); assert(host_sockets_opened == 0); InterlockedExchange64(&host_wall_offset_us, 0); - input(0, "999.0.0.1"); click("SAMPLE 4"); expect("full decimal IPv4"); - input(0, "127.0.0.1"); input(1, "0"); click("SAMPLE 4"); expect("1 to 65535"); + input(0, "999.0.0.1"); click("Sample 4"); expect("full decimal IPv4"); + input(0, "127.0.0.1"); input(1, "0"); click("Sample 4"); expect("1 to 65535"); assert(host_sockets_opened == 0); return; } if (!strcmp(scenario, "ntp-repeated")) { DWORD before = 0, after = 0; lv_mem_monitor_t memory_before, memory_after; for (unsigned i = 0; i < 25; i++) { - click("SAMPLE 4"); pump_for(200); expect("1 valid"); + click("Sample 4"); pump_for(200); expect("1 valid"); clean_app(); finish(); if (i == 0) { GetProcessHandleCount(GetCurrentProcess(), &before); lv_mem_monitor(&memory_before); } open_app(); expect("Cancelled; UDP socket closed."); @@ -313,15 +314,15 @@ static void ntp_case(const char *scenario, const char *port) open_app(); return; } int64_t started = esp_timer_get_time(); - click("SAMPLE 4"); + click("Sample 4"); if (!strcmp(scenario, "ntp-stop") || !strcmp(scenario, "ntp-home")) { pump_for(250); assert(busy()); int64_t cancel_at = esp_timer_get_time(); - if (!strcmp(scenario, "ntp-stop")) click("STOP"); else clean_app(); + if (!strcmp(scenario, "ntp-stop")) click("Stop"); else clean_app(); finish(); assert(esp_timer_get_time() - cancel_at < 1200000); if (!strcmp(scenario, "ntp-home")) open_app(); expect("Cancelled; UDP socket closed."); printf("cancel_ms=%lld ", (long long)((esp_timer_get_time() - cancel_at) / 1000)); - click("SAMPLE 4"); finish(); expect("KoD RATE"); + click("Sample 4"); finish(); expect("KoD RATE"); } else if (!strcmp(scenario, "ntp-clockstep") || !strcmp(scenario, "ntp-clockgap")) { pump_for(200); if (!strcmp(scenario, "ntp-clockgap")) expect("1 valid"); @@ -616,13 +617,13 @@ static void queued_check(bool condition, const char *message) } static void launch_job(void) { - if (ntp) click("SAMPLE 4"); + if (ntp) click("Sample 4"); else if (udp) start_udp(); else start_wol(); } static void force_launch(void) { - lv_obj_t *label = find_text(content, ntp ? "SAMPLE 4" : "SEND", true); + lv_obj_t *label = find_text(content, ntp ? "Sample 4" : "SEND", true); assert(label); lv_obj_send_event(lv_obj_get_parent(label), LV_EVENT_CLICKED, NULL); } @@ -704,7 +705,7 @@ static void queued_case(const char *scenario, const char *port) bool home = strstr(scenario, "-home") != NULL; LONG sockets = host_sockets_opened; hold_job(); - if (cancel) click(ntp ? "STOP" : "CANCEL"); + if (cancel) click(ntp ? "Stop" : "CANCEL"); if (home) { clean_app(); open_app(); assert(busy()); From 8345c333e99eee793af0b0d6c355eae9e650cdcf Mon Sep 17 00:00:00 2001 From: Devan Metz <68340659+DevanMetz@users.noreply.github.com> Date: Sat, 24 Oct 2026 00:14:22 -0500 Subject: [PATCH 55/55] test: check device UI bounds within its vertically scrollable content --- tests/device_network/device_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/device_network/device_test.c b/tests/device_network/device_test.c index de7bc13..8856fb7 100644 --- a/tests/device_network/device_test.c +++ b/tests/device_network/device_test.c @@ -103,7 +103,12 @@ static void check_bounds(lv_obj_t *o) /* Textarea internal labels intentionally scroll inside their field. */ if (lv_obj_check_type(o, &lv_textarea_class) || lv_obj_check_type(o, &lv_keyboard_class) || lv_obj_check_type(o, &lv_button_class) || lv_obj_get_parent(o) == content) { - if (a.x1 < 28 || a.x2 > 691 || a.y1 < 128 || a.y2 > 1251) { + /* Larger controls and the keyboard extend the vertically scrollable + * app. Keep horizontal bounds strict and require vertical reachability. */ + lv_area_t viewport; lv_obj_get_content_coords(content, &viewport); + int32_t top = viewport.y1 - LV_MAX(0, lv_obj_get_scroll_top(content)); + int32_t bottom = viewport.y2 + LV_MAX(0, lv_obj_get_scroll_bottom(content)); + if (a.x1 < viewport.x1 || a.x2 > viewport.x2 || a.y1 < top || a.y2 > bottom) { fprintf(stderr, "Object overflow: (%ld,%ld)-(%ld,%ld)\n", (long)a.x1, (long)a.y1, (long)a.x2, (long)a.y2); assert(0); }