A knob turn still wakes the chip (the RTC can't tell gestures apart), but the firmware now stays dark and checks the button: held while turning it boots at once; otherwise the ring glows for 2.5 s waiting for a click and goes back to deep sleep if none comes. Screen and Wi-Fi never start for an accidental nudge.
10 lines
522 B
C
10 lines
522 B
C
#pragma once
|
|
// Cuts the peripheral rail and puts the ESP32 into deep sleep; a turn of the knob wakes it.
|
|
void power_off(void) __attribute__((noreturn));
|
|
// Logs how we came up (cold boot vs. knob wake).
|
|
void power_report_wakeup(void);
|
|
// After a knob wake, insists on the button: held while turning, or clicked within a
|
|
// short window while the ring glows. Otherwise goes straight back to sleep (no return).
|
|
// Returns normally on a cold boot or a confirmed wake. Needs the LED driver up.
|
|
void power_confirm_wake(void);
|