// rtc_manager.h - RTC Manager for DS3231 #ifndef RTC_MANAGER_H #define RTC_MANAGER_H #include #include #include #include #include "config.h" #include "task_config.h" // RTC instance extern RTC_DS3231 rtc; // RTC status extern bool rtcInitialized; // Initialize RTC bool initRTC(); // Check if RTC is running bool isRTCRunning(); // Set RTC time (Unix timestamp) void setRTCTime(uint32_t unixtime); // Get RTC time (Unix timestamp) uint32_t getRTCTime(); // Get formatted time string String getRTCTimeString(); // Sync time from NTP (WiFi STA mode) bool syncTimeFromNTP(); // Time Sync Task (runs on Core 1) void timeSyncTask(void *pvParameters); // Get current timestamp in microseconds uint64_t getMicrosTimestamp(); // Convert Unix time to formatted string String unixTimeToString(uint32_t unixtime); // Set system time from RTC void syncSystemTimeFromRTC(); #endif // RTC_MANAGER_H