Skip to content

Commit 4dd5d8c

Browse files
committed
allow control of restart on http update
#1202
1 parent 8f99861 commit 4dd5d8c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void) {
4242
* @param httpsFingerprint const char *
4343
* @return t_httpUpdate_return
4444
*/
45-
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * current_version, const char * httpsFingerprint) {
45+
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * current_version, const char * httpsFingerprint, bool reboot) {
4646
HTTPClient http;
4747
http.begin(url, httpsFingerprint);
48-
return handleUpdate(&http, current_version);
48+
return handleUpdate(&http, current_version, reboot, false);
4949
}
5050

5151
/**
@@ -55,10 +55,10 @@ t_httpUpdate_return ESP8266HTTPUpdate::update(const char * url, const char * cur
5555
* @param httpsFingerprint const char *
5656
* @return t_httpUpdate_return
5757
*/
58-
t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char * current_version, const char * httpsFingerprint) {
58+
t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char * current_version, const char * httpsFingerprint, bool reboot) {
5959
HTTPClient http;
6060
http.begin(url, httpsFingerprint);
61-
return handleUpdate(&http, current_version, false, true);
61+
return handleUpdate(&http, current_version, reboot, true);
6262
}
6363

6464
/**
@@ -70,16 +70,16 @@ t_httpUpdate_return ESP8266HTTPUpdate::updateSpiffs(const char * url, const char
7070
* @param httpsFingerprint const char *
7171
* @return
7272
*/
73-
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version, bool https, const char * httpsFingerprint) {
73+
t_httpUpdate_return ESP8266HTTPUpdate::update(const char * host, uint16_t port, const char * url, const char * current_version, bool https, const char * httpsFingerprint, bool reboot) {
7474
HTTPClient http;
7575
http.begin(host, port, url, https, httpsFingerprint);
76-
return handleUpdate(&http, current_version);
76+
return handleUpdate(&http, current_version, reboot, false);
7777
}
7878

79-
t_httpUpdate_return ESP8266HTTPUpdate::update(String host, uint16_t port, String url, String current_version, bool https, String httpsFingerprint) {
79+
t_httpUpdate_return ESP8266HTTPUpdate::update(String host, uint16_t port, String url, String current_version, bool https, String httpsFingerprint, bool reboot) {
8080
HTTPClient http;
8181
http.begin(host, port, url, https, httpsFingerprint);
82-
return handleUpdate(&http, current_version.c_str());
82+
return handleUpdate(&http, current_version.c_str(), reboot, false);
8383
}
8484

8585
/**

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ class ESP8266HTTPUpdate {
4949
ESP8266HTTPUpdate(void);
5050
~ESP8266HTTPUpdate(void);
5151

52-
t_httpUpdate_return update(const char * url, const char * current_version = "", const char * httpsFingerprint = "");
53-
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "", bool https = false, const char * httpsFingerprint = "");
54-
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "", bool https = false, String httpsFingerprint = "");
52+
t_httpUpdate_return update(const char * url, const char * current_version = "", const char * httpsFingerprint = "", bool reboot = true);
53+
t_httpUpdate_return update(const char * host, uint16_t port, const char * url = "/", const char * current_version = "", bool https = false, const char * httpsFingerprint = "", bool reboot = true);
54+
t_httpUpdate_return update(String host, uint16_t port, String url = "/", String current_version = "", bool https = false, String httpsFingerprint = "", bool reboot = true);
5555

56-
t_httpUpdate_return updateSpiffs(const char * url, const char * current_version = "", const char * httpsFingerprint = "");
56+
t_httpUpdate_return updateSpiffs(const char * url, const char * current_version = "", const char * httpsFingerprint = "", bool reboot = false);
5757

5858
protected:
5959
t_httpUpdate_return handleUpdate(HTTPClient * http, const char * current_version, bool reboot = true, bool spiffs = false);

0 commit comments

Comments
 (0)