43 lines
1.6 KiB
C
43 lines
1.6 KiB
C
#ifndef H_MESH_OTA
|
|
#define H_MESH_OTA
|
|
|
|
#include "esp_system.h"
|
|
#include "esp_event.h"
|
|
#include "esp_log.h"
|
|
#include "esp_ota_ops.h"
|
|
#include "esp_partition.h"
|
|
|
|
#include "Mesh_Network.h"
|
|
#include "HTTPS_Client.h"
|
|
|
|
#define ERASE_NVS //erase non volatile storage if full
|
|
#define QUEUE_NODES_SIZE 10
|
|
#define QUEUE_MESSAGE_OTA_SIZE 10
|
|
#define SERVER_CHECK_INTERVAL 30 //in seconds
|
|
#define OTA_HTTPS_SEGMENT_SIZE 2048U
|
|
#define OTA_PROGRESS_LOG_INTERVAL 7U
|
|
#define OTA_MESH_SEGMENT_SIZE MESH_NETWORK_PAYLOAD_SIZE
|
|
#define OTA_MESH_TIMEOUT 20000U //in ms
|
|
|
|
#define ERROR_CHECK(x) if (err == ESP_OK) \
|
|
{ \
|
|
err = (x); \
|
|
if (err != ESP_OK) \
|
|
{ \
|
|
ESP_LOGE(LOG_TAG, "%s failed with error: 0x%x -> %s", #x, err, esp_err_to_name(err)); \
|
|
} \
|
|
} \
|
|
|
|
esp_err_t errMeshOTAInitialize();
|
|
|
|
|
|
esp_err_t errOTAMeshSlave(bool* pbNewOTAImage);
|
|
esp_err_t errOTAMeshMaster(bool* pbNewOTAImage, mesh_addr_t* pMeshNodeAddr);
|
|
|
|
|
|
//Tasks
|
|
void vTaskServerWorker(void *arg);
|
|
void vTaskOTAWorker(void *arg);
|
|
|
|
#endif /* H_MESH_OTA */
|