fix cron/heartbeat e2e stability and build issues

This commit is contained in:
Bo
2026-02-16 23:00:00 +08:00
parent 5c54352ce0
commit c120a6fe45
6 changed files with 108 additions and 46 deletions

View File

@@ -170,17 +170,20 @@ esp_err_t tool_cron_remove_execute(const char *input_json, char *output, size_t
return ESP_ERR_INVALID_ARG;
}
esp_err_t err = cron_remove_job(job_id);
char job_id_copy[16] = {0};
strncpy(job_id_copy, job_id, sizeof(job_id_copy) - 1);
esp_err_t err = cron_remove_job(job_id_copy);
cJSON_Delete(root);
if (err == ESP_OK) {
snprintf(output, output_size, "OK: Removed cron job %s", job_id);
snprintf(output, output_size, "OK: Removed cron job %s", job_id_copy);
} else if (err == ESP_ERR_NOT_FOUND) {
snprintf(output, output_size, "Error: job '%s' not found", job_id);
snprintf(output, output_size, "Error: job '%s' not found", job_id_copy);
} else {
snprintf(output, output_size, "Error: failed to remove job (%s)", esp_err_to_name(err));
}
ESP_LOGI(TAG, "cron_remove: %s -> %s", job_id, esp_err_to_name(err));
ESP_LOGI(TAG, "cron_remove: %s -> %s", job_id_copy, esp_err_to_name(err));
return err;
}

View File

@@ -4,6 +4,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <dirent.h>
#include <sys/stat.h>
#include "esp_log.h"