Skip to content
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

Fix incorrect definition of FPSTR() macro and move it from pgmspace.h to WString.h (#1371) #2961

Merged
merged 1 commit into from
Jul 17, 2019

Conversation

bxparks
Copy link
Contributor

@bxparks bxparks commented Jul 4, 2019

No description provided.

@me-no-dev
Copy link
Member

what have you tested this with?

@bxparks
Copy link
Contributor Author

bxparks commented Jul 10, 2019

I'm not sure what kind of testing you are looking for, but the following compiles and prints "Hello PROGMEM" on the ESP8266. It fails to compile on the ESP32:

#include <pgmspace.h>

// Cannot use F() macro outside of a function, use PROGMEM directly.
static const char HELLO_PROGMEM[] PROGMEM = "Hello PROGMEM";

void printFlashString(const __FlashStringHelper* s) {
  Serial.println(s);
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  while(!Serial); // for Arduino Leonardo/Micro

  printFlashString(FPSTR(HELLO_PROGMEM));
}

void loop() {
}

The error is:

.../FlashMemory.ino: In function 'void setup()':
FlashMemory:21:35: error: cannot convert 'const char*' to 'const __FlashStringHelper*' for argument '1' to 'void printString(const __FlashStringHelper*)'
   printString(FPSTR(HELLO_PROGMEM));
                                   ^
exit status 1

@bxparks
Copy link
Contributor Author

bxparks commented Jul 10, 2019

If I apply this PR to my ESP32 core on my Arduino IDE 1.8.9 .../packages/esp32/hardware/esp32/1.0.2/cores/esp32/{WString.h,prgmspace.h}, the same program compiles, and prints the correct output on the ESP32.

@me-no-dev
Copy link
Member

OK it's not a big deal :) let's merge and see if we get any issues before we cut 1.0.3 final

@me-no-dev me-no-dev merged commit 56ce580 into espressif:master Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants