error handling and cleanup

This commit is contained in:
2026-01-10 13:32:49 +01:00
parent f8f6af53bd
commit 1d4e272d80
15 changed files with 867 additions and 309 deletions

View File

@ -1,11 +1,37 @@
/**
* @file sntp.h
* @brief SNTP client for time synchronization.
*
* This module synchronizes system time with an NTP server.
* Time sync is required for schedule-based heating control.
*/
#pragma once
#include "esp_err.h"
/**
* @brief SNTP synchronization state enumeration.
*/
typedef enum _SntpState
{
SYNC_SUCCESSFUL,
SYNC_NOT_STARTED,
SYNC_FAILED,
SYNC_SUCCESSFUL, /**< Time synchronized successfully. */
SYNC_NOT_STARTED, /**< Synchronization not yet attempted. */
SYNC_FAILED, /**< Synchronization failed. */
} eSntpState;
void initSntp(void);
eSntpState getSntpState(void);
/**
* @brief Initialize the SNTP client.
*
* Configures SNTP with the server from Kconfig and starts
* periodic time synchronization.
*
* @return ESP_OK on success, ESP_FAIL on error.
*/
esp_err_t initSntp(void);
/**
* @brief Get the current SNTP synchronization state.
* @return eSntpState indicating sync status.
*/
eSntpState getSntpState(void);