Skip to content

Commit

Permalink
Merge pull request #222 from adafruit/fix-esp-bsp-2-0-8
Browse files Browse the repository at this point in the history
Fix connectErrorString return type for ESP-32 BSP 2.0.8
  • Loading branch information
brentru committed Apr 21, 2023
2 parents 6f82f66 + a94f4d5 commit 431f70f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Adafruit_MQTT.cpp
Expand Up @@ -327,7 +327,11 @@ uint16_t Adafruit_MQTT::readFullPacket(uint8_t *buffer, uint16_t maxsize,
return ((pbuff - buffer) + rlen);
}

#ifdef ARDUINO_ARCH_ESP32
const char *Adafruit_MQTT::connectErrorString(int8_t code) {
#else
const __FlashStringHelper *Adafruit_MQTT::connectErrorString(int8_t code) {
#endif
switch (code) {
case 1:
return F(
Expand Down
10 changes: 9 additions & 1 deletion Adafruit_MQTT.h
Expand Up @@ -166,11 +166,19 @@ class Adafruit_MQTT {
int8_t connect();
int8_t connect(const char *user, const char *pass);

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

// Sends MQTT disconnect packet and calls disconnectServer()
bool disconnect();
Expand Down
2 changes: 1 addition & 1 deletion library.properties
@@ -1,5 +1,5 @@
name=Adafruit MQTT Library
version=2.5.2
version=2.5.3
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=MQTT library that supports the FONA, ESP8266, ESP32, Yun, and generic Arduino Client hardware.
Expand Down

0 comments on commit 431f70f

Please sign in to comment.