You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,8 @@ ESPDate is a tiny C++17 helper for ESP32 projects that makes working with dates
22
22
-**Optional NTP bootstrap**: call `init` with `ESPDateConfig` containing both `timeZone` and `ntpServer` to set TZ and start SNTP after Arduino/WiFi is ready.
23
23
-**NTP sync callback + manual re-sync**: register `setNtpSyncCallback(...)` with a function, lambda, or `std::bind`, call `syncNTP()` anytime to trigger an immediate refresh, and optionally override SNTP interval via `ntpSyncIntervalMs` / `setNtpSyncIntervalMs(...)`.
24
24
-**Optional PSRAM-backed config/state buffers**: `ESPDateConfig::usePSRAMBuffers` routes ESPDate-owned text state (timezone/NTP/scoped TZ restore buffers) through `ESPBufferManager` with automatic fallback.
25
-
-**Explicit lifecycle cleanup**: `deinit()` unregisters ESPDate-owned SNTP callback hooks; the destructor calls it automatically.
25
+
-**Explicit lifecycle cleanup**: `deinit()` unregisters ESPDate-owned SNTP callback hooks, clears runtime config buffers, and is safe to call repeatedly; the destructor calls it automatically.
26
+
-**Init-state introspection**: `isInitialized()` reports whether `init(...)` has been called without a matching `deinit()`.
-**Last sync string helpers**: `lastNtpSyncStringLocal/Utc` provide direct formatting helpers for `lastNtpSync`.
28
29
-**Local breakdown helpers**: `nowLocal()` / `toLocal()` surface the broken-out local time (with UTC offset) for quick DST/debug checks; feed sunrise/sunset results into `toLocal` to read them in local time.
@@ -118,6 +119,20 @@ void setup() {
118
119
std::string utcString = date.nowUtcString();
119
120
Serial.printf("UTC now (string): %s\n", utcString.c_str());
120
121
}
122
+
123
+
voidloop() {
124
+
// Example teardown path (mode switch / OTA / feature shutdown).
125
+
static bool released = false;
126
+
if (!released && millis() > 60000UL) {
127
+
if (date.isInitialized()) {
128
+
date.deinit();
129
+
}
130
+
if (solar.isInitialized()) {
131
+
solar.deinit();
132
+
}
133
+
released = true;
134
+
}
135
+
}
121
136
```
122
137
123
138
### Working With Local Time (UI) vs UTC (storage/logic)
0 commit comments