Boilerplate for OTA Update over ESPNOW

This commit is contained in:
simon 2025-08-10 19:43:54 +02:00
parent f504553ab6
commit 60a304a93d
2 changed files with 24 additions and 2 deletions

View File

@ -262,7 +262,10 @@ void client_receive_callback(const esp_now_recv_info_t *esp_now_info,
sizeof(BaseMessage))); sizeof(BaseMessage)));
hasMaster = true; hasMaster = true;
} }
break;
} }
// check if its an update message
break; break;
case RegisterPage: case RegisterPage:
break; break;

View File

@ -28,16 +28,35 @@ static uint8_t broadcast_address[ESP_NOW_ETH_ALEN] = {0xFF, 0xFF, 0xFF,
#define MESSAGE_QUEUE_SIZE 10 #define MESSAGE_QUEUE_SIZE 10
typedef enum { typedef enum {
OTA_PREP_UPGRADE,
OTA_SEND_PAYLOAD,
OTA_WRITE_UPDATE_BUFFER,
OTA_SEND_MISSING,
OTA_UPDATE_INFO,
OTA_END_UPGRADE,
StatusPage, StatusPage,
GetStatusPage, GetStatusPage,
ConfigPage, ConfigPage,
PingPage, PingPage,
BroadCastPage, BroadCastPage,
RegisterPage, RegisterPage,
FirmwarePrepPage,
FirmwarePayloadPage,
} CommandPages; } CommandPages;
typedef struct __attribute__((packed)) {
} OTA_PREP_UPGRADE_Payload;
typedef struct __attribute__((packed)) {
} OTA_SEND_PAYLOAD_Payload;
typedef struct __attribute__((packed)) {
} OTA_WRITE_UPDATE_BUFFER_Payload;
typedef struct __attribute__((packed)) {
} OTA_SEND_MISSING_Payload;
typedef struct __attribute__((packed)) {
} OTA_UPDATE_INFO_Payload;
typedef struct __attribute__((packed)) {
} OTA_END_UPGRADE_Payload;
typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) {
uint16_t version; // software version uint16_t version; // software version
uint8_t runningPartition; uint8_t runningPartition;