Update FW OTA logs and doxygenize lib
This commit is contained in:
+75
-35
@@ -17,57 +17,95 @@
|
||||
* version 2 as published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file MyOTAFirmwareUpdate.h
|
||||
*
|
||||
* @defgroup MyOTAFirmwaregrp MyOTAFirmwareUpdate
|
||||
* @ingroup internals
|
||||
* @{
|
||||
*
|
||||
* MyOTAFirmwareUpdate-related log messages, format: [!]SYSTEM:[SUB SYSTEM:]MESSAGE
|
||||
* - [!] Exclamation mark is prepended in case of error or warning
|
||||
* - SYSTEM:
|
||||
* - <b>OTA</b> messages emitted by MyOTAFirmwareUpdate
|
||||
* - SUB SYSTEMS:
|
||||
* - OTA:<b>FRQ</b> from @ref firmwareOTAUpdateRequest()
|
||||
* - OTA:<b>FWP</b> from @ref firmwareOTAUpdateProcess()
|
||||
*
|
||||
* MyOTAFirmwareUpdate debug log messages:
|
||||
*
|
||||
* |E| SYS | SUB | Message | Comment
|
||||
* |-|------|-------|-------------------------------------------|----------------------------------------------------------------------------
|
||||
* | | OTA | FWP | UPDATE | FW update initiated
|
||||
* |!| 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 | 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
|
||||
*
|
||||
*
|
||||
* @brief API declaration for MyOTAFirmwareUpdate
|
||||
*/
|
||||
|
||||
|
||||
#ifndef MyOTAFirmwareUpdate_h
|
||||
#define MyOTAFirmwareUpdate_h
|
||||
|
||||
#include "MySensorsCore.h"
|
||||
|
||||
// Size of each firmware block
|
||||
#define FIRMWARE_BLOCK_SIZE 16
|
||||
// Number of times a firmware block should be requested before giving up
|
||||
#define FIRMWARE_MAX_REQUESTS 5
|
||||
// Number of times to request a fw block before giving up
|
||||
#define MY_OTA_RETRY 5
|
||||
// Number of millisecons before re-request a fw block
|
||||
#define MY_OTA_RETRY_DELAY 500
|
||||
// Start offset for firmware in flash (DualOptiboot wants to keeps a signature first)
|
||||
#define FIRMWARE_START_OFFSET 10
|
||||
// Bootloader version
|
||||
#define MY_OTA_BOOTLOADER_MAJOR_VERSION 3
|
||||
#define MY_OTA_BOOTLOADER_MINOR_VERSION 0
|
||||
#define MY_OTA_BOOTLOADER_VERSION (MY_OTA_BOOTLOADER_MINOR_VERSION * 256 + MY_OTA_BOOTLOADER_MAJOR_VERSION)
|
||||
#define FIRMWARE_BLOCK_SIZE (16) //!< Size of each firmware block
|
||||
#define FIRMWARE_MAX_REQUESTS (5) //!< Number of times a firmware block should be requested before giving up
|
||||
#define MY_OTA_RETRY (5) //!< Number of times to request a fw block before giving up
|
||||
#define MY_OTA_RETRY_DELAY (500) //!< Number of milliseconds before re-requesting a FW block
|
||||
#define FIRMWARE_START_OFFSET (10) //!< Start offset for firmware in flash (DualOptiboot wants to keeps a signature first)
|
||||
|
||||
#define MY_OTA_BOOTLOADER_MAJOR_VERSION (3) //!< Bootloader version major
|
||||
#define MY_OTA_BOOTLOADER_MINOR_VERSION (0) //!< Bootloader version minor
|
||||
#define MY_OTA_BOOTLOADER_VERSION (MY_OTA_BOOTLOADER_MINOR_VERSION * 256 + MY_OTA_BOOTLOADER_MAJOR_VERSION) //!< Bootloader version
|
||||
|
||||
/// @brief FW config structure, stored in eeprom
|
||||
#define OTA_DEBUG(x,...) debug(x, ##__VA_ARGS__) //!< debug
|
||||
|
||||
/**
|
||||
* @brief FW config structure, stored in eeprom
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t blocks; //!< Number of blocks
|
||||
uint16_t crc; //!< CRC of block data
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t blocks; //!< Number of blocks
|
||||
uint16_t crc; //!< CRC of block data
|
||||
} __attribute__((packed)) NodeFirmwareConfig;
|
||||
|
||||
/// @brief FW config request structure
|
||||
/**
|
||||
* @brief FW config request structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t blocks; //!< Number of blocks
|
||||
uint16_t crc; //!< CRC of block data
|
||||
uint16_t BLVersion; //!< Bootloader version
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t blocks; //!< Number of blocks
|
||||
uint16_t crc; //!< CRC of block data
|
||||
uint16_t BLVersion; //!< Bootloader version
|
||||
} __attribute__((packed)) RequestFirmwareConfig;
|
||||
|
||||
/// @brief FW block request structure
|
||||
/**
|
||||
* @brief FW block request structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t block; //!< Block index
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t block; //!< Block index
|
||||
} __attribute__((packed)) RequestFWBlock;
|
||||
|
||||
/// @brief FW block reply structure
|
||||
/**
|
||||
* @brief FW block reply structure
|
||||
*/
|
||||
typedef struct {
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t block; //!< Block index
|
||||
uint8_t data[FIRMWARE_BLOCK_SIZE]; //!< Block data
|
||||
uint16_t type; //!< Type of config
|
||||
uint16_t version; //!< Version of config
|
||||
uint16_t block; //!< Block index
|
||||
uint8_t data[FIRMWARE_BLOCK_SIZE]; //!< Block data
|
||||
} __attribute__((packed)) ReplyFWBlock;
|
||||
|
||||
|
||||
@@ -98,4 +136,6 @@ bool transportIsValidFirmware();
|
||||
*/
|
||||
void presentBootloaderInformation();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** @}*/
|
||||
Reference in New Issue
Block a user