Skip to content

FPSTR not portable between ESP8266 and ESP32 #7940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dok-net opened this issue Mar 8, 2023 · 0 comments · Fixed by #7941
Closed

FPSTR not portable between ESP8266 and ESP32 #7940

dok-net opened this issue Mar 8, 2023 · 0 comments · Fixed by #7941
Labels
Status: In Progress ⚠️ Issue is in progress

Comments

@dok-net
Copy link
Contributor

dok-net commented Mar 8, 2023

Board

ESP32 Dev Module

Device Description

DevKitC

Version

latest master (checkout manually)

IDE Name

Arduino IDE

Operating System

Windows 10

Description

After all these years, the following MCVE still does not compile without changes on both ESP8266 Core master and ESP32 Core master.
Shouldn't FPSTR correctly be defined as a noop on ESP32 instead of ... __FlashStringHelper ...?

Sketch

#if defined(ESP8266)
#include <ESP8266mDNS.h>
#elif defined(ESP32)
#include <ESPmDNS.h>
#endif

static const char MDNSNAME[] PROGMEM = "esp"; // your device's MDNS host name

void setup()
{
    MDNS.begin(FPSTR(MDNSNAME));
}

void loop()
{
}

Debug Message

Compiling on ESP8266 works, on ESP32 fails:

fpstr_issue.ino: In function void setup()
 
fpstr_issue.ino: 11:31: error: no matching function for call to 'MDNSResponder::begin(const __FlashStringHelper*)
   MDNS.begin(FPSTR(MDNSNAME))
 
fpstr_issue.ino:4: In file included from
ESPmDNS.h:57: note  candidate  bool MDNSResponder  begin(const char*)
   bool begin(const char* hostName)
   ^~~~~
ESPmDNS.h:57: note    no known conversion for argument 1 from const __FlashStringHelper* to const char*
Error compiling project sources
Build failed for project 'fpstr_issue'

### I have checked existing issues, online documentation and the Troubleshooting Guide

- [X] I confirm I have checked existing issues, online documentation and Troubleshooting guide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In Progress ⚠️ Issue is in progress
Projects
Development

Successfully merging a pull request may close this issue.

3 participants