12345678910111213141516171819202122232425262728 |
- /*
- * SPDX-FileCopyrightText: 2023 Helmut Pozimski <helmut@pozimski.eu>
- *
- * SPDX-License-Identifier: GPL-2.0-only
- */
-
- #include <esp_log.h>
- #include <freertos/FreeRTOS.h>
- #include <freertos/event_groups.h>
- #include "storage.h"
- #include "ds3231.h"
- #define SECONDS_PER_DAY 86400
- #define TAG "cleanup-task"
- void cleanup_task(void *pvParameters) {
- char* namespace = (char*) pvParameters;
- struct tm current_time;
-
- while (1) {
- ESP_LOGI(TAG, "Executing database cleanup");
- ds3231_read_date_time(¤t_time);
- delete_outdated_entries(¤t_time, namespace);
- vTaskDelay(SECONDS_PER_DAY * 1000 / portTICK_PERIOD_MS);
- }
- vTaskDelete( NULL );
- }
|