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:
@@ -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