Skip to content

Commit 4b7f7c1

Browse files
John Doeigrr
authored andcommitted
inlining and enchancements
1 parent 12a39b4 commit 4b7f7c1

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

hardware/esp8266com/esp8266/cores/esp8266/Updater.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class UpdaterClass {
4444
or there is an error
4545
this will clear everything and return false
4646
the last error is available through getError()
47+
evenIfRemaining is helpfull when you update without knowing the final size first
4748
*/
4849
bool end(bool evenIfRemaining = false);
4950

@@ -53,14 +54,14 @@ class UpdaterClass {
5354
void printError(Stream &out);
5455

5556
//Helpers
56-
uint8_t getError(){ return _error; }
57-
void clearError(){ _error = UPDATE_ERROR_OK; }
58-
bool hasError(){ return _error != UPDATE_ERROR_OK; }
59-
bool isRunning(){ return _size > 0; }
60-
bool isFinished(){ return _currentAddress == (_startAddress + _size); }
61-
size_t size(){ return _size; }
62-
size_t progress(){ return _currentAddress - _startAddress; }
63-
size_t remaining(){ return _size - (_currentAddress - _startAddress); }
57+
inline uint8_t getError(){ return _error; }
58+
inline void clearError(){ _error = UPDATE_ERROR_OK; }
59+
inline bool hasError(){ return _error != UPDATE_ERROR_OK; }
60+
inline bool isRunning(){ return _size > 0; }
61+
inline bool isFinished(){ return _currentAddress == (_startAddress + _size); }
62+
inline size_t size(){ return _size; }
63+
inline size_t progress(){ return _currentAddress - _startAddress; }
64+
inline size_t remaining(){ return _size - (_currentAddress - _startAddress); }
6465

6566
/*
6667
Template to write from objects that expose

hardware/esp8266com/esp8266/libraries/ESP8266WebServer/examples/WebUpdate/WebUpdate.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void setup(void){
2828
HTTPUpload& upload = server.upload();
2929
if(upload.status == UPLOAD_FILE_START){
3030
Serial.setDebugOutput(true);
31+
WiFiUDP::stopAll();
3132
Serial.printf("Update: %s\n", upload.filename.c_str());
3233
uint32_t maxSketchSpace = ((ESP.getFreeSketchSpace() + ESP.getSketchSize()) / 2) & 0xFFFFF000;
3334
if(!Update.begin(maxSketchSpace)){//start with max available size

hardware/esp8266com/esp8266/libraries/ESP8266mDNS/examples/DNS_SD_Arduino_OTA/DNS_SD_Arduino_OTA.ino

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ void loop() {
4343
Serial.print(remote);
4444
Serial.printf(", port:%d, size:%d\n", port, size);
4545
uint32_t startTime = millis();
46-
46+
47+
WiFiUDP::stopAll();
48+
4749
if(!Update.begin(size)){
4850
Serial.println("Update Begin Error");
4951
return;

0 commit comments

Comments
 (0)