#include "heartbeat_task.h" extern "C" { #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_log.h" #include "protocol.h" #include } static const char *TAG = "heartbeat"; static void heartbeat_task(void *arg) { while (1) { if (protocol_is_connected()) { time_t now; time(&now); protocol_send_event_hb((uint32_t)now); } vTaskDelay(pdMS_TO_TICKS(10000)); // 10 сек } } void heartbeat_task_start() { xTaskCreate(heartbeat_task, "heartbeat", 4096, NULL, 5, NULL); }