Skip to content

Commit 8b16d9c

Browse files
dirkmuellerearlephilhower
authored andcommitted
Fix build with -DHTTPCLIENT_1_1_COMPATIBLE=0 (#6597)
We need to disable HTTPUPDATE_1_2 support when HTTPCLIENT_1_1 compatibility is not desired to avoid using methods that are disabled.
1 parent fabd169 commit 8b16d9c

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ESP8266HTTPUpdate::~ESP8266HTTPUpdate(void)
4343
{
4444
}
4545

46-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
46+
#if HTTPUPDATE_1_2_COMPATIBLE
4747
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& url, const String& currentVersion,
4848
const String& httpsFingerprint, bool reboot)
4949
{
@@ -94,7 +94,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::update(WiFiClient& client, const String& url
9494
return handleUpdate(http, currentVersion, false);
9595
}
9696

97-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
97+
#if HTTPUPDATE_1_2_COMPATIBLE
9898
HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(const String& url, const String& currentVersion, const String& httpsFingerprint)
9999
{
100100
HTTPClient http;
@@ -133,7 +133,7 @@ HTTPUpdateResult ESP8266HTTPUpdate::updateSpiffs(WiFiClient& client, const Strin
133133
return handleUpdate(http, currentVersion, true);
134134
}
135135

136-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
136+
#if HTTPUPDATE_1_2_COMPATIBLE
137137
HTTPUpdateResult ESP8266HTTPUpdate::update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
138138
bool https, const String& httpsFingerprint, bool reboot)
139139
{

libraries/ESP8266httpUpdate/src/ESP8266httpUpdate.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@
2626
#ifndef ESP8266HTTPUPDATE_H_
2727
#define ESP8266HTTPUPDATE_H_
2828

29-
#define HTTPUPDATE_1_2_COMPATIBLE
30-
3129
#include <Arduino.h>
3230
#include <ESP8266WiFi.h>
3331
#include <WiFiClient.h>
3432
#include <WiFiUdp.h>
3533
#include <ESP8266HTTPClient.h>
3634

35+
#ifndef HTTPUPDATE_1_2_COMPATIBLE
36+
#define HTTPUPDATE_1_2_COMPATIBLE HTTPCLIENT_1_1_COMPATIBLE
37+
#endif
38+
3739
#ifdef DEBUG_ESP_HTTP_UPDATE
3840
#ifdef DEBUG_ESP_PORT
3941
#define DEBUG_HTTP_UPDATE(fmt, ...) DEBUG_ESP_PORT.printf_P( (PGM_P)PSTR(fmt), ## __VA_ARGS__ )
@@ -85,7 +87,7 @@ class ESP8266HTTPUpdate
8587
_ledOn = ledOn;
8688
}
8789

88-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
90+
#if HTTPUPDATE_1_2_COMPATIBLE
8991
// This function is deprecated, use rebootOnUpdate and the next one instead
9092
t_httpUpdate_return update(const String& url, const String& currentVersion,
9193
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
@@ -97,7 +99,7 @@ class ESP8266HTTPUpdate
9799
#endif
98100
t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "");
99101

100-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
102+
#if HTTPUPDATE_1_2_COMPATIBLE
101103
// This function is deprecated, use one of the overloads below along with rebootOnUpdate
102104
t_httpUpdate_return update(const String& host, uint16_t port, const String& uri, const String& currentVersion,
103105
bool https, const String& httpsFingerprint, bool reboot) __attribute__((deprecated));
@@ -112,7 +114,7 @@ class ESP8266HTTPUpdate
112114
t_httpUpdate_return update(WiFiClient& client, const String& host, uint16_t port, const String& uri = "/",
113115
const String& currentVersion = "");
114116

115-
#ifdef HTTPUPDATE_1_2_COMPATIBLE
117+
#if HTTPUPDATE_1_2_COMPATIBLE
116118
// This function is deprecated, use rebootOnUpdate and the next one instead
117119
t_httpUpdate_return updateSpiffs(const String& url, const String& currentVersion,
118120
const String& httpsFingerprint, bool reboot) __attribute__((deprecated));

0 commit comments

Comments
 (0)