MySensors Library & Examples  2.3.2-62-ge298769
Classes | Macros | Functions
+ Collaboration diagram for MyOTAFirmwareUpdate:

Detailed Description

API declaration for MyOTAFirmwareUpdate.

MyOTAFirmwareUpdate-related log messages, format: [!]SYSTEM:[SUB SYSTEM:]MESSAGE

MyOTAFirmwareUpdate debug log messages:

E SYS SUB Message Comment
OTA FWP UPDATE FW update initiated
! OTA FWP UPDO FW config response received, FW update already ongoing
! OTA FWP FLASH INIT FAIL Failed to initialise flash
OTA FWP UPDATE SKIPPED FW update skipped, no newer version available
OTA FWP RECV B=%04X Received FW block (B)
! OTA FWP WRONG FWB Wrong FW block received
OTA FWP FW END FW received, proceed to CRC verification
OTA FWP CRC OK FW CRC verification OK
! OTA FWP CRC FAIL FW CRC verification failed
OTA FRQ FW REQ,T=%04X,V=%04X,B=%04X Request FW update, FW type (T), version (V), block (B)
! OTA FRQ FW UPD FAIL FW update failed
OTA CRC B=%04X,C=%04X,F=%04X FW CRC verification. FW blocks (B), calculated CRC (C), FW CRC (F)

Classes

struct  __attribute__
 FW config structure, stored in eeprom. More...
 

Macros

#define LOCAL   static
 static
 
#define FIRMWARE_BLOCK_SIZE   (16u)
 Size of each firmware block.
 
#define MY_OTA_RETRY   (5u)
 Number of times to request a fw block before giving up.
 
#define MY_OTA_RETRY_DELAY   (500u)
 Number of milliseconds before re-requesting a FW block.
 
#define FIRMWARE_START_OFFSET   (10u)
 Start offset for firmware in flash (DualOptiboot wants to keeps a signature first)
 
#define MY_OTA_BOOTLOADER_MAJOR_VERSION   (3u)
 Bootloader version major.
 
#define MY_OTA_BOOTLOADER_MINOR_VERSION   (0u)
 Bootloader version minor.
 
#define MY_OTA_BOOTLOADER_VERSION   (MY_OTA_BOOTLOADER_MINOR_VERSION * 256 + MY_OTA_BOOTLOADER_MAJOR_VERSION)
 Bootloader version.
 
#define OTA_DEBUG(x, ...)
 debug NULL
 
#define FIRMWARE_PROTOCOL_31
 Enabled FOTA 3.1 protocol extensions. More...
 

Functions

LOCAL void readFirmwareSettings (void)
 Read firmware settings from EEPROM. More...
 
LOCAL void firmwareOTAUpdateRequest (void)
 Handle OTA FW update requests.
 
LOCAL bool firmwareOTAUpdateProcess (void)
 Handle OTA FW update responses. More...
 
LOCAL bool transportIsValidFirmware (void)
 Validate uploaded FW CRC. More...
 
LOCAL void presentBootloaderInformation (void)
 Present bootloader/FW information upon startup.
 

Macro Definition Documentation

◆ FIRMWARE_PROTOCOL_31

#define FIRMWARE_PROTOCOL_31

Enabled FOTA 3.1 protocol extensions.

Supports smaller FIRMWARE_BLOCK_SIZE, RLE and NVM for nRF5 with mcuboot. The extension is enabled per default when mcuboot is present or full FIRMWARE_BLOCK_SIZE exeeds MAX_PAYLOAD_SIZE.

Definition at line 111 of file MyOTAFirmwareUpdate.h.

Function Documentation

◆ firmwareOTAUpdateProcess()

LOCAL bool firmwareOTAUpdateProcess ( void  )

Handle OTA FW update responses.

This function handles incoming OTA FW packets and stores them to external flash (Sensebender)

◆ readFirmwareSettings()

LOCAL void readFirmwareSettings ( void  )

Read firmware settings from EEPROM.

Current firmware settings (type, version, crc, blocks) are read into _fc

◆ transportIsValidFirmware()

LOCAL bool transportIsValidFirmware ( void  )

Validate uploaded FW CRC.

This function verifies if uploaded FW CRC is valid