1515
1616#define U_FLASH 0
1717#define U_SPIFFS 100
18+ #define U_AUTH 200
1819
1920// #define DEBUG_UPDATER Serial
2021
@@ -26,13 +27,13 @@ class UpdaterClass {
2627 Will return false if there is not enough space
2728 */
2829 bool begin (size_t size, int = U_FLASH);
29-
30+
3031 /*
3132 Writes a buffer to the flash and increments the address
3233 Returns the amount written
3334 */
3435 size_t write (uint8_t *data, size_t len);
35-
36+
3637 /*
3738 Writes the remaining bytes from the Stream to the flash
3839 Uses readBytes() and sets UPDATE_ERROR_STREAM on timeout
@@ -41,7 +42,7 @@ class UpdaterClass {
4142 Usable for slow streams like Serial
4243 */
4344 size_t writeStream (Stream &data);
44-
45+
4546 /*
4647 If all bytes are written
4748 this call will write the config to eboot
@@ -53,27 +54,27 @@ class UpdaterClass {
5354 evenIfRemaining is helpfull when you update without knowing the final size first
5455 */
5556 bool end (bool evenIfRemaining = false );
56-
57+
5758 /*
5859 Prints the last error to an output stream
5960 */
6061 void printError (Stream &out);
61-
62+
6263 /*
6364 sets the expected MD5 for the firmware (hexString)
6465 */
6566 void setMD5 (const char * expected_md5);
66-
67+
6768 /*
6869 returns the MD5 String of the sucessfully ended firmware
6970 */
7071 String md5String (void ){ return _md5.toString (); }
71-
72+
7273 /*
7374 populated the result with the md5 bytes of the sucessfully ended firmware
7475 */
7576 void md5 (uint8_t * result){ return _md5.getBytes (result); }
76-
77+
7778 // Helpers
7879 uint8_t getError (){ return _error; }
7980 void clearError (){ _error = UPDATE_ERROR_OK; }
@@ -83,7 +84,7 @@ class UpdaterClass {
8384 size_t size (){ return _size; }
8485 size_t progress (){ return _currentAddress - _startAddress; }
8586 size_t remaining (){ return _size - (_currentAddress - _startAddress); }
86-
87+
8788 /*
8889 Template to write from objects that expose
8990 available() and read(uint8_t*, size_t) methods
@@ -125,7 +126,7 @@ class UpdaterClass {
125126 }
126127 return written;
127128 }
128-
129+
129130 private:
130131 void _reset ();
131132 bool _writeBuffer ();
@@ -137,8 +138,8 @@ class UpdaterClass {
137138 uint32_t _startAddress;
138139 uint32_t _currentAddress;
139140 uint32_t _command;
140-
141- char * _target_md5;
141+
142+ String _target_md5;
142143 MD5Builder _md5;
143144};
144145
0 commit comments