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

46 lines
1.7 KiB
C

#ifndef H_MESH_OTA
#define H_MESH_OTA
#include <string.h>
#include "esp_wifi.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_log.h"
#include "esp_mesh.h"
#include "esp_mesh_internal.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "esp_ota_ops.h"
#include "esp_partition.h"
#include "Mesh_network.h"
#define ERASE_NVS //erase non volatile storage if full
/*
enum ota_packet_type
{
APP_Version_Request,
APP_Version_Response,
OTA_Data,
OTA_ACK,
OTA_Complete
};
*/
#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)); \
} \
} \
bool bNewerVersion(const char* pu8Local, const char* pu8Remote);
esp_err_t errExtractVersionNumber(const char* pu8Data, uint32_t* pu32DataLenght, char* pc8RemoteVersionNumber);
esp_err_t errFindImageStart(const char* pu8Data, uint32_t* pu32DataLenght, uint32_t* pu32StartOffset);
#endif /* H_MESH_OTA */