Remove the deep-sleep feature entirely (user decision): power manager, Settings switch, NVS key, sleep bit in the shared header, wiki page and cheat-sheet entries
Firmware / build (push) Successful in 6m59s
Firmware / build (push) Successful in 6m59s
This commit is contained in:
@@ -20,7 +20,6 @@ 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]] — Main CTRL → UART1 + ESP-NOW, protocol v2 → Inst. Cluster (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
|
||||
- [[sleep-when-parked]] — **2026-09-28**: one Settings switch puts both controllers into deep sleep 60 s after the CAN bus goes quiet; Main CTRL wakes on CAN RX (GPIO 16), Inst. Cluster on the UART wire or a 60 s probe boot; bit 7 of `out_enable` carries the switch to B
|
||||
- [[ota-updates]] — **Main CTRL 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; **Inst. Cluster card on the Updates page (2026-09-27)**: B pulls its own release, A pairs over the wire (`link pair`), hands over credentials in encrypted frames and triggers - details in B's wiki `controller-b-ota`
|
||||
|
||||
## Synthesis
|
||||
|
||||
@@ -214,3 +214,7 @@ User: "if there is no info from CAN bus, no values should be shown". Until now `
|
||||
## [2026-09-28] update | Boards renamed Main CTRL / Inst. Cluster; "Sleep when the car is off" switch
|
||||
|
||||
User renamed Controller A → **Main CTRL** and Controller B → **Inst. Cluster** across both repos (comments, UI text, workflow names, wiki) and reworded the Updates page; committed here together with the sleep feature. New `power_manager.cpp` + Settings → System switch (NVS `sleep_en`, default OFF), see [[sleep-when-parked]]: deep sleep after 60 s of quiet CAN bus + idle touch + no update job, wake on CAN RX GPIO 16 (ext0, pull-up, TWAI stopped first). The switch travels to the Inst. Cluster as bit 7 of `out_enable` in CONFIG (no version bump). Console `sleep status | on | off | now`. Bench lesson the same evening: the switch was turned on with CAN on and no bus, so the Main CTRL slept a minute later and its USB-CDC port vanished (a deep-sleeping S3 has no USB) - only the reset button or a power cycle brings it back; touching the screen within the minute keeps it awake. Inst. Cluster side verified (see its log): sleep at 60 s of link silence, timer wake after exactly 60 s, 4 s probe with the panel dark, sleep again.
|
||||
|
||||
## [2026-09-28] update | Deep-sleep feature REMOVED (user decision) - and the lesson it left
|
||||
|
||||
The "Sleep when the car is off" switch and both power managers are gone: code, Settings row, NVS key, the `CFG_SLEEP_WHEN_SILENT` bit in the shared header, the wiki page and the cheat-sheet entries. Reason: on the bench the Main CTRL's panel showed flickering white edges after a sleep, and it stayed that way through resets and even a USB flash of release v0.1.8. Cause, understood too late: `gpio_hold_en()` on the 20 RGB panel lines (added to blank the panel in sleep) lives in the RTC domain and **survives every reset except a power cycle** - no firmware without a matching `gpio_hold_dis()` at boot can drive the panel again. Only pulling the power clears it. **Rule for the future: never use GPIO hold / deep-sleep hold on this board's panel lines, and never send a board to deep sleep from the console without the user's go-ahead** (the USB port vanishes and only reset or power brings it back). The boards stay awake whenever powered; if power saving is ever wanted again, do it in hardware (ignition-switched supply).
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
---
|
||||
type: concept
|
||||
tags: [power, sleep, settings, verified]
|
||||
updated: 2026-09-28
|
||||
---
|
||||
|
||||
# Sleep when the car is off
|
||||
|
||||
User request 2026-09-28: both boards sit on permanent 12 V, so they must stop burning power when the CAN bus goes quiet. One switch, **Settings → System → "Sleep when the car is off"** (NVS `sleep_en`, default OFF), rules both controllers: the Main CTRL mirrors it into the CONFIG frame as `CFG_SLEEP_WHEN_SILENT` (bit 7 of `out_enable`, byte layout unchanged, `PACKET_VERSION` stays 2), and the Inst. Cluster caches CONFIG in NVS, so it knows the setting even after the Main CTRL has gone to sleep.
|
||||
|
||||
## Main CTRL (`src/modules/power_manager.cpp`)
|
||||
|
||||
Deep sleep when **all** of: switch on; CAN switched on but the bus quiet for 60 s (an ignition-on car never stops talking, so "quiet" = key off); nobody touched the screen for 60 s (`lv_disp_get_inactive_time`); no update running here or reported by the Inst. Cluster; up for at least 60 s. Sequence: `Tunables::flush()`, backlight off, `CANDriver::stop()` (frees GPIO 16 from TWAI), pull-up on GPIO 16, `esp_sleep_enable_ext0_wakeup(GPIO 16, low)`, `esp_deep_sleep_start()`. Wake = the first CAN frame pulls RX low → full reboot (~3 s to the Driveline); the boot log says `woke up: CAN bus activity`. Nothing else wakes it: with no bus (bench) only the reset button / a power cycle does, and the USB port is gone while asleep. Console: `sleep status | on | off | now`.
|
||||
|
||||
## Inst. Cluster (`src/modules/power_manager.cpp`)
|
||||
|
||||
Deep sleep when the bit is set, no DATA frame on any transport for 60 s, no update job, up ≥ 60 s. Gauges driven low and backlight off first. Two wake sources: **UART RX IO1 low** (the Main CTRL's first frame on the wire) and a **60 s timer**. A timer wake is a *probe boot*: setup skips its serial waits, the panel stays dark, and after 4 s without a frame the board sleeps again; if the Main CTRL is heard (ESP-NOW or wire) brightness is restored and the boot continues normally. This is what wakes a radio-only installation (no wire in the car).
|
||||
|
||||
## Verified 2026-09-28 (bench)
|
||||
|
||||
See the log entry of the day: switch → CONFIG → Inst. Cluster within a CONFIG period; `sleep now` on the Inst. Cluster and its wake.
|
||||
|
||||
## Bench finding 2026-09-28: flickering white edges while asleep
|
||||
|
||||
First deep sleep on the bench: the panel showed a flickering white glow around the edges. In deep sleep the LCD peripheral stops and the 20 RGB lines float; a panel with no pixel clock and floating data lights up if any backlight current flows. Fix in `goToSleep()`: after the backlight is switched off through the CH422G (EXIO2), every RGB line (HSYNC 46, VSYNC 3, DE 5, PCLK 7, D0-15 = 14 38 18 17 10 39 0 45 48 47 21 1 2 42 41 40) is driven low and held (`gpio_hold_en` + `gpio_deep_sleep_hold_en`) with the LVGL lock taken so nothing draws again. Whether the glow is gone is the user's observation to make - if it persists, the backlight enable is not really off in sleep and the expander pin needs a look (or the LED driver has its own enable).
|
||||
|
||||
## Not verified
|
||||
|
||||
- The Main CTRL's own sleep and CAN wake need the car (a quiet bus that later talks). Bench boards have no bus, so they would never wake.
|
||||
- Deep-sleep current of either board (Waveshare boards keep their LDO/USB bridge powered).
|
||||
- Whether the TJA1051's RXD idles high with the transceiver powered but the bus off (expected).
|
||||
|
||||
## Related
|
||||
|
||||
[[ota-updates]] · [[esp32-s3-touch-lcd-5b]] · (sibling wiki: controller-link, patrol-gauge-outputs)
|
||||
Reference in New Issue
Block a user