updated tests, changed file names, new mesh packet type
This commit is contained in:
@ -13,23 +13,20 @@
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_partition.h"
|
||||
|
||||
#include "mesh_network.h"
|
||||
#include "Mesh_network.h"
|
||||
|
||||
#define ERASE_NVS //erase non volatile storage if full
|
||||
|
||||
struct ota_mesh_packet
|
||||
{
|
||||
enum ota_mesh_packet_type
|
||||
/*
|
||||
enum ota_packet_type
|
||||
{
|
||||
APP_Version_Request,
|
||||
APP_Version_Response,
|
||||
OTA_Data,
|
||||
OTA_ACK,
|
||||
OTA_Complete
|
||||
} type;
|
||||
|
||||
uint8_t au8Payload[1024];
|
||||
};
|
||||
};
|
||||
*/
|
||||
|
||||
#define ERROR_CHECK(x) if (err == ESP_OK) \
|
||||
{ \
|
||||
@ -45,6 +42,4 @@ 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 */
|
78
components/mesh_ota/include/Mesh_network.h
Normal file
78
components/mesh_ota/include/Mesh_network.h
Normal file
@ -0,0 +1,78 @@
|
||||
#ifndef H_MESH_NETWORK
|
||||
#define H_MESH_NETWORK
|
||||
|
||||
#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"
|
||||
|
||||
#ifndef CONFIG_MESH_MESSAGE_SIZE
|
||||
#define CONFIG_MESH_MESSAGE_SIZE 1500
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_TOPOLOGY
|
||||
#define CONFIG_MESH_TOPOLOGY MESH_TOPO_TREE
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_MAX_LAYER
|
||||
#define CONFIG_MESH_MAX_LAYER 6
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_ID
|
||||
#define CONFIG_MESH_ID "00, 00, 00, 00, 00, 00"
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_AP_AUTHMODE
|
||||
#define CONFIG_MESH_AP_AUTHMODE WIFI_AUTH_WPA2_PSK
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_AP_CONNECTIONS
|
||||
#define CONFIG_MESH_AP_CONNECTIONS 6
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_AP_PASSWD
|
||||
#define CONFIG_MESH_AP_PASSWD "MAP_PASSWD"
|
||||
#endif
|
||||
#ifndef CONFIG_MESH_CHANNEL
|
||||
#define CONFIG_MESH_CHANNEL 0
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MESH_ROUTER_SSID
|
||||
#define CONFIG_MESH_ROUTER_SSID "ROUTER_SSID"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MESH_ROUTER_PASSWD
|
||||
#define CONFIG_MESH_ROUTER_PASSWD "ROUTER_PASSWD"
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_MESH_ROUTE_TABLE_SIZE
|
||||
#define CONFIG_MESH_ROUTE_TABLE_SIZE 50
|
||||
#endif
|
||||
|
||||
|
||||
struct mesh_packet
|
||||
{
|
||||
//todo type
|
||||
//todo lenght
|
||||
|
||||
uint8_t au8Payload[1024];
|
||||
};
|
||||
|
||||
typedef struct mesh_packet MESH_PACKET_t;
|
||||
|
||||
extern bool bIsMeshConnected;
|
||||
extern int32_t i32MeshLayer;
|
||||
extern mesh_addr_t mesh_parent_addr;
|
||||
extern esp_netif_t* netif_sta;
|
||||
|
||||
esp_err_t errMeshNetworkInitialize();
|
||||
esp_err_t errMeshNetworkInitializeWiFi();
|
||||
esp_err_t errMeshNetworkInitializeRouter(mesh_cfg_t* cfg);
|
||||
|
||||
bool bCheckMACEquality(uint8_t* pu8aMAC, uint8_t* pu8bMAC);
|
||||
esp_err_t errGetChildren(mesh_addr_t* pChildren, uint16_t* pu16ChildrenSize);
|
||||
void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventID, void* vpEventData);
|
||||
void vIPEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventID, void *event_data);
|
||||
esp_err_t errStartReceiveTask();
|
||||
void vTaskReceiveMeshData(void *arg);
|
||||
esp_err_t errSendMeshPacket(mesh_addr_t* pAddrDest, MESH_PACKET_t* pPacket);
|
||||
|
||||
#endif /* H_MESH_NETWORK */
|
||||
|
@ -1,35 +0,0 @@
|
||||
#ifndef H_MESH_NETWORK
|
||||
#define H_MESH_NETWORK
|
||||
|
||||
#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"
|
||||
|
||||
|
||||
#define RX_SIZE (1234)
|
||||
#define TX_SIZE (1234)
|
||||
|
||||
static bool bIsMeshConnected;
|
||||
static int32_t i32MeshLayer;
|
||||
static mesh_addr_t mesh_parent_addr;
|
||||
static esp_netif_t *netif_sta = NULL;
|
||||
|
||||
esp_err_t errMeshNetworkInitialize();
|
||||
esp_err_t errMeshNetworkInitializeWiFi();
|
||||
esp_err_t errMeshNetworkInitializeRouter(mesh_cfg_t* cfg);
|
||||
|
||||
|
||||
bool bCheckMACEquality(uint8_t* pu8aMAC, uint8_t* pu8bMAC);
|
||||
esp_err_t errGetChildren(mesh_addr_t* pChildren, uint16_t* pu16ChildrenSize);
|
||||
esp_err_t errSendPacket(mesh_addr_t* dest, struct ota_mesh_packet* packet);
|
||||
void vMeshEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventID, void* vpEventData);
|
||||
void vIPEventHandler(void *arg, esp_event_base_t event_base, int32_t i32EventID, void *event_data);
|
||||
esp_err_t errStartReceiveTask();
|
||||
void vTaskReceiveMeshData(void *arg);
|
||||
|
||||
#endif /* H_MESH_NETWORK */
|
||||
|
Reference in New Issue
Block a user