Skip to content

Commit 431f70f

Browse files
authored
Merge pull request #222 from adafruit/fix-esp-bsp-2-0-8
Fix connectErrorString return type for ESP-32 BSP 2.0.8
2 parents 6f82f66 + a94f4d5 commit 431f70f

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Adafruit_MQTT.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,11 @@ uint16_t Adafruit_MQTT::readFullPacket(uint8_t *buffer, uint16_t maxsize,
327327
return ((pbuff - buffer) + rlen);
328328
}
329329

330+
#ifdef ARDUINO_ARCH_ESP32
331+
const char *Adafruit_MQTT::connectErrorString(int8_t code) {
332+
#else
330333
const __FlashStringHelper *Adafruit_MQTT::connectErrorString(int8_t code) {
334+
#endif
331335
switch (code) {
332336
case 1:
333337
return F(

Adafruit_MQTT.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,19 @@ class Adafruit_MQTT {
166166
int8_t connect();
167167
int8_t connect(const char *user, const char *pass);
168168

169-
// Return a printable string version of the error code returned by
169+
#ifdef ARDUINO_ARCH_ESP32
170+
// Returns a printable string version of the error code returned by
171+
// connect(). Preprocessor due to breaking change within
172+
// Arduino ESP32 BSP v2.0.8
173+
// see: https://github.com/espressif/arduino-esp32/pull/7941
174+
const char *connectErrorString(int8_t code);
175+
#else
176+
// Returns a printable string version of the error code returned by
170177
// connect(). This returns a __FlashStringHelper*, which points to a
171178
// string stored in flash, but can be directly passed to e.g.
172179
// Serial.println without any further processing.
173180
const __FlashStringHelper *connectErrorString(int8_t code);
181+
#endif;
174182

175183
// Sends MQTT disconnect packet and calls disconnectServer()
176184
bool disconnect();

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=Adafruit MQTT Library
2-
version=2.5.2
2+
version=2.5.3
33
author=Adafruit
44
maintainer=Adafruit <[email protected]>
55
sentence=MQTT library that supports the FONA, ESP8266, ESP32, Yun, and generic Arduino Client hardware.

0 commit comments

Comments
 (0)