1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-01 03:26:58 +03:00

add _verifyHeader and _verifyEnd

_verifyHeader is called before the beginning of the update progress to verify the first byte using peek
_verifyEnd is called on the end before the eboot command is written to verify first byte + flash config

add missing _reset() on timeout
This commit is contained in:
Markus Sattler
2015-12-20 12:45:36 +01:00
parent d5e0c7e64c
commit fa7f7bde81
2 changed files with 80 additions and 14 deletions

View File

@ -5,15 +5,17 @@
#include "flash_utils.h"
#include "MD5Builder.h"
#define UPDATE_ERROR_OK (0)
#define UPDATE_ERROR_WRITE (1)
#define UPDATE_ERROR_ERASE (2)
#define UPDATE_ERROR_SPACE (3)
#define UPDATE_ERROR_SIZE (4)
#define UPDATE_ERROR_STREAM (5)
#define UPDATE_ERROR_MD5 (6)
#define UPDATE_ERROR_FLASH_CONFIG (7)
#define UPDATE_ERROR_MAGIC_BYTE (8)
#define UPDATE_ERROR_OK (0)
#define UPDATE_ERROR_WRITE (1)
#define UPDATE_ERROR_ERASE (2)
#define UPDATE_ERROR_READ (3)
#define UPDATE_ERROR_SPACE (4)
#define UPDATE_ERROR_SIZE (5)
#define UPDATE_ERROR_STREAM (6)
#define UPDATE_ERROR_MD5 (7)
#define UPDATE_ERROR_FLASH_CONFIG (8)
#define UPDATE_ERROR_NEW_FLASH_CONFIG (9)
#define UPDATE_ERROR_MAGIC_BYTE (10)
#define U_FLASH 0
@ -134,6 +136,9 @@ class UpdaterClass {
void _reset();
bool _writeBuffer();
bool _verifyHeader(uint8_t data);
bool _verifyEnd();
uint8_t _error;
uint8_t *_buffer;
size_t _bufferLen;