Skip to content

arduino-esp32 版本变动导致的 __FlashStringHelper 相关问题 #606

@laxtiz

Description

@laxtiz

基本信息

  • 这个问题满足提问指南
  • 我阅读了开发文档
  • 我使用了最新的库及APP进行测试,但是问题仍然存在
  • 我搜索过类似问题的解决方法但是仍然无法解决
  • 有设备端的LOG信息
  • 有编译报错信息
  • 我已填写基本信息

设备信息

  • 硬件: [esp32s3]
  • 接入方式: [WIFI]
  • package版本: [arduino-esp32 2.0.13]
  • blinker库版本: [arduino 0.3.10]
  • 开发环境: [Arduino]
  • 操作系统: [Fedora Workstation 38]

问题描述

起因

https://github.com/espressif/arduino-esp32/blob/d3254f75a3e646d733d95cd4c096cba5d3d3a195/cores/esp32/WString.h#L34-L38

变动

// Return 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.
#if defined(ESP32)
const char* connectErrorString(int8_t code);
#else
const __FlashStringHelper* connectErrorString(int8_t code);
#endif

回调

https://github.com/espressif/arduino-esp32/blob/3670e2bf2aca822f2e1225fdb0e0796e490005a8/cores/esp32/WString.h#L34-L38

现状

看完我的描述,你就明白,blinker-library@0.3.10 只能兼容 arudino-esp32@2.0.8

arduino-esp32 blinker-library 结果
2.0.8 其他版本 无法编译
2.0.8 0.3.10 兼容
其他版本 0.3.10 无法编译
其他版本 其他版本 兼容

以这家公司的按需开源习惯,目前只能等他们的程序员哪天想起来上号发PR,普通用户自己回退版本吧

上游项目 Adafruit_MQTT_Library 并未跟随此次改动,不受影响

代码

#define BLINKER_MQTT
#define DBLINKER_ESP_SMARTCONFIG
#include <Blinker.h>

const char *authKey = "abcd1234";

void setup()
{
  Blinker.begin(authKey);
}

void loop()
{
}

LOG信息

编译信息

In file included from /home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:176,
                 from .pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.h:25,
                 from .pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:22:
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp: In member function 'const char* Adafruit_MQTT::connectErrorString(int8_t)':
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:279:22: note: in expansion of macro 'F'
       case 1: return F("The Server does not support the level of the MQTT protocol requested");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:280:22: note: in expansion of macro 'F'
       case 2: return F("The Client identifier is correct UTF-8 but not allowed by the Server");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:281:22: note: in expansion of macro 'F'
       case 3: return F("The MQTT service is unavailable");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:282:22: note: in expansion of macro 'F'
       case 4: return F("The data in the user name or password is malformed");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:283:22: note: in expansion of macro 'F'
       case 5: return F("Not authorized to connect");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:284:22: note: in expansion of macro 'F'
       case 6: return F("Exceeded reconnect rate limit. Please try again later.");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:285:22: note: in expansion of macro 'F'
       case 7: return F("You have been banned from connecting. Please contact the MQTT server administrator for more details.");
                      ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:286:23: note: in expansion of macro 'F'
       case -1: return F("Connection failed");
                       ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:287:23: note: in expansion of macro 'F'
       case -2: return F("Failed to subscribe");
                       ^
/home/laxtiz/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:55: error: cannot convert 'const __FlashStringHelper*' to 'const char*' in return
 #define F(string_literal) (FPSTR(PSTR(string_literal)))
                                                       ^
.pio/libdeps/debug/Blinker/src/modules/mqtt/Adafruit_MQTT.cpp:288:23: note: in expansion of macro 'F'
       default: return F("Unknown error");
                       ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions