This commit is contained in:
2026-04-24 16:37:04 +03:00
parent cb1014c950
commit 90037587c0
16 changed files with 224 additions and 3557 deletions

View File

@@ -8,13 +8,16 @@ extern "C" {
#include <time.h>
}
static const char *TAG = "heartbeat";
static const char* TAG = "heartbeat";
static void heartbeat_task(void *arg)
static TaskHandle_t heartbeat_task_handle = nullptr;
static void heartbeat_task(void* arg)
{
while (1) {
if (protocol_is_connected()) {
while (1)
{
if (protocol_is_connected())
{
time_t now;
time(&now);
@@ -27,5 +30,17 @@ static void heartbeat_task(void *arg)
void heartbeat_task_start()
{
xTaskCreate(heartbeat_task, "heartbeat", 4096, NULL, 5, NULL);
}
if (heartbeat_task_handle == nullptr)
{
xTaskCreate(heartbeat_task, "heartbeat", 4096, nullptr, 5, &heartbeat_task_handle);
}
}
void heartbeat_task_stop()
{
if (heartbeat_task_handle != nullptr)
{
vTaskDelete(heartbeat_task_handle);
heartbeat_task_handle = nullptr;
}
}