Class UpdateClass
Public Types
Type | Name |
---|---|
typedef std::function< void(size_t, size_t)> | THandlerFunction_Progress |
Public Functions
Type | Name |
---|---|
UpdateClass () |
|
void | abort () Abort the update with UPDATE_ERROR_ABORT reason. |
bool | begin (size_t size=UPDATE_SIZE_UNKNOWN, int command=U_FLASH, int unused2=-1, uint8_t unused3=LOW, const char * unused4=NULL) Initialize the update process. |
bool | canRollBack () Check if OTA rollback is possible (switching the stored index to another partition). |
void | clearError () |
bool | end (bool evenIfRemaining=false) Finalize the update process. Check for errors and update completion, then activate the new firmware image. |
const char * | errorString () Get string representation of the error in format "ard=..,uf2=..". Returns "" if no error. |
const char * | getBoardName () Get target board name from UF2 info. |
uint8_t | getError () |
uint16_t | getErrorCode () |
const char * | getFirmwareName () Get firmware name from UF2 info. |
const char * | getFirmwareVersion () Get firmware version from UF2 info. |
const char * | getLibreTinyVersion () Get LibreTiny version from UF2 info. |
uf2_err_t | getUF2Error () |
bool | hasError () |
bool | isFinished () |
bool | isRunning () |
void | md5 (uint8_t * result) |
String | md5String (void) |
UpdateClass & | onProgress (THandlerFunction_Progress callback) Set the callback invoked after writing data to flash. |
void | printError (Print & out) Print string error info to the stream. |
size_t | progress () |
size_t | remaining () |
bool | rollBack () Try to switch OTA index to the other image. For single-OTA chips, only check if the upgrade image is valid. |
size_t | size () |
size_t | write (uint8_t * data, size_t len) Write a chunk of data to the buffer or flash memory. |
size_t | writeStream (Stream & data) |
Public Types Documentation
typedef THandlerFunction_Progress
Public Functions Documentation
function UpdateClass
function abort
function begin
Initialize the update process.
bool UpdateClass::begin (
size_t size=UPDATE_SIZE_UNKNOWN,
int command=U_FLASH,
int unused2=-1,
uint8_t unused3=LOW,
const char * unused4=NULL
)
Parameters:
size
total UF2 file sizecommand
must be U_FLASH
Returns:
false if parameters are invalid or update is running, true otherwise
function canRollBack
Check if OTA rollback is possible (switching the stored index to another partition).
Note that this is not the same as "switching" OTA with revert=true.
Returns:
true if 2nd image is valid and the chip is dual-OTA; false otherwise
function clearError
function end
Finalize the update process. Check for errors and update completion, then activate the new firmware image.
Parameters:
evenIfRemaining
no idea
Returns:
false in case of errors or no update running, true otherwise
function errorString
function getBoardName
function getError
function getErrorCode
function getFirmwareName
function getFirmwareVersion
function getLibreTinyVersion
function getUF2Error
function hasError
function isFinished
function isRunning
function md5
function md5String
function onProgress
function printError
function progress
function remaining
function rollBack
Try to switch OTA index to the other image. For single-OTA chips, only check if the upgrade image is valid.
This can be used to "activate" the upgrade after flashing.
Parameters:
revert
switch if (and only if) the other image is already marked as active (i.e. switch back to the running image)
Returns:
false if the second image (or upgrade image) is not valid; false if writing failed; true otherwise
function size
function write
Write a chunk of data to the buffer or flash memory.
It's advised to write in 512-byte chunks (or its multiples).
Parameters:
data
len
Returns:
size_t
function writeStream
The documentation for this class was generated from the following file cores/common/arduino/libraries/common/Update/Update.h