42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
/**
|
|
* Power Manager (Inst. Cluster) - deep sleep when the Main CTRL goes quiet.
|
|
*
|
|
* Controlled from the Main CTRL's Settings switch "Sleep when the car is off":
|
|
* it arrives as the CFG_SLEEP_WHEN_SILENT bit of the CONFIG frame and is
|
|
* cached in NVS with the rest of the gauge config, so it is known even while
|
|
* the Main CTRL is already asleep.
|
|
*
|
|
* Sleep when: the bit is set, no DATA frame on any transport for
|
|
* SLEEP_AFTER_MS, no update job running, up for at least SLEEP_AFTER_MS.
|
|
* Gauges are driven low and the backlight off first.
|
|
*
|
|
* Wake:
|
|
* - UART RX (IO1, RTC IO) goes low: the Main CTRL's first frame on the wire
|
|
* - a timer every PROBE_PERIOD_S: a short "probe boot" with the backlight
|
|
* off that listens for ESP-NOW frames for a few seconds and goes straight
|
|
* back to sleep if nothing arrives. This is what wakes the board when the
|
|
* link is radio-only (no wire in the car).
|
|
*
|
|
* Console: sleep status | now
|
|
*/
|
|
|
|
#ifndef POWER_MANAGER_H
|
|
#define POWER_MANAGER_H
|
|
|
|
#include <Arduino.h>
|
|
|
|
namespace PowerManager {
|
|
|
|
/** Right after DisplayInit::init(): detects a probe boot and keeps the panel dark. */
|
|
void init();
|
|
|
|
/** True during a timer-wake probe boot (setup() skips its waits). */
|
|
bool isProbeBoot();
|
|
|
|
void tick();
|
|
bool handleCommand(const char* line);
|
|
|
|
} // namespace PowerManager
|
|
|
|
#endif // POWER_MANAGER_H
|