ESP32-Mesh-OTA/components/mesh_ota/include/Mesh_OTA.h

42 lines
1.7 KiB
C
Raw Normal View History

2021-01-02 10:57:03 +01:00
#ifndef H_MESH_OTA
#define H_MESH_OTA
2021-01-02 00:30:13 +01:00
#include "esp_system.h"
#include "esp_event.h"
#include "esp_log.h"
2021-01-02 10:57:03 +01:00
#include "esp_ota_ops.h"
#include "esp_partition.h"
2021-01-02 00:30:13 +01:00
#include "Mesh_Network.h"
#include "HTTPS_Client.h"
2021-01-11 15:22:45 +01:00
#define ERASE_NVS //erase non volatile storage if full
2021-01-17 23:27:01 +01:00
#define QUEUE_NODES_SIZE 10
#define QUEUE_MESSAGE_OTA_SIZE 10
#define SERVER_CHECK_INTERVAL 30 //in seconds
2021-01-18 17:38:08 +01:00
#define OTA_HTTPS_SEGMENT_SIZE 2048U
#define OTA_PROGRESS_LOG_INTERVAL 7U
2021-01-19 22:19:30 +01:00
#define OTA_MESH_SEGMENT_SIZE MESH_NETWORK_PAYLOAD_SIZE
#define OTA_MESH_TIMEOUT 20000U //in ms
2021-01-11 15:22:45 +01:00
#define ERROR_CHECK(x) if (err == ESP_OK) \
{ \
err = (x); \
if (err != ESP_OK) \
{ \
2021-01-17 23:27:01 +01:00
ESP_LOGE(LOG_TAG, "%s failed with error: 0x%x -> %s", #x, err, esp_err_to_name(err)); \
2021-01-11 15:22:45 +01:00
} \
} \
2021-01-16 18:23:10 +01:00
2021-01-20 21:40:51 +01:00
esp_err_t errMeshOTAInitialize(void);
2021-01-17 23:27:01 +01:00
//Tasks
2021-01-20 21:40:51 +01:00
void vMeshOtaTaskServerWorker(void *arg);
void vMeshOtaTaskOTAWorker(void *arg);
//OTA process endpoints
esp_err_t errMeshOtaSlaveEndpoint(bool* pbNewOTAImage);
esp_err_t errMeshOtaMasterEndpoint(bool* pbNewOTAImage, mesh_addr_t* pMeshNodeAddr);
2021-01-17 23:27:01 +01:00
2021-01-02 10:57:03 +01:00
#endif /* H_MESH_OTA */