2 Commits

Author SHA1 Message Date
julian 34b3fc7ec0 Decommission SquareLine: delete include/ui, theme set in display_init
Firmware / build (push) Successful in 4m1s
include/ui (SquareLine export: ui_init, placeholder screen, helpers, theme
manager, project metadata) is no longer used - every screen is hand-coded.
The one live line, the dark default LVGL theme, moves to display_init.cpp.
Build filter and include path drop include/ui. Comments, CLAUDE.md and the
stale README sections (features, layout, partitions) updated.

Verified on the board (USB, dev): Wi-Fi on/forget/scan/join, dark keyboard
and dialogs, update check + install of v0.1.5 from the screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 08:17:01 +02:00
julian 5d495f8ad1 Wiki: v0.1.5 UX refactor, remembered Wi-Fi, on-screen updates
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 07:55:09 +02:00
27 changed files with 67 additions and 931 deletions
+2 -7
View File
@@ -99,8 +99,6 @@ include/
can_driver.h # CAN Bus driver interface
protocol/
automotive_data.h # UART protocol and CAN ID mappings
ui/
ui*.c/h # SquareLine Studio generated UI files
```
**src/main.cpp** (~1530 lines)
@@ -133,9 +131,7 @@ include/
- LVGL 8.4.0 configuration file
- Memory settings, theme configuration, widget enables
**include/ui/** directory (SquareLine Studio exports) - now only `ui_init()` (theme + an empty placeholder screen) and helpers
- **No SquareLine screens remain**: Home was removed 2026-09-21, Settings on 2026-09-27 (replaced by `settings_screen.cpp`). Every screen is hand-coded in `src/modules`. If SquareLine ever re-exports a screen, delete it from the SquareLine project - do not wire it back in
- **Important**: SquareLine Studio exports to `include/ui/` directory to avoid overwriting custom code in `src/`
**UI**: every screen is hand-coded in `src/modules` (see Screens). SquareLine Studio was decommissioned on 2026-09-27 (`include/ui/` deleted); the LVGL theme is set in `display_init.cpp`. Don't reintroduce a UI generator.
### NVS Persistent Storage
@@ -223,7 +219,7 @@ Settings persist across power cycles via ESP32 NVS (Non-Volatile Storage):
### Screens
All hand-coded in `src/modules`, built once and kept (never deleted - SquareLine's delete-on-leave caused dangling pointers and the 2026-09-27 freezes). Shared look in `ui_kit.cpp` (20/24 px text, >= 56 px touch targets, no shadows/animations, `UiKit::confirm()` modal dialog). Each screen has a `tick()` called from `loop()` that refreshes values under the LVGL lock, only while it is shown, and only re-sets label text that changed.
All hand-coded in `src/modules`, built once and kept (never deleted - the old generated screens were deleted on leave, which left dangling pointers and caused the 2026-09-27 freezes). Shared look in `ui_kit.cpp` (20/24 px text, >= 56 px touch targets, no shadows/animations, `UiKit::confirm()` modal dialog). Each screen has a `tick()` called from `loop()` that refreshes values under the LVGL lock, only while it is shown, and only re-sets label text that changed.
- **Driveline** (boot) - swipe left: Settings, swipe right: Gauge Tuning
- **Settings** (`settings_screen.cpp`) - sidebar: **Wi-Fi** (switch, status card, networks nearby, full-screen password page), **Updates** (installed vs latest, Check, Install behind a confirm dialog -> `Ota::requestCheck/requestInstall`), **System** (CAN / link to B / performance overlay switches, live ESP-NOW, CAN, memory, uptime). Swipe right or the Driveline button goes back
@@ -362,7 +358,6 @@ xTaskCreatePinnedToCore(
## Important Notes
- **SquareLine Studio Export**: ALWAYS export UI files to `ui/` directory, NEVER to `src/` (prevents overwriting main.cpp)
- **Adding a setting**: add a row to the right page in `settings_screen.cpp` (`makeSettingRow()` + `UiKit::toggle()`), persist it via `SettingsManager`, and sync it in that page's `refresh*()` function
- **CAN Bus Integration**: BMW CAN IDs are defined in `automotive_data.h` (all 11-bit standard frames, verified live on the swap bus). The CAN driver runs in `TWAI_MODE_NORMAL` (it ACKs frames; not LISTEN_ONLY). Evidence and confidence labels live in `wiki/pages/can-id-candidates.md`. Never add a second caller of `CANDriver::transmit()` without a design discussion — transmitting on the vehicle bus is a safety decision
- **Security**: the Wi-Fi password field is cleared when the password page closes; the saved password lives only in NVS and is never logged (the pre-2026-09-27 code printed it on every join)
+23 -23
View File
@@ -4,12 +4,13 @@ Automotive display controller for Waveshare ESP32-S3-Touch-LCD-5B (1024x600 RGB
## Features
- ✅ **WiFi** - Network scanning with dynamic SSID list
- ✅ **UART** - Automotive data transmission @ 5Hz (GPIO 43/44)
- ✅ **Debug Mode** - FPS and CPU metrics display
- ✅ **Settings Persistence** - NVS storage for toggle states
- ✅ **Touch UI** - LVGL 8.4.0 with SquareLine Studio UI
- ✅ **FreeRTOS** - Multi-core architecture (WiFi/UART on Core 0, LVGL on Core 1)
- ✅ **CAN bus** - decodes the BMW M57N / ZF 6HP powertrain frames (gear, temperatures, rpm, ...)
- ✅ **Link to Controller B** - data + gauge config @ 5 Hz over RS485 (UART1) and ESP-NOW
- ✅ **Screens** - Driveline (boot), Settings (Wi-Fi / Updates / System), Gauge Tuning; LVGL 8.4.0, hand-coded
- ✅ **Wi-Fi** - one remembered network, joined at boot
- ✅ **OTA updates** - signed releases from Gitea, installed from the Settings screen
- ✅ **Settings persistence** - NVS
- ✅ **FreeRTOS** - Wi-Fi / UART / CAN on Core 0, LVGL on Core 1
## Hardware
@@ -64,32 +65,31 @@ pio run --target upload && pio device monitor
## Project Structure
```
migrate-to-pio/
├── platformio.ini # PlatformIO configuration
├── partition_table.csv # Partition table (3MB app + 1MB SPIFFS)
├── src/ # Source code (non-UI)
│ ├── main.cpp # Main application
│ ├── automotive_data.h # UART data structures
│ └── lvgl_v8_port.h/cpp # LVGL porting layer
├── ui/ # SquareLine Studio exports
│ └── ui*.h/c # UI files (auto-generated)
├── include/
│ └── lv_conf.h # LVGL configuration
└── .pio/ # Build artifacts (gitignored)
platformio.ini # PlatformIO configuration
partition_table.csv # dual OTA slots (2 x 7.9 MB), NVS, coredump
src/
main.cpp # setup, loop, console routing
modules/ # screens, Wi-Fi, link, OTA, tunables, ...
drivers/can_driver.cpp # CAN (TWAI)
include/
config/ # lv_conf.h, ota_config.h, board config
display/ # LVGL port
protocol/automotive_data.h # link protocol shared with Controller B
wiki/ # project knowledge base
```
**Important**: Configure SquareLine Studio to export UI files to the `ui/` directory. This prevents the auto-generated UI code from overwriting your custom source files in `src/`.
See `CLAUDE.md` for the architecture.
## Configuration
### Partition Scheme
Current: **Huge APP (3MB No OTA / 1MB SPIFFS)**
Dual OTA (see `partition_table.csv`):
- NVS: 20KB (settings storage)
- NVS: 20KB (settings, tunables, Wi-Fi) - never move it
- OTA data: 8KB
- App: 3MB (application code)
- SPIFFS: 1MB (file system)
- app0 / app1: 7.9MB each (firmware ~1.7MB)
- Coredump: 64KB
Edit `partition_table.csv` to customize partition sizes.
-7
View File
@@ -1,7 +0,0 @@
SET(SOURCES ui_theme_manager.c
ui_themes.c
ui.c
components/ui_comp_hook.c
ui_helpers.c)
add_library(ui ${SOURCES})
-5
View File
@@ -1,5 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD
-5
View File
@@ -1,5 +0,0 @@
ui_theme_manager.c
ui_themes.c
ui.c
components/ui_comp_hook.c
ui_helpers.c
-9
View File
@@ -1,9 +0,0 @@
{
"project_name": "SquareLine_Project.spj",
"datetime": "2025-11-09T17:09:26.2274380+01:00",
"editor_version": "1.5.4",
"project_version": 60,
"user": "Goxhe Altin",
"export_datetime": "2025-11-09T17:09:28.3122290+01:00",
"export_user": "Goxhe Altin"
}
-44
View File
@@ -1,44 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui.h"
#include "ui_helpers.h"
///////////////////// VARIABLES ////////////////////
// EVENTS
lv_obj_t * ui____initial_actions0;
// IMAGES AND IMAGE SETS
///////////////////// TEST LVGL SETTINGS ////////////////////
#if LV_COLOR_DEPTH != 16
#error "LV_COLOR_DEPTH should be 16bit to match SquareLine Studio's settings"
#endif
#if LV_COLOR_16_SWAP !=0
#error "LV_COLOR_16_SWAP should be 0 to match SquareLine Studio's settings"
#endif
///////////////////// ANIMATIONS ////////////////////
///////////////////// FUNCTIONS ////////////////////
///////////////////// SCREENS ////////////////////
void ui_init(void)
{
lv_disp_t * dispp = lv_disp_get_default();
lv_theme_t * theme = lv_theme_default_init(dispp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
true, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme);
// Home (2026-09-21) and Settings (2026-09-27) screens removed: every screen
// is hand-coded in src/modules; display_init.cpp shows the Driveline screen.
ui____initial_actions0 = lv_obj_create(NULL);
lv_disp_load_scr(ui____initial_actions0);
}
void ui_destroy(void)
{
}
-49
View File
@@ -1,49 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _ESP32_S3_TOUCH_LCD_5B_UI_H
#define _ESP32_S3_TOUCH_LCD_5B_UI_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined __has_include
#if __has_include("lvgl.h")
#include "lvgl.h"
#elif __has_include("lvgl/lvgl.h")
#include "lvgl/lvgl.h"
#else
#include "lvgl.h"
#endif
#else
#include "lvgl.h"
#endif
#include "ui_helpers.h"
#include "ui_events.h"
#include "ui_theme_manager.h"
#include "ui_themes.h"
///////////////////// SCREENS ////////////////////
// None: every screen is hand-coded in src/modules (Driveline, Settings, Gauge
// Tuning). The SquareLine Settings screen was removed on 2026-09-27.
///////////////////// VARIABLES ////////////////////
// EVENTS
extern lv_obj_t * ui____initial_actions0;
// IMAGES AND IMAGE SETS
// UI INIT
void ui_init(void);
void ui_destroy(void);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-18
View File
@@ -1,18 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _UI_EVENTS_H
#define _UI_EVENTS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-262
View File
@@ -1,262 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui_helpers.h"
void _ui_bar_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_BAR_PROPERTY_VALUE_WITH_ANIM) lv_bar_set_value(target, val, LV_ANIM_ON);
if(id == _UI_BAR_PROPERTY_VALUE) lv_bar_set_value(target, val, LV_ANIM_OFF);
}
void _ui_basic_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_BASIC_PROPERTY_POSITION_X) lv_obj_set_x(target, val);
if(id == _UI_BASIC_PROPERTY_POSITION_Y) lv_obj_set_y(target, val);
if(id == _UI_BASIC_PROPERTY_WIDTH) lv_obj_set_width(target, val);
if(id == _UI_BASIC_PROPERTY_HEIGHT) lv_obj_set_height(target, val);
}
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_DROPDOWN_PROPERTY_SELECTED) lv_dropdown_set_selected(target, val);
}
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val)
{
if(id == _UI_IMAGE_PROPERTY_IMAGE) lv_img_set_src(target, val);
}
void _ui_label_set_property(lv_obj_t * target, int id, const char * val)
{
if(id == _UI_LABEL_PROPERTY_TEXT) lv_label_set_text(target, val);
}
void _ui_roller_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM) lv_roller_set_selected(target, val, LV_ANIM_ON);
if(id == _UI_ROLLER_PROPERTY_SELECTED) lv_roller_set_selected(target, val, LV_ANIM_OFF);
}
void _ui_slider_set_property(lv_obj_t * target, int id, int val)
{
if(id == _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM) lv_slider_set_value(target, val, LV_ANIM_ON);
if(id == _UI_SLIDER_PROPERTY_VALUE) lv_slider_set_value(target, val, LV_ANIM_OFF);
}
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void))
{
if(*target == NULL)
target_init();
lv_scr_load_anim(*target, fademode, spd, delay, false);
}
void _ui_arc_increment(lv_obj_t * target, int val)
{
int old = lv_arc_get_value(target);
lv_arc_set_value(target, old + val);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_bar_increment(lv_obj_t * target, int val, int anm)
{
int old = lv_bar_get_value(target);
lv_bar_set_value(target, old + val, anm);
}
void _ui_slider_increment(lv_obj_t * target, int val, int anm)
{
int old = lv_slider_get_value(target);
lv_slider_set_value(target, old + val, anm);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea)
{
lv_keyboard_set_textarea(keyboard, textarea);
}
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value)
{
if(value == _UI_MODIFY_FLAG_TOGGLE) {
if(lv_obj_has_flag(target, flag)) lv_obj_clear_flag(target, flag);
else lv_obj_add_flag(target, flag);
}
else if(value == _UI_MODIFY_FLAG_ADD) lv_obj_add_flag(target, flag);
else lv_obj_clear_flag(target, flag);
}
void _ui_state_modify(lv_obj_t * target, int32_t state, int value)
{
if(value == _UI_MODIFY_STATE_TOGGLE) {
if(lv_obj_has_state(target, state)) lv_obj_clear_state(target, state);
else lv_obj_add_state(target, state);
}
else if(value == _UI_MODIFY_STATE_ADD) lv_obj_add_state(target, state);
else lv_obj_clear_state(target, state);
}
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
{
if(val == UI_MOVE_CURSOR_UP) lv_textarea_cursor_up(target);
if(val == UI_MOVE_CURSOR_RIGHT) lv_textarea_cursor_right(target);
if(val == UI_MOVE_CURSOR_DOWN) lv_textarea_cursor_down(target);
if(val == UI_MOVE_CURSOR_LEFT) lv_textarea_cursor_left(target);
lv_obj_add_state(target, LV_STATE_FOCUSED);
}
typedef void (*screen_destroy_cb_t)(void);
void scr_unloaded_delete_cb(lv_event_t * e)
{
// Get the destroy callback from user_data
screen_destroy_cb_t destroy_cb = lv_event_get_user_data(e);
if(destroy_cb) {
destroy_cb(); // call the specific screen destroy function
}
}
void _ui_opacity_set(lv_obj_t * target, int val)
{
lv_obj_set_style_opa(target, val, 0);
}
void _ui_anim_callback_free_user_data(lv_anim_t * a)
{
lv_mem_free(a->user_data);
a->user_data = NULL;
}
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_x(usr->target, v);
}
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_y(usr->target, v);
}
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_width(usr->target, v);
}
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_height(usr->target, v);
}
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_obj_set_style_opa(usr->target, v, 0);
}
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_img_set_zoom(usr->target, v);
}
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
lv_img_set_angle(usr->target, v);
}
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
usr->val = v;
if(v < 0) v = 0;
if(v >= usr->imgset_size) v = usr->imgset_size - 1;
lv_img_set_src(usr->target, usr->imgset[v]);
}
int32_t _ui_anim_callback_get_x(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_x_aligned(usr->target);
}
int32_t _ui_anim_callback_get_y(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_y_aligned(usr->target);
}
int32_t _ui_anim_callback_get_width(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_width(usr->target);
}
int32_t _ui_anim_callback_get_height(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_height(usr->target);
}
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_obj_get_style_opa(usr->target, 0);
}
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_img_get_zoom(usr->target);
}
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return lv_img_get_angle(usr->target);
}
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a)
{
ui_anim_user_data_t * usr = (ui_anim_user_data_t *)a->user_data;
return usr->val;
}
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
{
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_arc_get_value(src), postfix);
lv_label_set_text(trg, buf);
}
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix)
{
char buf[_UI_TEMPORARY_STRING_BUFFER_SIZE];
lv_snprintf(buf, sizeof(buf), "%s%d%s", prefix, (int)lv_slider_get_value(src), postfix);
lv_label_set_text(trg, buf);
}
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off)
{
if(lv_obj_has_state(src, LV_STATE_CHECKED)) lv_label_set_text(trg, txt_on);
else lv_label_set_text(trg, txt_off);
}
void _ui_spinbox_step(lv_obj_t * target, int val)
{
if(val > 0) lv_spinbox_increment(target);
else lv_spinbox_decrement(target);
lv_event_send(target, LV_EVENT_VALUE_CHANGED, 0);
}
void _ui_switch_theme(int val)
{
#ifdef UI_THEME_ACTIVE
ui_theme_set(val);
#endif
}
-131
View File
@@ -1,131 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _ESP32_S3_TOUCH_LCD_5B_UI_HELPERS_H
#define _ESP32_S3_TOUCH_LCD_5B_UI_HELPERS_H
#ifdef __cplusplus
extern "C" {
#endif
#include "ui.h"
#define _UI_TEMPORARY_STRING_BUFFER_SIZE 32
#define _UI_BAR_PROPERTY_VALUE 0
#define _UI_BAR_PROPERTY_VALUE_WITH_ANIM 1
void _ui_bar_set_property(lv_obj_t * target, int id, int val);
#define _UI_BASIC_PROPERTY_POSITION_X 0
#define _UI_BASIC_PROPERTY_POSITION_Y 1
#define _UI_BASIC_PROPERTY_WIDTH 2
#define _UI_BASIC_PROPERTY_HEIGHT 3
void _ui_basic_set_property(lv_obj_t * target, int id, int val);
#define _UI_DROPDOWN_PROPERTY_SELECTED 0
void _ui_dropdown_set_property(lv_obj_t * target, int id, int val);
#define _UI_IMAGE_PROPERTY_IMAGE 0
void _ui_image_set_property(lv_obj_t * target, int id, uint8_t * val);
#define _UI_LABEL_PROPERTY_TEXT 0
void _ui_label_set_property(lv_obj_t * target, int id, const char * val);
#define _UI_ROLLER_PROPERTY_SELECTED 0
#define _UI_ROLLER_PROPERTY_SELECTED_WITH_ANIM 1
void _ui_roller_set_property(lv_obj_t * target, int id, int val);
#define _UI_SLIDER_PROPERTY_VALUE 0
#define _UI_SLIDER_PROPERTY_VALUE_WITH_ANIM 1
void _ui_slider_set_property(lv_obj_t * target, int id, int val);
void _ui_screen_change(lv_obj_t ** target, lv_scr_load_anim_t fademode, int spd, int delay, void (*target_init)(void));
void _ui_arc_increment(lv_obj_t * target, int val);
void _ui_bar_increment(lv_obj_t * target, int val, int anm);
void _ui_slider_increment(lv_obj_t * target, int val, int anm);
void _ui_keyboard_set_target(lv_obj_t * keyboard, lv_obj_t * textarea);
#define _UI_MODIFY_FLAG_ADD 0
#define _UI_MODIFY_FLAG_REMOVE 1
#define _UI_MODIFY_FLAG_TOGGLE 2
void _ui_flag_modify(lv_obj_t * target, int32_t flag, int value);
#define _UI_MODIFY_STATE_ADD 0
#define _UI_MODIFY_STATE_REMOVE 1
#define _UI_MODIFY_STATE_TOGGLE 2
void _ui_state_modify(lv_obj_t * target, int32_t state, int value);
#define UI_MOVE_CURSOR_UP 0
#define UI_MOVE_CURSOR_RIGHT 1
#define UI_MOVE_CURSOR_DOWN 2
#define UI_MOVE_CURSOR_LEFT 3
void _ui_textarea_move_cursor(lv_obj_t * target, int val)
;
void scr_unloaded_delete_cb(lv_event_t * e);
void _ui_opacity_set(lv_obj_t * target, int val);
/** Describes an animation*/
typedef struct _ui_anim_user_data_t {
lv_obj_t * target;
lv_img_dsc_t ** imgset;
int32_t imgset_size;
int32_t val;
} ui_anim_user_data_t;
void _ui_anim_callback_free_user_data(lv_anim_t * a);
void _ui_anim_callback_set_x(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_y(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_width(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_height(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_opacity(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_zoom(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_angle(lv_anim_t * a, int32_t v);
void _ui_anim_callback_set_image_frame(lv_anim_t * a, int32_t v);
int32_t _ui_anim_callback_get_x(lv_anim_t * a);
int32_t _ui_anim_callback_get_y(lv_anim_t * a);
int32_t _ui_anim_callback_get_width(lv_anim_t * a);
int32_t _ui_anim_callback_get_height(lv_anim_t * a);
int32_t _ui_anim_callback_get_opacity(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_zoom(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_angle(lv_anim_t * a);
int32_t _ui_anim_callback_get_image_frame(lv_anim_t * a);
void _ui_arc_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
void _ui_slider_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * prefix, const char * postfix);
void _ui_checked_set_text_value(lv_obj_t * trg, lv_obj_t * src, const char * txt_on, const char * txt_off);
void _ui_spinbox_step(lv_obj_t * target, int val)
;
void _ui_switch_theme(int val)
;
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-209
View File
@@ -1,209 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.4.3+
// LVGL version: 8.3.11
// Project name: design
#include "ui.h"
_ui_local_style_t* _ui_local_styles;
uint32_t _ui_local_style_count = 0;
inline void ui_object_set_local_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value ) {
if ( object_p!=NULL /*&& lv_obj_is_valid(object_p)*/ ) {
lv_obj_set_local_style_prop( object_p, property, _ui_style_value_convert( property, value ), selector );
}
}
//Atomic function to set (and register) an LVGL local style-property for a given part+state (selector) of an object (widget) - can be used in many ways due to being atomic
void ui_object_set_themeable_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p) {
static _ui_local_style_t* local_style_p;
static _ui_local_style_property_setting_t* property_setting_p;
if (object_p==NULL /*|| !lv_obj_is_valid(object_p)*/ || theme_variable_p==NULL) return;
local_style_p = _ui_local_style_create( theme_variable_p, true );
if (local_style_p == NULL) return;
property_setting_p = _ui_local_style_property_setting_create( local_style_p, object_p, selector, property );
if (property_setting_p == NULL) return;
lv_obj_set_local_style_prop( object_p, property, _ui_style_value_convert( property, ui_get_theme_value(theme_variable_p) ), selector ); //ui_object_set_local_style_property( object_p, selector, property, ui_get_theme_value(theme_variable_p) );
}
//This function goes through all registered style-property settings and if theme is changed, sets all of them to the theme. (If called periodically, it can follow change of values automatically.)
void _ui_theme_set_variable_styles (uint8_t mode) {
static uint8_t ui_theme_idx_previous = -1;
static uint32_t i, j;
static _ui_local_style_property_setting_t* property_setting_p;
static ui_style_variable_t style_value;
static ui_style_variable_t* style_variable_p;
uint8_t ui_Theme_Changed = (ui_theme_idx != ui_theme_idx_previous); ui_theme_idx_previous = ui_theme_idx;
for (i = 0; i < _ui_local_style_count; ++i) {
style_variable_p = _ui_local_styles[i].style_variable_p;
if (_ui_local_styles[i].is_themeable) style_value = ui_get_theme_value( style_variable_p );
else style_value = *style_variable_p;
if (style_variable_p != _ui_local_styles[i].previous_pointer || style_value != _ui_local_styles[i].previous_value
|| mode == UI_VARIABLE_STYLES_MODE_INIT || ui_Theme_Changed) {
_ui_local_styles[i].previous_pointer = style_variable_p; _ui_local_styles[i].previous_value = style_value;
property_setting_p = _ui_local_styles[i].style_property_settings; //first item of linked list
for (j = 0; j < _ui_local_styles[i].style_property_setting_count; ++j) {
if (property_setting_p->object_p != NULL) {
ui_object_set_local_style_property (
property_setting_p->object_p, property_setting_p->selector, property_setting_p->property, style_value
);
}
if (property_setting_p->next_p != NULL) property_setting_p = (_ui_local_style_property_setting_t*) property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen, but if it does, it's assumed end of the list
}
}
}
}
ui_style_variable_t ui_get_theme_value(const ui_theme_variable_t* var) {
return var[ui_theme_idx];
}
lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value) {
static lv_style_value_t Style_Value; //LVGL would produce artefacts if both .num and .color were set for the local style to add:
//static lv_style_const_prop_t ValueConvert_Table [_LV_STYLE_NUM_BUILT_IN_PROPS] = { [LV_STYLE_BG_COLOR] = LV_STYLE_CONST_BG_COLOR(1), [LV_STYLE_BG_OPA] = LV_STYLE_CONST_BG_OPA(1) };
if (property==LV_STYLE_BG_COLOR || property==LV_STYLE_BG_GRAD_COLOR || property==LV_STYLE_BG_IMG_RECOLOR || property==LV_STYLE_BORDER_COLOR
|| property==LV_STYLE_OUTLINE_COLOR || property==LV_STYLE_SHADOW_COLOR || property==LV_STYLE_IMG_RECOLOR || property==LV_STYLE_LINE_COLOR
|| property==LV_STYLE_ARC_COLOR || property==LV_STYLE_TEXT_COLOR) {
Style_Value.color = lv_color_hex(value);
}
else if (property==LV_STYLE_BG_GRAD || property==LV_STYLE_BG_IMG_SRC || property==LV_STYLE_ARC_IMG_SRC || property==LV_STYLE_TEXT_FONT
|| property==LV_STYLE_COLOR_FILTER_DSC || property==LV_STYLE_ANIM || property==LV_STYLE_TRANSITION) {
Style_Value.ptr = (void*)(uintptr_t) value;
}
else Style_Value.num = value;
return Style_Value;
}
//auto-update dynamic local style array with existing/new style-variable (1st dimension)
_ui_local_style_t* _ui_local_style_create (const ui_style_variable_t* style_variable_p, bool is_themeable) {
static uint32_t i;
static _ui_local_style_t* local_style_p;
for (i = 0; i < _ui_local_style_count; ++i) { //Find existing local style
if (_ui_local_styles[i].style_variable_p == style_variable_p) return &_ui_local_styles[i];
}
//If not found, create new local style
_ui_local_styles = (_ui_local_style_t*) lv_mem_realloc( _ui_local_styles, (_ui_local_style_count + 1) * sizeof(_ui_local_style_t) );
LV_ASSERT_MALLOC( _ui_local_styles );
if (_ui_local_styles == NULL) return NULL;
//Reset new local style
local_style_p = &_ui_local_styles[ _ui_local_style_count ];
local_style_p->style_variable_p = (ui_style_variable_t*) style_variable_p;
local_style_p->is_themeable = is_themeable;
local_style_p->previous_pointer = NULL;
local_style_p->previous_value = -1;
local_style_p->style_property_setting_count = 0;
local_style_p->style_property_settings = NULL;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
local_style_p->garbage_collector_couter = 0;
#endif*/
++_ui_local_style_count;
return local_style_p;
}
void _ui_local_style_property_setting_delete (lv_event_t* event) { * (lv_obj_t**) lv_event_get_user_data( event ) = NULL; }
//auto-update dynamic local style-array's 2nd dimension (object part+state style-property settings for a given style-variable)
_ui_local_style_property_setting_t* _ui_local_style_property_setting_create
(_ui_local_style_t* local_style_p, lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property) {
static uint32_t i; //auto-update
static _ui_local_style_property_setting_t *style_property_setting_p, *empty_style_property_setting_p;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
style_property_setting_p = local_style_p->style_property_settings; //first item of linked list
if (style_property_setting_p != NULL) { //checking might be unnecessary if count is properly initialized to 0
if (local_style_p->garbage_collector_couter > 0) --local_style_p->garbage_collector_couter; //avoid calling garbage collector every time
else if (LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD > 0) {
local_style_p->garbage_collector_couter = LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD - 1;
for (i = 0; i < local_style_p->style_property_setting_count; ++i) {
if (style_property_setting_p->object_p != NULL) { //check only valid object entry (skip already emptied positions{
#if ( defined(LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE) && LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE ) //Not recommended inside explicit garbage collector.
if ( style_property_setting_p->validcheck_counter > 0 ) --style_property_setting_p->validcheck_counter; //avoids calling complex lv_obj_is_valid() many times
else { //check objects with expired positive vaidity check
if ( lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE;
else style_property_setting_p->object_p = NULL; //free up an entry of a deleted widget
}
#else //this is the recommended variant inside explicit garbage collector:
if ( !lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->object_p = NULL; //free up an entry of a deleted widget
#endif
}
if (style_property_setting_p->next_p != NULL) style_property_setting_p = (_ui_local_style_property_setting_t*) style_property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen
}
}
}
#endif*/
style_property_setting_p = local_style_p->style_property_settings; //first item of linked list
empty_style_property_setting_p = NULL;
if (style_property_setting_p != NULL) { //checking might be unnecessary if count is properly initialized to 0
for (i = 0; i < local_style_p->style_property_setting_count; ++i) {
if (empty_style_property_setting_p == NULL) { //search and register one empty position that might be needed for a newly created entry
if (style_property_setting_p->object_p == NULL) empty_style_property_setting_p = style_property_setting_p; //if found empty position, register it
/*#ifdef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR
else { //if not, check for possible empty positions of deleted objects (garbage-collection)
#if ( defined(LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE) && LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE ) //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster
if ( style_property_setting_p->validcheck_counter > 0 ) --style_property_setting_p->validcheck_counter; //avoids calling complex lv_obj_is_valid() many times
else { //check objects with expired positive vaidity check
if ( lv_obj_is_valid( style_property_setting_p->object_p ) ) style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE;
else { //free up an entry of a deleted widget
style_property_setting_p->object_p = NULL;
empty_style_property_setting_p = style_property_setting_p;
}
}
#else
if ( !lv_obj_is_valid( style_property_setting_p->object_p ) ) { //free up an entry of a deleted widget
style_property_setting_p->object_p = NULL;
empty_style_property_setting_p = style_property_setting_p;
}
#endif
}
#endif*/
}
if (style_property_setting_p->object_p == object_p && style_property_setting_p->selector == selector
&& style_property_setting_p->property == property) { //setting found in the list (created already), so returning it
return style_property_setting_p;
}
if (style_property_setting_p->next_p != NULL) style_property_setting_p = (_ui_local_style_property_setting_t*) style_property_setting_p->next_p; //get next item in linked-list for next round
else break; //this shouldn't happen, but if it does, create a new element
}
}
//If not found, create new local style-property (can be inside the array at freed-up places of deleted objects too)
if (empty_style_property_setting_p == NULL) { //allocate new
empty_style_property_setting_p = (_ui_local_style_property_setting_t*) lv_mem_alloc( sizeof(_ui_local_style_property_setting_t) );
LV_ASSERT_MALLOC( empty_style_property_setting_p );
if (empty_style_property_setting_p == NULL) return NULL;
if (style_property_setting_p != NULL) style_property_setting_p->next_p = (void*) empty_style_property_setting_p; //create link from last item to the new
else local_style_p->style_property_settings = empty_style_property_setting_p; //(except if creating first item)
style_property_setting_p = empty_style_property_setting_p; //take the new item pointer for initialization
style_property_setting_p->next_p = NULL; //signify the end of the linked list, just in case
++local_style_p->style_property_setting_count;
}
else { //reuse empty
style_property_setting_p = empty_style_property_setting_p;
}
style_property_setting_p->object_p = object_p; lv_obj_add_event_cb( object_p, _ui_local_style_property_setting_delete, LV_EVENT_DELETE, &style_property_setting_p->object_p );
style_property_setting_p->selector = selector;
style_property_setting_p->property = property;
/*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE
style_property_setting_p->validcheck_counter = LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE; //0
#endif*/
return style_property_setting_p;
}
-75
View File
@@ -1,75 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.4.3+
#ifndef _UI_THEME_MANAGER_H
#define _UI_THEME_MANAGER_H
#ifdef __cplusplus
extern "C" {
#endif
#define UI_THEME_ACTIVE 1
/*#ifndef LV_SQUARELINE_THEME__IMPLICIT_GARBAGE_COLLECTOR
#ifndef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD //for slow hardware, tells how frequently the style-properties inside this style should be garbage-collected (recommended value: 10..100, 0:never)
#define LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD 100 //a sensible default value that already gives good results on slow hardware, can be overridden from outside
#endif
#endif*/
enum { UI_VARIABLE_STYLES_MODE_INIT = 1, UI_VARIABLE_STYLES_MODE_FOLLOW = 0 };
typedef int64_t ui_style_variable_t;
typedef ui_style_variable_t ui_theme_variable_t; //A 'theme' variable array is an array of 'style' variables for corresponding themes.
typedef struct {
lv_obj_t * object_p;
lv_style_selector_t selector;
lv_style_prop_t property;
/*#ifdef LV_SQUARELINE_THEME__OBJECT_VALIDITY_CACHE //for slow hardware, adding this and setting to 5..10 in lv_conf.h might make it faster (less lv_obj_is_valid calls)
uint16_t validcheck_counter; //used for garbage collection (finding empty slots) not to call lv_obj_is_valid() every time
#endif*/
void * next_p;
} _ui_local_style_property_setting_t;
typedef struct {
bool is_themeable; //scalar or vector?
ui_style_variable_t * style_variable_p;
ui_style_variable_t * previous_pointer;
ui_style_variable_t previous_value;
uint32_t style_property_setting_count;
_ui_local_style_property_setting_t * style_property_settings;
/*#ifdef LV_SQUARELINE_THEME__EXPLICIT_GARBAGE_COLLECTOR_PERIOD
uint16_t garbage_collector_couter;
#endif*/
} _ui_local_style_t;
extern _ui_local_style_t * _ui_local_styles;
extern uint32_t _ui_local_style_count;
void ui_object_set_local_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, ui_style_variable_t value );
void ui_object_set_themeable_style_property
(lv_obj_t* object_p, lv_style_selector_t selector, lv_style_prop_t property, const ui_theme_variable_t* theme_variable_p);
void _ui_theme_set_variable_styles (uint8_t mode);
lv_style_value_t _ui_style_value_convert (lv_style_prop_t property, ui_style_variable_t value);
ui_style_variable_t ui_get_theme_value (const ui_theme_variable_t *var);
_ui_local_style_t * _ui_local_style_create (const ui_style_variable_t * style_variable_p, bool is_themeable);
_ui_local_style_property_setting_t * _ui_local_style_property_setting_create
(_ui_local_style_t * local_style, lv_obj_t * object_p, lv_style_selector_t selector, lv_style_prop_t property);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
-17
View File
@@ -1,17 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#include "ui.h"
const ui_theme_variable_t _ui_theme_color_panel_backgroung[1] = {0x7F7A9C};
const ui_theme_variable_t _ui_theme_alpha_panel_backgroung[1] = {255};
uint8_t ui_theme_idx = UI_THEME_DEFAULT;
void ui_theme_set(uint8_t theme_idx)
{
ui_theme_idx = theme_idx;
_ui_theme_set_variable_styles(UI_VARIABLE_STYLES_MODE_FOLLOW);
}
-30
View File
@@ -1,30 +0,0 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.4
// LVGL version: 8.3.6
// Project name: ESP32-S3-Touch-LCD-5B
#ifndef _UI_THEMES_H
#define _UI_THEMES_H
#ifdef __cplusplus
extern "C" {
#endif
#define UI_THEME_COLOR_PANEL_BACKGROUNG 0
#define UI_THEME_DEFAULT 0
extern const ui_theme_variable_t _ui_theme_color_panel_backgroung[1];
extern const ui_theme_variable_t _ui_theme_alpha_panel_backgroung[1];
extern const uint32_t * ui_theme_colors[1];
extern const uint8_t * ui_theme_alphas[1];
extern uint8_t ui_theme_idx;
void ui_theme_set(uint8_t theme_idx);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
+2 -3
View File
@@ -49,8 +49,8 @@ lib_deps =
; ----------------------------------------------------------------------------
; Build Flags & Source Directories
; ----------------------------------------------------------------------------
; Include UI, display, and modules directories as source directories
build_src_filter = +<*> +<modules/*> +<../include/ui/*> +<../include/display/*>
; Also compile the LVGL port that lives under include/display
build_src_filter = +<*> +<modules/*> +<../include/display/*>
build_flags =
; C++ standard (required for ESP32_Display_Panel)
@@ -91,7 +91,6 @@ build_flags =
-I include/config
-I include/display
-I include/protocol
-I include/ui
-I src
; ----------------------------------------------------------------------------
+10 -8
View File
@@ -4,7 +4,6 @@
#include "display_init.h"
#include "display/lvgl_v8_port.h"
#include "ui/ui.h"
#include "driveline_screen.h"
#include "config/ota_config.h" // FW_VERSION
@@ -90,17 +89,20 @@ DisplayObjects init() {
Serial.println("[DisplayInit] Step 11: LVGL initialized successfully!");
Serial.flush();
// Step 12-13: Load SquareLine Studio UI
Serial.println("[DisplayInit] Step 12: Loading SquareLine Studio UI...");
// Step 12-13: Theme + boot screen
Serial.println("[DisplayInit] Step 12: Loading UI...");
lvgl_port_lock(-1);
ui_init(); // Initialize the SquareLine Studio generated UI
// Boot screen: the hand-coded Driveline screen. ui_init() only loads an
// empty placeholder now (the SquareLine Home screen was removed 2026-09-21);
// swap while the backlight is still off so there's no flash.
// Dark default theme, blue primary. The hand-coded screens override most
// styles, but the keyboard, dialogs, text areas, switches and sliders take
// their base look from it.
lv_disp_t* disp = lv_disp_get_default();
lv_disp_set_theme(disp, lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE),
lv_palette_main(LV_PALETTE_RED), true, LV_FONT_DEFAULT));
// Boot screen, loaded while the backlight is still off so there's no flash.
DrivelineScreen::show();
createVersionLabel();
lvgl_port_unlock();
Serial.println("[DisplayInit] Step 13: SquareLine UI loaded successfully!");
Serial.println("[DisplayInit] Step 13: UI loaded");
// Small delay to ensure UI is rendered
delay(100);
+2 -2
View File
@@ -4,7 +4,7 @@
* Handles hardware-specific initialization for the Waveshare ESP32-S3-Touch-LCD-5B:
* - Board initialization (LCD panel, touch controller)
* - LVGL initialization and configuration
* - SquareLine Studio UI loading
* - LVGL theme and the boot (Driveline) screen
* - Backlight control to prevent white flash during startup
*/
@@ -35,7 +35,7 @@ struct DisplayObjects {
* 3. Initialize backlight (off initially to prevent white flash)
* 4. Start the board
* 5. Initialize LVGL porting layer
* 6. Load SquareLine Studio UI
* 6. Set the LVGL theme and show the Driveline screen
* 7. Turn on backlight after UI is ready
*
* @return DisplayObjects containing board and backlight pointers
+2 -10
View File
@@ -5,16 +5,8 @@
* the swap's bus: gear (hero), coolant, gearbox oil temp, engine RPM, turbine
* speed and output shaft, plus ignition / engine / clutch / mismatch status.
*
* WHY THIS IS NOT A SQUARELINE SCREEN
* SquareLine Studio owns include/ui/ and overwrites it on every export. Editing
* generated files loses the edit — that is exactly how the CAN toggle's event
* handler went missing. This screen lives entirely in src/, which SquareLine
* never touches, so it cannot be clobbered. Since 2026-09-21 it IS the boot
* screen: the SquareLine Home screen was removed, and the generated Settings
* screen's back gesture calls app_show_driveline() (defined at the bottom of
* driveline_screen.cpp) to return here.
*
* Navigation: swipe LEFT -> Settings (SquareLine), swipe RIGHT -> Gauge Tuning.
* The boot screen. Navigation: swipe LEFT -> Settings, swipe RIGHT -> Gauge
* Tuning (both hand-coded, like this one).
*
* Signals deliberately NOT shown: engine oil temp (no sensor on this M57N —
* 0x1D0 byte 1 is permanently 0xFF) and battery voltage (0x3B4 publishes the
+1 -2
View File
@@ -1,8 +1,7 @@
/*
* Settings Screen Module
*
* Hand-coded (replaces the SquareLine Settings screen, 2026-09-27). Sidebar
* with three sections:
* Sidebar with three sections:
* Wi-Fi - switch, connection status, networks nearby, full-screen password
* entry; the joined network is remembered (WiFiManager)
* Updates - installed vs latest release, Check, Install behind a confirm
-2
View File
@@ -2,8 +2,6 @@
* UI State Manager Module
*
* Holds the debug flag (sent to Controller B, shows LVGL's performance overlay).
* The screen-sync logic for the SquareLine Settings screen went with that
* screen (2026-09-27): the hand-coded Settings screen reads live state itself.
*/
#pragma once
+3 -3
View File
@@ -12,7 +12,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
- [[patrol-instrument-cluster]] — **what the Patrol cluster expects on its inputs**: tach = 2 pulses/rev (verified by calibration), temp = NTC sender 2.1–2.9 kΩ cold → ~250 Ω at 90 °C; the 1 kHz PWM needle-flutter problem and the mitigation ladder (fixed-duty test → 20 kHz → hardware damping)
- [[bmw-m57n-engine]] — the 3.0L BMW diesel whose CAN bus we read; E60/E65 donor (confirmed), DDE ECU, auto box with EGS on bus
- [[nissan-patrol-swap]] — the target vehicle: Patrol receiving the M57N + BMW auto; the tapped bus is a BMW island in a Nissan
- [[esp32-s3-touch-lcd-5b]] — Waveshare 5" display board (Controller A); onboard TJA1051 CAN transceiver, 7–36 V input, pinout, PSRAM/LCD gotchas — **flash writes flicker the RGB panel, full-screen fades stutter, internal RAM nearly full, opening the serial port resets the board unless DTR/RTS are low**
- [[esp32-s3-touch-lcd-5b]] — Waveshare 5" display board (Controller A); onboard TJA1051 CAN transceiver, 7–36 V input, pinout, PSRAM/LCD gotchas — **flash writes flicker the RGB panel, full-screen fades stutter, internal RAM nearly full, opening the serial port resets the board unless DTR/RTS are low; Wi-Fi scans caused the flickering dots; all screens hand-coded since 2026-09-27**
## Concepts
@@ -20,13 +20,13 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
- [[driveline-speed-signals]] — **engine / turbine / output-shaft speeds**: turbine speed as physical proof of gear engagement, and the output-shaft field that is our **only road-speed source** (no DSC on this bus) — the feedback variable for a future cruise-control PoC, with the safety envelope that would require
- [[dual-controller-architecture]] — Controller A → UART1 + ESP-NOW, protocol v2 → Controller B (1.3" display + Patrol gauge outputs); A owns alerts and the gauge tunables (`cfg` console)
- [[obd-diagnostic-polling]] — **why boost / MAF / rail / injection / DTCs never appear on the sniffer** and how a tester gets them: Route A generic OBD-II mode 01 on `0x7DF` and Route B BMW KWP on `0x6F1` → `0x612` — **BOTH VERIFIED WORKING 2026-09-23** (minimal PID set, no boost PID, mode 09 silent; `1A 86` ident identifies the donor; DTCs read via mode 03), the capture-with-Launch procedure (still wanted for the `22 D1xx` live-data identifiers), and why polling is a transmit-on-the-bus design decision
- [[ota-updates]] — **Controller A updates itself from Gitea releases**: tag `v*` → CI builds + signs (ECDSA P-256) → `ota install` (manual, parked, Wi-Fi) pulls over HTTPS from the public repo, verifies, flashes the idle slot, 30 s confirm-or-rollback; **verified end-to-end 2026-09-26 (dev → v0.1.1 → v0.1.2; v0.1.3 published)**, release with `git push --follow-tags origin main`; dual-slot partition table; plan for updating Controller B through A over ESP-NOW
- [[ota-updates]] — **Controller A updates itself from Gitea releases**: tag `v*` → CI builds + signs (ECDSA P-256) → Settings → Updates (confirm dialog) or `ota install` (manual, parked, Wi-Fi) pulls over HTTPS from the public repo, verifies, flashes the idle slot, 30 s confirm-or-rollback; **verified end-to-end, from the screen since 2026-09-27 (now v0.1.5)**, release with `git push --follow-tags origin main`; dual-slot partition table; plan for updating Controller B through A over ESP-NOW
## Synthesis
- [[canny-5-3-pico-gauge-drive]] — **why the CANNY-based setup moves the Patrol needles and our ESP32 doesn't**: CANNY "negative output" = 12 V-domain low-side switch, ESP32 IO7/IO8 = 3.3 V push-pull; the low-side transistor fix, and why it's not firmware PWM polarity
- [[can-id-candidates]] — **the E60/E65 CAN ID map — now decoded end-to-end**: gear (lever + engaged + mode), coolant, gearbox temp (raw−40), battery (12-bit ×0.015), RPM, turbine speed, engine state all verified; placeholder IDs verified absent; fault codes and boost not passively broadcast
- [[open-questions]] — the research frontier: bench-verify the candidate IDs, operating temp, transient protection, fault-code design decision
- [[open-questions]] — the research frontier (#14 Wi-Fi UX resolved 2026-09-27): bench-verify the candidate IDs, operating temp, transient protection, fault-code design decision
## Sources
+4
View File
@@ -137,3 +137,7 @@ Brought the wiki in line with the whole 2026-09-26 session. ota-updates: status
## [2026-09-27] build | UI freeze + reboots fixed: LVGL pool to PSRAM, dangling SSID buttons, scans (v0.1.4)
User: swiping main<->Settings 3x froze the UI; random flickering dots on all screens. Board state while frozen: link task alive (UART+ESP-NOW), loop()/console dead -> LVGL lock held forever. Causes found: (1) LV_ASSERT_HANDLER `while(1);` spins inside the task holding the LVGL lock; (2) g_ssid_buttons[] dangled after SquareLine deleted the Settings screen -> lv_obj_del() on freed objects; (3) with (1) replaced by abort(), the next run rebooted after ~5 round trips and the decoded backtrace showed the real limit: lv_mem_buf_get() failing in a label draw - the 48 KB LVGL pool at 87% / 31% frag / 4.5 KB biggest block; (4) Wi-Fi scanned every 10 s on every screen, connected or not. Fixes: abort() handler, LV_EVENT_DELETE clears button slots, scanning only with the list on screen and not connected, LVGL pool 512 KB in PSRAM (frees 48 KB internal: internal free 16 -> 69 KB), `mem` console command. Verified: 10 Settings visits + 9 list rebuilds, pool peak 4%, 0 crashes; user: swipes better, no dots, no freeze, no reboot. Updated esp32-s3-touch-lcd-5b, open-questions #13/#14, ota-updates, CLAUDE.md.
## [2026-09-27] build | Hand-coded Settings + tabbed Gauge Tuning, remembered Wi-Fi, on-screen updates (v0.1.5)
User asked to refactor the Settings and Gauge Tuning UX, save the Wi-Fi connection, and add a check for updates. Decisions (user): sidebar Settings (Wi-Fi / Updates / System), install behind a confirm dialog (not a PIN), one remembered network, Tuning as tabs with big controls. SquareLine Settings screen deleted; WiFiManager rewritten without UI code (remembered network in NVS, auto-join at boot, scans only on request, one retry then back to the ESP-NOW channel, failure reasons on screen, password never logged - the old code printed it). Verified: auto-join after USB flash; user installed v0.1.4 then v0.1.5 from the screen ("All good"); v0.1.4 showed the dots again because it forgot the network after the restart and rescanned. Lessons: a plain `git push` doesn't send tags (v0.1.5 needed `git push origin v0.1.5`); esptool crashes mid-write when its progress bar goes to a cp1252 pipe. Updated ota-updates (status table, decision: Updates on Settings), open-questions #12/#14, esp32-s3-touch-lcd-5b, dual-controller-architecture, index.
@@ -23,6 +23,8 @@ BMW M57N CAN bus ──▶ Controller A ──UART1 + ESP-NOW, 5 Hz──▶ Con
**ESP-NOW and Wi-Fi share the radio** `(verified 2026-09-26)`. When A joins a Wi-Fi network (for OTA), its channel follows the AP (seen: 6, 9, 11) and B hops to find it; ESP-NOW kept running (6,410 frames, 0 failed). Until 2026-09-26 the Wi-Fi code powered the radio off on connect/disconnect (`WiFi.disconnect(true)`), which silently killed ESP-NOW and left B on the wire only — fixed, and `EspNowLink::send()` now re-initialises ESP-NOW if the driver drops it. Planned: **Controller B's firmware updates will travel from A over ESP-NOW** (bidirectional, unlike the one-way wire) → [[ota-updates]].
**A keeps the ESP-NOW channel stable (v0.1.5, 2026-09-27)** `(repo)`: Wi-Fi auto-reconnect is off. A tries the remembered network once at boot and once after a drop, then parks the radio back on channel 1 — an endless reconnect (e.g. driving away from home Wi-Fi) would keep hopping channels under the link to B. Scans happen only when someone opens the Wi-Fi page or taps Scan.
Controller B's side of this (receiver, ESP-NOW channel hopping, gauge outputs, bench wiring) is documented in the sibling wiki: `../../ESP32-S3-LCD-1.3/wiki/pages/controller-link.md` and `patrol-gauge-outputs.md`.
## Why it matters for the wiki
+3
View File
@@ -58,6 +58,9 @@ Note: the screen occupies most GPIOs; auxiliary functions (backlight, reset, SD_
- **LVGL's widget pool ran out** `(verified 2026-09-27)`: Settings + its Wi-Fi list is ~15 KB; screen churn + list rebuilds took the 48 KB pool to 87% used / 31% fragmented / 4.5 KB biggest block, then a label draw failed `lv_mem_buf_get()` (backtrace decoded with addr2line). With the 512 KB PSRAM pool: 10 Settings visits + 9 list rebuilds, peak 4%, 0 crashes; swipes feel better (user).
- **LVGL asserts used to freeze the board**: `LV_ASSERT_HANDLER` was `while(1);`, which spins inside the calling task *while it holds the LVGL lock* — UI frozen, `loop()`/console blocked on the lock, only the link task alive. Now `abort()`: backtrace on the console, core dump to flash (ELF), reboot. Decode with `xtensa-esp32s3-elf-addr2line -pfiaC -e firmware.elf <addrs>` (CI attaches `firmware.elf` to every release).
- **Background Wi-Fi scans caused the random flickering dots** `(verified by elimination 2026-09-27)`: the Wi-Fi task scanned every 10 s forever, connected or not, on any screen; Wi-Fi buffers live in PSRAM next to the framebuffer. Scanning is now limited to "network list on screen and not connected" — the dots are gone (user).
- **The dots came back on v0.1.4, gone on v0.1.5** `(verified 2026-09-27, user)`: v0.1.4 limited scans to "Settings open and not connected", but it forgot the network on every restart, so after the OTA restart it sat disconnected and rescanned every 10 s whenever Settings was open. v0.1.5 remembers the network and scans only when the Wi-Fi page opens or Scan is tapped. The underlying weakness remains: the RGB panel streams from PSRAM with no bounce buffer, so heavy Wi-Fi or flash traffic can still disturb the picture ([[open-questions]] #13).
- **SquareLine's screen lifecycle was the freeze risk, not LVGL**: its generated screens are deleted on leave and rebuilt on entry, so any pointer kept elsewhere dangles. Since 2026-09-27 every screen is hand-coded, built once and kept `(repo)`.
- **Uploading over USB from a script on Windows**: esptool crashed printing its progress bar into a cp1252 pipe *in the middle of writing* and left the board frozen until a power cycle; the bootloader then fell back to the other OTA slot, so nothing was lost `(verified 2026-09-27)`. Set `PYTHONIOENCODING=utf-8` when piping upload output.
- **Never power the Wi-Fi radio off** (`WiFi.disconnect(true)`, `WiFi.mode(WIFI_OFF)`): it de-initialises ESP-NOW, the wireless leg of the link to B → [[dual-controller-architecture]].
- **Partition table is dual-slot OTA** since 2026-09-26 (2 × 7.9 MB, no SPIFFS, NVS offset unchanged) → [[ota-updates]].
+2 -2
View File
@@ -24,7 +24,7 @@ The research frontier. Answering any of these should trigger updates across the
## Design decisions (parked, not blocking)
12. **The "Diagnostics" screen (planned 2026-09-23).** Active diagnostic polling — replaying the `2C` live-data reads we decoded ([[launch-capture-2026-09-23]]) so values like rail pressure appear on Controller A without the Launch — is now technically unblocked (no session/security needed). Intended design when built: a **password-protected Diagnostics screen**, authorized-technician access only, manual trigger, refuses while a scan tool is connected, read-oriented services only. The same gate covers the general transmit-on-the-bus decision. This is deliberately deferred, but the capability, the byte sequences, and these guard rails are recorded so the work resumes from here, not from scratch. **Also the home of the OTA "check / install" controls (2026-09-26)** — today they are the `ota` console; the password must be stored as a salted hash in NVS because the firmware is public. → [[obd-diagnostic-polling]], [[dual-controller-architecture]], [[ota-updates]]
12. **The "Diagnostics" screen (planned 2026-09-23).** Active diagnostic polling — replaying the `2C` live-data reads we decoded ([[launch-capture-2026-09-23]]) so values like rail pressure appear on Controller A without the Launch — is now technically unblocked (no session/security needed). Intended design when built: a **password-protected Diagnostics screen**, authorized-technician access only, manual trigger, refuses while a scan tool is connected, read-oriented services only. The same gate covers the general transmit-on-the-bus decision. This is deliberately deferred, but the capability, the byte sequences, and these guard rails are recorded so the work resumes from here, not from scratch. OTA check/install was meant to live here too (2026-09-26); **decided otherwise 2026-09-27**: it is on the Settings screen behind a confirm dialog ([[ota-updates]]). Whatever password this screen gets must be stored as a salted hash in NVS because the firmware is public. → [[obd-diagnostic-polling]], [[dual-controller-architecture]], [[ota-updates]]
## Project context
@@ -72,4 +72,4 @@ The research frontier. Answering any of these should trigger updates across the
13. **Internal RAM is nearly exhausted (found 2026-09-26) — largely relieved 2026-09-27:** LVGL's 48 KB pool moved to PSRAM (512 KB) → internal free 16 → **69 KB**, largest block 7.6 → **31.7 KB**, enough for bounce buffers to be attempted. Original finding: With display + Wi-Fi up: 15.9 KB internal free, largest block 7.6 KB (PSRAM 7.1 MB free). OTA works around it ([[ota-updates]]), but anything else that needs an internal allocation (another task, a TLS client, a bigger Wi-Fi burst) can fail. Biggest known consumer: the LVGL 60-line DMA draw buffer (~120 KB). Options: shrink it to ~30–40 lines, or measure what else lives in internal RAM first (`heap_caps_print_heap_info`). Not urgent, but it limits every future feature. **Same project as the display flicker/lag (2026-09-26):** flash writes flicker the PSRAM-fed RGB panel (no bounce buffer) and full-screen transitions stutter. Espressif's cure is bounce buffers + `CONFIG_SPIRAM_XIP_FROM_PSRAM` (needs pioarduino `custom_sdkconfig`), and bounce buffers need internal RAM — so free RAM, add bounce buffers, and measure real render FPS (LVGL perf monitor; the Debug "FPS" counts `loop()` passes, not frames) in one bench session. Quick mitigations shipped in v0.1.2 (instant screen switches, deferred NVS saves, dark screen during OTA).
14. **Wi-Fi UX (found 2026-09-26).** The Settings Wi-Fi screen had never worked (switch shipped disabled) and, now usable, is "a disaster UX" (user): SquareLine-generated, runtime SSID buttons + floating keyboard + loading overlay, **no on-screen confirmation of a successful join**. Also: A **forgets the network on every reboot** (each boot needs `wifi join`). To do: redesign as a hand-coded screen (like Driveline/Tuning, safe from SquareLine re-exports), show connection state, remember the network in NVS and auto-join; consider housing it on the Diagnostics screen (#12) next to the OTA controls, since Wi-Fi now mainly serves updates. Fixed 2026-09-27: the SSID buttons' pointers dangled after SquareLine deleted the Settings screen (use-after-free on the next scan), and scans ran every 10 s on every screen even when connected (flickering dots) — see [[esp32-s3-touch-lcd-5b]]. Housekeeping: **delete the `v0.1.0` release** on Gitea — installing it would strand the board without working OTA (USB only). → [[ota-updates]]
14. **Wi-Fi UX (found 2026-09-26) — RESOLVED 2026-09-27 (v0.1.5):** Settings rebuilt as a hand-coded screen (the SquareLine one is deleted) with Wi-Fi / Updates / System sections: connection status with failure reasons, networks nearby, full-screen password page, **one remembered network joined at boot**, scans only on request. User: "Wow, I like it" / "All good". Remaining housekeeping below still applies. Original finding: The Settings Wi-Fi screen had never worked (switch shipped disabled) and, now usable, is "a disaster UX" (user): SquareLine-generated, runtime SSID buttons + floating keyboard + loading overlay, **no on-screen confirmation of a successful join**. Also: A **forgets the network on every reboot** (each boot needs `wifi join`). To do: redesign as a hand-coded screen (like Driveline/Tuning, safe from SquareLine re-exports), show connection state, remember the network in NVS and auto-join; consider housing it on the Diagnostics screen (#12) next to the OTA controls, since Wi-Fi now mainly serves updates. Fixed 2026-09-27: the SSID buttons' pointers dangled after SquareLine deleted the Settings screen (use-after-free on the next scan), and scans ran every 10 s on every screen even when connected (flickering dots) — see [[esp32-s3-touch-lcd-5b]]. Housekeeping: **delete the `v0.1.0` release** on Gitea — installing it would strand the board without working OTA (USB only). → [[ota-updates]]
+11 -8
View File
@@ -16,7 +16,7 @@ git push tag vX.Y.Z ──► Gitea Actions (.gitea/workflows/firmware.yml, runn
sign "patrol-a|vX.Y.Z|<sha256>" with secret BMW_NISSAN_FIRMWARE_SIGNING_KEY
release vX.Y.Z: firmware.bin + firmware.elf + manifest.txt
│ public repo, HTTPS, no token
Controller A `ota install` ◄──────┘ (parked, Wi-Fi joined)
Controller A Settings → Updates → Install ◄──┘ (or `ota install`; parked, Wi-Fi joined)
GET /api/v1/repos/art/ESP32-S3-Touch-LCD-5B/releases/latest → tag
GET /releases/download/<tag>/manifest.txt → verify signature FIRST
GET /releases/download/<tag>/firmware.bin → idle slot, hashed while streaming
@@ -24,7 +24,7 @@ Controller A `ota install` ◄──────┘ (parked, Wi-Fi joined)
new image PENDING_VERIFY → confirmed after 30 s uptime, else bootloader rolls back
```
**To release:** `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` — one push, one (tag) build: a `main` push skips itself when its commit already has a `v*` tag, and when it only changes `wiki/**` or `*.md` (checked inside the job, so a tag build is never skipped by a path filter).
**To release:** `git tag -a vX.Y.Z -m "..." && git push --follow-tags origin main` — a plain `git push` sends the commit but **not the tag**, so only `main-latest` gets built and the board keeps offering the previous release (happened with v0.1.5, 2026-09-27; fixed with `git push origin vX.Y.Z`) — one push, one (tag) build: a `main` push skips itself when its commit already has a `v*` tag, and when it only changes `wiki/**` or `*.md` (checked inside the job, so a tag build is never skipped by a path filter).
Push to `main` (no tag) builds a rolling **pre-release `main-latest`** — unsigned, no manifest, for bench/USB testing. `/releases/latest` skips pre-releases, so the car is never offered it `(repo)`.
@@ -36,17 +36,20 @@ Push to `main` (no tag) builds a rolling **pre-release `main-latest`** — unsig
| v0.1.1 → **v0.1.2**, into `app0` | ✅ slots alternate as designed |
| v0.1.2 → v0.1.2 (`ota install force`), attempt 1 | ❌ download aborted at 570 B — the loop treated a momentary TLS `connected()==false` as a drop. The **failure path worked**: aborted cleanly, "Update failed / still running v0.1.2" notice, stayed on v0.1.2 |
| same, attempt 2 | ✅ into `app1`, confirmed — first install run by the dark-screen code |
| **v0.1.3** (published 2026-09-26) | fixes the 570 B abort (a drop only counts after 2 s of silence); **not yet installed** — the board runs v0.1.2 |
| **v0.1.3** (published 2026-09-26) | fixes the 570 B abort (a drop only counts after 2 s of silence); installed, ran until 2026-09-27 |
| `dev` → **v0.1.4**, from the **screen** (2026-09-27) | ✅ first install driven by the user from Settings → Updates (Check → Install → confirm): dark ~1 min, restart, version label `A v0.1.4`. v0.1.4 still had the old Wi-Fi code, so it came back disconnected and the flickering dots returned — see [[esp32-s3-touch-lcd-5b]] |
| `dev` → **v0.1.5**, from the screen (2026-09-27) | ✅ user: "All good" — new Settings/Tuning screens, Wi-Fi rejoined by itself after the restart, no dots |
Always remember: an install is performed by the firmware that is **already running**, so a fix to the install path only takes effect on the update *after* the one that delivers it (v0.1.1 → v0.1.2 still flickered because v0.1.1 did the writing).
**Dark-screen writes (v0.1.2+).** Flash writes flicker the PSRAM-fed panel (cause below, and [[esp32-s3-touch-lcd-5b]]), so the backlight is off while the image is written: a full-screen notice "Updating to vX — the screen goes dark for about a minute — do not switch off" shows for 3 s first, then "Installed vX / Restarting…" or "Update failed / Still running vY". Ran for real on the forced reinstall; the user's visual confirmation of "no flicker" is still pending `(unverified)`. The running version is always shown bottom-right on every screen (`A v0.1.2`).
**Dark-screen writes (v0.1.2+).** Flash writes flicker the PSRAM-fed panel (cause below, and [[esp32-s3-touch-lcd-5b]]), so the backlight is off while the image is written: a full-screen notice "Updating to vX — the screen goes dark for about a minute — do not switch off" shows for 3 s first, then "Installed vX / Restarting…" or "Update failed / Still running vY". Seen by the user on the 2026-09-27 screen installs: dark for about a minute, then the restart. The running version is always shown bottom-right on every screen (`A v0.1.2`).
Known quirk: `ota status` shows the *other* slot's "built" date from the framework's precompiled app descriptor (e.g. "Nov 4 2025"), not our build time — ignore it.
## Decisions and why
- **Manual trigger only (decision, 2026-09-26).** An install ends in a reboot, which blanks Controller B's gauges; nothing checks or installs in the background. Today the trigger is the `ota` serial console; the intended home is the password-gated **Diagnostics screen** ([[open-questions]] #12), the same gate as active CAN polling.
- **Manual trigger only (decision, 2026-09-26).** An install ends in a reboot, which blanks Controller B's gauges; nothing checks or installs in the background.
- **On the Settings screen, behind a confirm dialog (decision, 2026-09-27)** — replacing the earlier plan to put it on the password-gated Diagnostics screen. Settings → Updates shows installed vs latest and a **Check for updates** button; **Install vX** appears only when the latest release differs and asks "Install vX? The screen goes dark for about a minute… only while parked". The user chose a confirm dialog over a PIN: the parked gate and the signature already guard the dangerous parts; a PIN can come with the Diagnostics screen ([[open-questions]] #12). The `ota` console stays for bench work and `rollback`.
- **Parked gate** `(repo)`: refused if engine rpm > 0 / run state running or starting, output shaft turning, or lever in a drive gear. A silent bus (>2 s no frames: ignition off, bench) counts as parked. Checked before the download **and again** before the slot switch. `ota check` is exempt (read-only).
- **HTTPS pull from a public repo (decision).** Both repos were made public 2026-09-26 so the device needs **no token** — the same reasoning as `parking_solution`'s public releases mirror: a read token in shipped firmware leaks with the device. History was scanned before/after going public: no secrets, no full VIN (only the 10-char prefix in ident logs), no SSIDs `(verified 2026-09-26)`.
- **Signed images (decision).** HTTPS only proves the file came from the server; the ECDSA P-256 signature proves it came from our CI key. The signed statement is `target|version|sha256`, so a Controller B image can't be installed on A even with a shared key, and the manifest version can't be swapped. The firmware contains no secrets, so public binaries are fine — **keep it that way**: the future Diagnostics-screen password must be a salted hash in NVS, never a literal in source.
@@ -83,9 +86,9 @@ SPIFFS (3.4 MB, unused by any code) was dropped. Firmware is ~1.65 MB (19.8 % of
| `ota install [force]` | full install; `force` reinstalls the same version |
| `ota rollback` | boot the other slot (or reject an unconfirmed image) — parked only |
Wi-Fi must be joined first — `wifi join <ssid> [pass]` on the console (`wifi status`, `wifi off`), or the Settings screen. **Do not install `v0.1.0`**: it predates the loop-task/PSRAM-TLS fix, so once installed it can't run OTA again (it boots fine, so rollback won't save it — USB only). Joining an AP moves the radio channel; the ESP-NOW link to B follows it (B hops). `diag raw off` first keeps CANRAW from burying the progress lines.
Wi-Fi must be joined first — Settings → Wi-Fi (remembered from then on) or `wifi join <ssid> [pass]` on the console (`wifi status | forget | scan | on | off`). **Do not install `v0.1.0`**: it predates the loop-task/PSRAM-TLS fix, so once installed it can't run OTA again (it boots fine, so rollback won't save it — USB only). Joining an AP moves the radio channel; the ESP-NOW link to B follows it (B hops). `diag raw off` first keeps CANRAW from burying the progress lines.
- **Wi-Fi does not survive a reboot** — every boot (including the one that ends an update) needs a new `wifi join`; remembering the network is future work ([[open-questions]] #14).
- **Wi-Fi is remembered (v0.1.5+)**: one network, saved after a successful join, rejoined ~3 s after boot — including the boot that ends an update `(verified 2026-09-27)`. Before v0.1.5 every boot needed a new join.
- **Open the console without resetting the board**: `pio device monitor -p COM10 -b 115200 --dtr 0 --rts 0 --echo` (pio lives at `%USERPROFILE%\.platformio\penv\Scripts\pio.exe`). Opening the port with default DTR/RTS resets it (`rst:0x15 USB_UART_CHIP_RESET`), which drops the Wi-Fi join `(verified 2026-09-26)`.
- **Flicker cause** `(verified 2026-09-26)`: flash and PSRAM share the MSPI cache; every flash write stalls the PSRAM framebuffer the RGB panel streams from (no bounce buffer). Hence the dark screen above.
@@ -99,7 +102,7 @@ Wi-Fi must be joined first — `wifi join <ssid> [pass]` on the console (`wifi s
- **Settings Wi-Fi switch was disabled since the first SquareLine export** (`LV_STATE_DISABLED`) — the Wi-Fi UI had never worked. Re-enabled at runtime in `UIStateManager` (survives re-exports; untick "Disabled" in the SquareLine project too).
- **Joining Wi-Fi killed ESP-NOW**: the Wi-Fi task used `WiFi.disconnect(true)` (true = radio off), which drops ESP-NOW; B then ran on the wire only. Now `WiFi.disconnect()`, and `EspNowLink::send()` re-initialises ESP-NOW if the driver ever drops it. Verified: joined Personal1 (channel 9), ESP-NOW 195 sent / 0 failed.
- `showConnectionResult()` took the LVGL lock with a 0 ms try-lock, ignored the result, and touched widgets that are NULL off the Settings screen — now waits for the lock and null-checks. It still shows **no success feedback** on screen; the Wi-Fi UI needs a redesign (user: "a disaster UX").
- `showConnectionResult()` took the LVGL lock with a 0 ms try-lock, ignored the result, and touched widgets that are NULL off the Settings screen — now waits for the lock and null-checks. It still showed **no success feedback** on screen (user: "a disaster UX") — resolved by the hand-coded Settings screen in v0.1.5 ([[open-questions]] #14).
## Controller B (not built yet)