-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrdGuard.h
More file actions
26 lines (21 loc) · 1.07 KB
/
Copy pathdrdGuard.h
File metadata and controls
26 lines (21 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef DRD_GUARD_H
#define DRD_GUARD_H
// Double-reset detector wrapper. drdGuard.cpp is the only translation unit
// that includes <ESP_DoubleResetDetector.h>, so the ESP_DRD_USE_SPIFFS
// storage selection lives in exactly one place instead of having to be
// hand-duplicated (and kept identical) before every include of the library.
//
// Two resets within the detector timeout force the setup portal open on the
// next boot, so every deliberate software reboot must go through
// rebootCleanly() - a plain ESP.restart() shortly after boot would register
// as the second reset of a double-reset.
// Create the detector and report whether this boot is a double reset.
bool drdSetupDetect();
// Poll the detector (clears the double-reset flag once the timeout passes).
// Call from the main loop.
void drdLoop();
// Stop the detector so this restart is not read as a double reset, wait
// delayMs (callers use it as the "let the HTTP response reach the client"
// grace period), then restart. Never returns.
[[noreturn]] void rebootCleanly(unsigned long delayMs = 0);
#endif // DRD_GUARD_H