Gauge screen: round-panel layout with warning ring (red blink on alerts, amber on cooling), whole-degree values, Wi-Fi and link tell-tales
Firmware / build (push) Successful in 3m0s
Firmware / build (push) Successful in 3m0s
This commit is contained in:
@@ -65,7 +65,7 @@ include/
|
|||||||
|
|
||||||
**DisplayInit** — `init()`, `update()`, `lock(timeout_ms)` / `unlock()`, `setBrightness(0–255)`, `getBrightness()`. Default brightness 128. `DISPLAY_RADIUS 120` defines the circular mask.
|
**DisplayInit** — `init()`, `update()`, `lock(timeout_ms)` / `unlock()`, `setBrightness(0–255)`, `getBrightness()`. Default brightness 128. `DISPLAY_RADIUS 120` defines the circular mask.
|
||||||
|
|
||||||
**GaugeScreen** — `init()` builds and loads the screen once; `update(data, link_ok)` at 5 Hz writes a label, colour or icon **only when it changed** (`lv_label_set_text()` and style setters invalidate even for identical values, and every redraw is SPI time). Gear label: engaged gear, or the target gear pulsing while `target != engaged`, red on the mismatch alert; icons red from A's alert bits; everything N/A when the link is lost.
|
**GaugeScreen** (round-panel layout 2026-09-27: 6 px warning-lamp ring at the rim - dim / RED BLINKING 2 Hz on any red alert / amber on gearbox cooling; coolant top-left and gearbox top-right as [icon][whole degrees]; gear 110 px centre; battery [icon][12.4] bottom; Wi-Fi tell-tale at 9 o'clock (green while joined for an update, dim otherwise), red `!` at 3 o'clock when the link is lost; every element placed absolutely inside the circle) — `init()` builds and loads the screen once; `setNotice(text)` shows the updater's progress line; `update(data, link_ok)` at 5 Hz writes a label, colour or icon **only when it changed** (`lv_label_set_text()` and style setters invalidate even for identical values, and every redraw is SPI time). Gear label: engaged gear, or the target gear pulsing while `target != engaged`, red on the mismatch alert; icons red from A's alert bits; everything N/A when the link is lost.
|
||||||
|
|
||||||
**UARTReceiver** — `init()`, `processFrame(frame, len, source)`, `getLatestData()`, `getStats()` (applied / per-transport / duplicate / config counts, checksum / framing / version errors, last times), `isConnected()`, `isSourceAlive(source)`, `getConfig()` + `getConfigSeq()`. Link lost after 1000 ms without an applied DATA frame on any transport.
|
**UARTReceiver** — `init()`, `processFrame(frame, len, source)`, `getLatestData()`, `getStats()` (applied / per-transport / duplicate / config counts, checksum / framing / version errors, last times), `isConnected()`, `isSourceAlive(source)`, `getConfig()` + `getConfigSeq()`. Link lost after 1000 ms without an applied DATA frame on any transport.
|
||||||
|
|
||||||
|
|||||||
+163
-66
@@ -1,38 +1,69 @@
|
|||||||
/*
|
/*
|
||||||
* Gauge Screen implementation. See gauge_screen.h.
|
* Gauge Screen implementation. See gauge_screen.h.
|
||||||
|
*
|
||||||
|
* Layout for the ROUND 240x240 panel (2026-09-27 redesign). Everything is
|
||||||
|
* positioned absolutely, inside the circle:
|
||||||
|
*
|
||||||
|
* [wifi] coolant gearbox [link]
|
||||||
|
* o [icon] 89 92 [icon] !
|
||||||
|
* D3 (110 px)
|
||||||
|
* [batt] 12.4
|
||||||
|
*
|
||||||
|
* - outer ring, 6 px: dim normally, RED BLINKING while a red alert is on,
|
||||||
|
* amber while the gearbox asks for cooling. A warning lamp for the whole
|
||||||
|
* display - the driver sees it without reading anything.
|
||||||
|
* - the affected value turns red as well (icon + digits).
|
||||||
|
* - temperatures as whole degrees, battery to a tenth: fewer, bigger digits.
|
||||||
|
* - tell-tales at 3 and 9 o'clock: Wi-Fi (bright while joined for an
|
||||||
|
* update, dim otherwise) and a red "!" when the link to A is lost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "modules/gauge_screen.h"
|
#include "modules/gauge_screen.h"
|
||||||
#include "modules/display_init.h"
|
#include "modules/display_init.h"
|
||||||
#include "assets/assets.h"
|
#include "assets/assets.h"
|
||||||
#include <lvgl.h>
|
#include <lvgl.h>
|
||||||
|
#include <WiFi.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
namespace GaugeScreen {
|
namespace GaugeScreen {
|
||||||
|
|
||||||
// A shift pulse is shown for at least this long, so a fast shift still blinks
|
// A shift pulse is shown for at least this long, so a fast shift still blinks
|
||||||
#define SHIFT_PULSE_MIN_MS 600
|
#define SHIFT_PULSE_MIN_MS 600
|
||||||
|
#define BLINK_MS 500
|
||||||
|
|
||||||
static const lv_color_t COL_ALERT = lv_color_hex(0xFF3B30);
|
static const lv_color_t COL_TEXT = lv_color_hex(0xE8EDF2);
|
||||||
|
static const lv_color_t COL_MUTED = lv_color_hex(0x3A4450);
|
||||||
|
static const lv_color_t COL_ALERT = lv_color_hex(0xFF3B30);
|
||||||
|
static const lv_color_t COL_ALERT2 = lv_color_hex(0x7A1410); // blink low phase
|
||||||
|
static const lv_color_t COL_AMBER = lv_color_hex(0xF5A524);
|
||||||
|
static const lv_color_t COL_RING = lv_color_hex(0x2A323C);
|
||||||
|
static const lv_color_t COL_OK = lv_color_hex(0x3DD68C);
|
||||||
|
|
||||||
// ---- one value cell: label + normal/red icon pair --------------------------
|
// ---- one value unit: icon + digits side by side ------------------------------
|
||||||
struct Cell {
|
struct Cell {
|
||||||
lv_obj_t* cont;
|
lv_obj_t* cont;
|
||||||
lv_obj_t* lbl;
|
lv_obj_t* lbl;
|
||||||
lv_obj_t* icon;
|
lv_obj_t* icon;
|
||||||
lv_obj_t* icon_red;
|
lv_obj_t* icon_red;
|
||||||
int8_t shown; // -1 none, 0 normal icon, 1 red icon
|
int8_t shown; // -1 none, 0 normal icon, 1 red icon
|
||||||
|
bool red; // digits red
|
||||||
};
|
};
|
||||||
|
|
||||||
static lv_obj_t* g_screen = NULL;
|
static lv_obj_t* g_screen = NULL;
|
||||||
|
static lv_obj_t* g_ring = NULL;
|
||||||
|
static lv_obj_t* g_wifi_tt = NULL;
|
||||||
|
static lv_obj_t* g_link_tt = NULL;
|
||||||
static lv_obj_t* g_notice = NULL; // on lv_layer_top(): update progress line
|
static lv_obj_t* g_notice = NULL; // on lv_layer_top(): update progress line
|
||||||
static Cell g_coolant = {0};
|
static Cell g_coolant = {0};
|
||||||
static Cell g_gearbox = {0};
|
static Cell g_gearbox = {0};
|
||||||
static Cell g_battery = {0};
|
static Cell g_battery = {0};
|
||||||
static lv_obj_t* g_gear_lbl = NULL;
|
static lv_obj_t* g_gear_lbl = NULL;
|
||||||
static lv_color_t g_gear_col_default;
|
|
||||||
static bool g_gear_red = false;
|
static bool g_gear_red = false;
|
||||||
|
|
||||||
|
static lv_color_t g_ring_col;
|
||||||
|
static bool g_wifi_bright = false;
|
||||||
|
static bool g_link_lost_shown = false;
|
||||||
|
|
||||||
// gear pulse
|
// gear pulse
|
||||||
static lv_anim_t g_gear_anim;
|
static lv_anim_t g_gear_anim;
|
||||||
static bool g_gear_pulsing = false;
|
static bool g_gear_pulsing = false;
|
||||||
@@ -40,7 +71,6 @@ static uint32_t g_gear_pulse_started = 0;
|
|||||||
|
|
||||||
// ---- helpers ---------------------------------------------------------------
|
// ---- helpers ---------------------------------------------------------------
|
||||||
|
|
||||||
/** lv_label_set_text() only when the text differs. */
|
|
||||||
static void setText(lv_obj_t* lbl, const char* text) {
|
static void setText(lv_obj_t* lbl, const char* text) {
|
||||||
if (lbl == NULL) return;
|
if (lbl == NULL) return;
|
||||||
const char* cur = lv_label_get_text(lbl);
|
const char* cur = lv_label_get_text(lbl);
|
||||||
@@ -48,30 +78,41 @@ static void setText(lv_obj_t* lbl, const char* text) {
|
|||||||
lv_label_set_text(lbl, text);
|
lv_label_set_text(lbl, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Show the normal icon, the red icon, or neither - touching objects only on change. */
|
static void setTextColour(lv_obj_t* lbl, lv_color_t c) {
|
||||||
static void setIcon(Cell& c, bool visible, bool red) {
|
if (lv_color_to32(lv_obj_get_style_text_color(lbl, 0)) != lv_color_to32(c))
|
||||||
int8_t want = !visible ? -1 : (red ? 1 : 0);
|
lv_obj_set_style_text_color(lbl, c, 0);
|
||||||
if (want == c.shown) return;
|
|
||||||
c.shown = want;
|
|
||||||
if (want == 0) lv_obj_clear_flag(c.icon, LV_OBJ_FLAG_HIDDEN); else lv_obj_add_flag(c.icon, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
if (want == 1) lv_obj_clear_flag(c.icon_red, LV_OBJ_FLAG_HIDDEN); else lv_obj_add_flag(c.icon_red, LV_OBJ_FLAG_HIDDEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t* makeContainer(lv_obj_t* parent, lv_coord_t w, lv_coord_t h, lv_flex_flow_t flow,
|
static void setIcon(Cell& c, bool visible, bool red) {
|
||||||
lv_flex_align_t main_place, lv_flex_align_t cross_place) {
|
int8_t want = !visible ? -1 : (red ? 1 : 0);
|
||||||
|
if (want != c.shown) {
|
||||||
|
c.shown = want;
|
||||||
|
if (want == 0) lv_obj_clear_flag(c.icon, LV_OBJ_FLAG_HIDDEN); else lv_obj_add_flag(c.icon, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
if (want == 1) lv_obj_clear_flag(c.icon_red, LV_OBJ_FLAG_HIDDEN); else lv_obj_add_flag(c.icon_red, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
bool want_red = visible && red;
|
||||||
|
if (want_red != c.red) {
|
||||||
|
c.red = want_red;
|
||||||
|
setTextColour(c.lbl, want_red ? COL_ALERT : COL_TEXT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static lv_obj_t* makeBox(lv_obj_t* parent, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h) {
|
||||||
lv_obj_t* o = lv_obj_create(parent);
|
lv_obj_t* o = lv_obj_create(parent);
|
||||||
lv_obj_remove_style_all(o);
|
lv_obj_remove_style_all(o);
|
||||||
|
lv_obj_set_pos(o, x, y);
|
||||||
lv_obj_set_size(o, w, h);
|
lv_obj_set_size(o, w, h);
|
||||||
lv_obj_set_flex_flow(o, flow);
|
lv_obj_set_flex_flow(o, LV_FLEX_FLOW_ROW);
|
||||||
lv_obj_set_flex_align(o, main_place, cross_place, cross_place);
|
lv_obj_set_flex_align(o, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
lv_obj_clear_flag(o, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(o, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_obj_t* makeValueLabel(lv_obj_t* parent) {
|
static lv_obj_t* makeValueLabel(lv_obj_t* parent) {
|
||||||
lv_obj_t* l = lv_label_create(parent);
|
lv_obj_t* l = lv_label_create(parent);
|
||||||
lv_label_set_text(l, "---");
|
lv_label_set_text(l, "--");
|
||||||
lv_obj_set_style_text_font(l, &ui_font_UbuntuLight_35, 0);
|
lv_obj_set_style_text_font(l, &ui_font_UbuntuLight_35, 0);
|
||||||
|
lv_obj_set_style_text_color(l, COL_TEXT, 0);
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,25 +124,20 @@ static lv_obj_t* makeIcon(lv_obj_t* parent, const lv_img_dsc_t* src) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** icon_first: [icon][value]; otherwise [value][icon]. The two icons overlay each other. */
|
||||||
* A cell: 112x80, column. icon_above=false puts the value on top and the icon
|
static void makeCell(Cell& c, lv_obj_t* parent, lv_coord_t x, lv_coord_t y, lv_coord_t w,
|
||||||
* under it (top row); icon_above=true puts the icon on top (bottom row), as
|
const lv_img_dsc_t* icon, const lv_img_dsc_t* icon_red, bool icon_first) {
|
||||||
* the original screen did.
|
c.cont = makeBox(parent, x, y, w, 44);
|
||||||
*/
|
lv_obj_t* icons = lv_obj_create(c.cont); // 50x44 slot holding both icon variants
|
||||||
static void makeCell(Cell& c, lv_obj_t* parent, const lv_img_dsc_t* icon, const lv_img_dsc_t* icon_red,
|
lv_obj_remove_style_all(icons);
|
||||||
lv_flex_align_t cross, bool icon_above) {
|
lv_obj_set_size(icons, 50, 44);
|
||||||
c.cont = makeContainer(parent, 112, icon_above ? 85 : 80, LV_FLEX_FLOW_COLUMN,
|
lv_obj_clear_flag(icons, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
||||||
icon_above ? LV_FLEX_ALIGN_SPACE_BETWEEN : LV_FLEX_ALIGN_START, cross);
|
c.icon_red = makeIcon(icons, icon_red);
|
||||||
if (icon_above) {
|
c.icon = makeIcon(icons, icon);
|
||||||
c.icon_red = makeIcon(c.cont, icon_red);
|
c.lbl = makeValueLabel(c.cont);
|
||||||
c.icon = makeIcon(c.cont, icon);
|
if (!icon_first) lv_obj_move_to_index(c.lbl, 0);
|
||||||
c.lbl = makeValueLabel(c.cont);
|
|
||||||
} else {
|
|
||||||
c.lbl = makeValueLabel(c.cont);
|
|
||||||
c.icon_red = makeIcon(c.cont, icon_red);
|
|
||||||
c.icon = makeIcon(c.cont, icon);
|
|
||||||
}
|
|
||||||
c.shown = -1;
|
c.shown = -1;
|
||||||
|
c.red = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- gear pulse --------------------------------------------------------------
|
// ---- gear pulse --------------------------------------------------------------
|
||||||
@@ -134,14 +170,9 @@ static void stopGearPulse() {
|
|||||||
static void setGearColour(bool red) {
|
static void setGearColour(bool red) {
|
||||||
if (red == g_gear_red) return;
|
if (red == g_gear_red) return;
|
||||||
g_gear_red = red;
|
g_gear_red = red;
|
||||||
lv_obj_set_style_text_color(g_gear_lbl, red ? COL_ALERT : g_gear_col_default, 0);
|
lv_obj_set_style_text_color(g_gear_lbl, red ? COL_ALERT : COL_TEXT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gear label from lever + target/engaged nibbles. While target != engaged the
|
|
||||||
* TARGET digit is shown and the label pulses; once they agree it goes solid on
|
|
||||||
* the engaged gear. Red on the gear-mismatch alert.
|
|
||||||
*/
|
|
||||||
static void updateGear(const automotive_data_t& d, bool valid) {
|
static void updateGear(const automotive_data_t& d, bool valid) {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
stopGearPulse();
|
stopGearPulse();
|
||||||
@@ -170,6 +201,40 @@ static void updateGear(const automotive_data_t& d, bool valid) {
|
|||||||
setGearColour(mismatch);
|
setGearColour(mismatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- ring + tell-tales -------------------------------------------------------
|
||||||
|
|
||||||
|
static void setRing(lv_color_t c) {
|
||||||
|
if (lv_color_to32(c) == lv_color_to32(g_ring_col)) return;
|
||||||
|
g_ring_col = c;
|
||||||
|
lv_obj_set_style_border_color(g_ring, c, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void updateRing(uint16_t alerts, bool alerts_valid) {
|
||||||
|
if (!alerts_valid) { setRing(COL_RING); return; }
|
||||||
|
if (alerts & ALERTS_RED) {
|
||||||
|
bool hi = (millis() / BLINK_MS) & 1;
|
||||||
|
setRing(hi ? COL_ALERT : COL_ALERT2);
|
||||||
|
} else if (alerts & ALERTS_AMBER) {
|
||||||
|
setRing(COL_AMBER);
|
||||||
|
} else {
|
||||||
|
setRing(COL_RING);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void updateTellTales(bool link_ok) {
|
||||||
|
bool joined = WiFi.status() == WL_CONNECTED;
|
||||||
|
if (joined != g_wifi_bright) {
|
||||||
|
g_wifi_bright = joined;
|
||||||
|
lv_obj_set_style_text_color(g_wifi_tt, joined ? COL_OK : COL_MUTED, 0);
|
||||||
|
}
|
||||||
|
bool lost = !link_ok;
|
||||||
|
if (lost != g_link_lost_shown) {
|
||||||
|
g_link_lost_shown = lost;
|
||||||
|
if (lost) lv_obj_clear_flag(g_link_tt, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
else lv_obj_add_flag(g_link_tt, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---- public -----------------------------------------------------------------
|
// ---- public -----------------------------------------------------------------
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
@@ -178,24 +243,49 @@ void init() {
|
|||||||
|
|
||||||
g_screen = lv_obj_create(NULL);
|
g_screen = lv_obj_create(NULL);
|
||||||
lv_obj_clear_flag(g_screen, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(g_screen, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
lv_obj_set_flex_flow(g_screen, LV_FLEX_FLOW_COLUMN);
|
lv_obj_set_style_bg_color(g_screen, lv_color_black(), 0);
|
||||||
lv_obj_set_flex_align(g_screen, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
|
||||||
|
|
||||||
// top row: coolant (left, contents left-aligned) | gearbox oil (right, contents right-aligned)
|
// Warning-lamp ring at the rim (6 px; the panel's round mask trims the corners)
|
||||||
lv_obj_t* top = makeContainer(g_screen, 230, 80, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_SPACE_BETWEEN, LV_FLEX_ALIGN_START);
|
g_ring = lv_obj_create(g_screen);
|
||||||
makeCell(g_coolant, top, &ui_img_enginetemp_png, &ui_img_enginetempred_png, LV_FLEX_ALIGN_START, false);
|
lv_obj_remove_style_all(g_ring);
|
||||||
makeCell(g_gearbox, top, &ui_img_gearboxoiltemp_png, &ui_img_gearboxoiltempred_png, LV_FLEX_ALIGN_END, false);
|
lv_obj_set_pos(g_ring, 0, 0);
|
||||||
|
lv_obj_set_size(g_ring, 240, 240);
|
||||||
|
lv_obj_set_style_radius(g_ring, LV_RADIUS_CIRCLE, 0);
|
||||||
|
lv_obj_set_style_border_width(g_ring, 6, 0);
|
||||||
|
lv_obj_set_style_border_color(g_ring, COL_RING, 0);
|
||||||
|
lv_obj_set_style_border_opa(g_ring, LV_OPA_COVER, 0);
|
||||||
|
lv_obj_clear_flag(g_ring, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE);
|
||||||
|
g_ring_col = COL_RING;
|
||||||
|
|
||||||
// middle: the gear
|
// top-left: coolant [icon][value]; top-right: gearbox oil [value][icon]
|
||||||
lv_obj_t* mid = makeContainer(g_screen, 115, 100, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
makeCell(g_coolant, g_screen, 28, 46, 92, &ui_img_enginetemp_png, &ui_img_enginetempred_png, true);
|
||||||
g_gear_lbl = lv_label_create(mid);
|
makeCell(g_gearbox, g_screen, 120, 46, 92, &ui_img_gearboxoiltemp_png, &ui_img_gearboxoiltempred_png, false);
|
||||||
|
|
||||||
|
// centre: the gear (Ubuntu Bold 110: line 110, baseline 21 -> ink roughly y 94..174 at this offset)
|
||||||
|
g_gear_lbl = lv_label_create(g_screen);
|
||||||
lv_label_set_text(g_gear_lbl, "?");
|
lv_label_set_text(g_gear_lbl, "?");
|
||||||
lv_obj_set_style_text_font(g_gear_lbl, &ui_font_UbuntuBold_110, 0);
|
lv_obj_set_style_text_font(g_gear_lbl, &ui_font_UbuntuBold_110, 0);
|
||||||
g_gear_col_default = lv_obj_get_style_text_color(g_gear_lbl, 0);
|
lv_obj_set_style_text_color(g_gear_lbl, COL_TEXT, 0);
|
||||||
|
lv_obj_align(g_gear_lbl, LV_ALIGN_CENTER, 0, 20);
|
||||||
|
|
||||||
// bottom row: battery, centred (the engine-oil cell that used to sit beside it is gone)
|
// bottom: battery [icon][value], centred
|
||||||
lv_obj_t* bottom = makeContainer(g_screen, 230, 85, LV_FLEX_FLOW_ROW, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_END);
|
makeCell(g_battery, g_screen, 55, 176, 130, &ui_img_batteryvoltage_png, &ui_img_batteryvoltagered_png, true);
|
||||||
makeCell(g_battery, bottom, &ui_img_batteryvoltage_png, &ui_img_batteryvoltagered_png, LV_FLEX_ALIGN_CENTER, true);
|
lv_obj_set_flex_align(g_battery.cont, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||||
|
lv_obj_set_style_pad_column(g_battery.cont, 8, 0);
|
||||||
|
|
||||||
|
// tell-tales at 9 and 3 o'clock
|
||||||
|
g_wifi_tt = lv_label_create(g_screen);
|
||||||
|
lv_label_set_text(g_wifi_tt, LV_SYMBOL_WIFI);
|
||||||
|
lv_obj_set_style_text_font(g_wifi_tt, &lv_font_montserrat_14, 0);
|
||||||
|
lv_obj_set_style_text_color(g_wifi_tt, COL_MUTED, 0);
|
||||||
|
lv_obj_align(g_wifi_tt, LV_ALIGN_LEFT_MID, 12, 0);
|
||||||
|
|
||||||
|
g_link_tt = lv_label_create(g_screen);
|
||||||
|
lv_label_set_text(g_link_tt, LV_SYMBOL_WARNING);
|
||||||
|
lv_obj_set_style_text_font(g_link_tt, &lv_font_montserrat_14, 0);
|
||||||
|
lv_obj_set_style_text_color(g_link_tt, COL_ALERT, 0);
|
||||||
|
lv_obj_align(g_link_tt, LV_ALIGN_RIGHT_MID, -12, 0);
|
||||||
|
lv_obj_add_flag(g_link_tt, LV_OBJ_FLAG_HIDDEN);
|
||||||
|
|
||||||
// Notice line for the updater: a dark pill low on the round panel, hidden until used.
|
// Notice line for the updater: a dark pill low on the round panel, hidden until used.
|
||||||
g_notice = lv_label_create(lv_layer_top());
|
g_notice = lv_label_create(lv_layer_top());
|
||||||
@@ -211,7 +301,7 @@ void init() {
|
|||||||
|
|
||||||
lv_scr_load(g_screen);
|
lv_scr_load(g_screen);
|
||||||
DisplayInit::unlock();
|
DisplayInit::unlock();
|
||||||
Serial.println("[GaugeScreen] built (coolant, gearbox oil, gear, battery)");
|
Serial.println("[GaugeScreen] built (ring, coolant, gearbox oil, gear, battery, tell-tales)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNotice(const char* text) {
|
void setNotice(const char* text) {
|
||||||
@@ -231,14 +321,17 @@ void update(const automotive_data_t& d, bool link_ok) {
|
|||||||
if (g_screen == NULL) return;
|
if (g_screen == NULL) return;
|
||||||
if (!DisplayInit::lock(50)) return; // never stall the loop on a busy renderer
|
if (!DisplayInit::lock(50)) return; // never stall the loop on a busy renderer
|
||||||
|
|
||||||
|
updateTellTales(link_ok);
|
||||||
|
|
||||||
if (!link_ok) {
|
if (!link_ok) {
|
||||||
setText(g_coolant.lbl, "N/A");
|
setText(g_coolant.lbl, "--");
|
||||||
setText(g_gearbox.lbl, "N/A");
|
setText(g_gearbox.lbl, "--");
|
||||||
setText(g_battery.lbl, "N/A");
|
setText(g_battery.lbl, "--");
|
||||||
setIcon(g_coolant, false, false);
|
setIcon(g_coolant, true, false);
|
||||||
setIcon(g_gearbox, false, false);
|
setIcon(g_gearbox, true, false);
|
||||||
setIcon(g_battery, false, false);
|
setIcon(g_battery, true, false);
|
||||||
updateGear(d, false);
|
updateGear(d, false);
|
||||||
|
updateRing(0, false);
|
||||||
DisplayInit::unlock();
|
DisplayInit::unlock();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -248,18 +341,22 @@ void update(const automotive_data_t& d, bool link_ok) {
|
|||||||
uint16_t alerts = alerts_valid ? d.alerts : 0;
|
uint16_t alerts = alerts_valid ? d.alerts : 0;
|
||||||
|
|
||||||
bool coolant_valid = (d.valid_flags & VALID_FLAG_COOLANT_TEMP) != 0;
|
bool coolant_valid = (d.valid_flags & VALID_FLAG_COOLANT_TEMP) != 0;
|
||||||
setText(g_coolant.lbl, coolant_valid ? format_temperature(d.coolant_temp, buf) : "---");
|
if (coolant_valid) snprintf(buf, sizeof(buf), "%d", d.coolant_temp / 10);
|
||||||
setIcon(g_coolant, coolant_valid, (alerts & ALERT_COOLANT_HOT) != 0);
|
setText(g_coolant.lbl, coolant_valid ? buf : "--");
|
||||||
|
setIcon(g_coolant, true, (alerts & ALERT_COOLANT_HOT) != 0);
|
||||||
|
|
||||||
bool gearbox_valid = (d.valid_flags & VALID_FLAG_GEARBOX_TEMP) != 0;
|
bool gearbox_valid = (d.valid_flags & VALID_FLAG_GEARBOX_TEMP) != 0;
|
||||||
setText(g_gearbox.lbl, gearbox_valid ? format_temperature(d.gearbox_oil_temp, buf) : "---");
|
if (gearbox_valid) snprintf(buf, sizeof(buf), "%d", d.gearbox_oil_temp / 10);
|
||||||
setIcon(g_gearbox, gearbox_valid, (alerts & (ALERT_GEARBOX_HOT | ALERT_GEARBOX_COOLING)) != 0);
|
setText(g_gearbox.lbl, gearbox_valid ? buf : "--");
|
||||||
|
setIcon(g_gearbox, true, (alerts & (ALERT_GEARBOX_HOT | ALERT_GEARBOX_COOLING)) != 0);
|
||||||
|
|
||||||
bool battery_valid = (d.valid_flags & VALID_FLAG_BATTERY_VOLT) != 0;
|
bool battery_valid = (d.valid_flags & VALID_FLAG_BATTERY_VOLT) != 0;
|
||||||
setText(g_battery.lbl, battery_valid ? format_voltage(d.battery_voltage, buf) : "---");
|
if (battery_valid) snprintf(buf, sizeof(buf), "%d.%d", d.battery_voltage / 100, (d.battery_voltage % 100) / 10);
|
||||||
setIcon(g_battery, battery_valid, (alerts & ALERT_BATTERY_LOW) != 0);
|
setText(g_battery.lbl, battery_valid ? buf : "--");
|
||||||
|
setIcon(g_battery, true, (alerts & ALERT_BATTERY_LOW) != 0);
|
||||||
|
|
||||||
updateGear(d, (d.valid_flags & VALID_FLAG_GEAR_POS) != 0);
|
updateGear(d, (d.valid_flags & VALID_FLAG_GEAR_POS) != 0);
|
||||||
|
updateRing(alerts, alerts_valid);
|
||||||
|
|
||||||
DisplayInit::unlock();
|
DisplayInit::unlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,3 +70,7 @@ Implemented the [[controller-b-ota]] design end to end. Shared header: `STATUS`
|
|||||||
## [2026-09-27] verify | Controller B updated over the air from A: dev → v0.1.0, end to end
|
## [2026-09-27] verify | Controller B updated over the air from A: dev → v0.1.0, end to end
|
||||||
|
|
||||||
User connected `485_A → IO1` (ground via the USB hub). B had rebooted on plug-in (A's card flipped to "not heard" for 15 s) and logged checksum-error bursts, but `uart alive` with good frames. `link pair` on A: PAIR ×3 over the wire, B `PAIRED ... fingerprint A9B7`, A `Controller B confirmed pairing` in < 5 s, then A pushed the `ArtServis` credentials by itself and B stored them. `link ota check` before the release existed: B joined the AP in ~2 s, got 404 → "no release published yet", reported to A as *failed* + reason (truncated to 32 chars), left Wi-Fi, re-locked on channel 1. CI: B's `main-latest` built in < 3 min; the `v0.1.0` tag build took ~12 min but published `firmware.bin` 1,248,432 B + `manifest.txt` (target patrol-b, sha256 `3c33d20f…3415`, ECDSA sig). `link ota check` → `update available, latest v0.1.0`; `link ota install` → download + flash to app1 in ~50 s with 0/10/…/100 % on B's console, `verified and installed v0.1.0`, reboot, `Firmware v0.1.0` banner, STATUS to A resumed, `confirmed - rollback cancelled` at 30 s, `ota status` slot app1 valid. Heap 230 KB before/after, loop stack headroom 3.4 KB. Not yet eyeballed: the Updates-page buttons on A and the progress line on B's screen (same code path as the console). Wiki [[controller-b-ota]] verification table and risks updated, [[open-questions]] #12 answered.
|
User connected `485_A → IO1` (ground via the USB hub). B had rebooted on plug-in (A's card flipped to "not heard" for 15 s) and logged checksum-error bursts, but `uart alive` with good frames. `link pair` on A: PAIR ×3 over the wire, B `PAIRED ... fingerprint A9B7`, A `Controller B confirmed pairing` in < 5 s, then A pushed the `ArtServis` credentials by itself and B stored them. `link ota check` before the release existed: B joined the AP in ~2 s, got 404 → "no release published yet", reported to A as *failed* + reason (truncated to 32 chars), left Wi-Fi, re-locked on channel 1. CI: B's `main-latest` built in < 3 min; the `v0.1.0` tag build took ~12 min but published `firmware.bin` 1,248,432 B + `manifest.txt` (target patrol-b, sha256 `3c33d20f…3415`, ECDSA sig). `link ota check` → `update available, latest v0.1.0`; `link ota install` → download + flash to app1 in ~50 s with 0/10/…/100 % on B's console, `verified and installed v0.1.0`, reboot, `Firmware v0.1.0` banner, STATUS to A resumed, `confirmed - rollback cancelled` at 30 s, `ota status` slot app1 valid. Heap 230 KB before/after, loop stack headroom 3.4 KB. Not yet eyeballed: the Updates-page buttons on A and the progress line on B's screen (same code path as the console). Wiki [[controller-b-ota]] verification table and risks updated, [[open-questions]] #12 answered.
|
||||||
|
|
||||||
|
## [2026-09-27] update | Round-panel redesign of B's screen: warning ring, tell-tales, whole-degree values
|
||||||
|
|
||||||
|
User asked for an automotive look, a Wi-Fi indicator and a sense of urgency on crossed thresholds. `gauge_screen.cpp` rebuilt for the circle: a 6 px ring at the rim acts as a warning lamp (dim; red blinking at 2 Hz while any red alert bit is set; amber while the gearbox asks for cooling), the affected value's digits and icon go red, temperatures show whole degrees and the battery a tenth (fewer, bigger digits), coolant/gearbox sit at 10 and 2 o'clock as icon + digits, the 110 px gear stays in the centre, battery centred low; tell-tales at 9 o'clock (Wi-Fi: green only while joined for an update) and 3 o'clock (red `!` when the link to A is lost). Everything is positioned absolutely inside the circle - the old flex column overflowed 240 px, so the battery digits sat partly off-panel. Built and flashed COM13; the user has not yet looked at it. The bench cannot show an alert (A's alerts come from CAN frames only), so the ring/red-value path is untested until the car.
|
||||||
|
|||||||
Reference in New Issue
Block a user