Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

move HTML char* into PROGMEM #35

Merged
merged 5 commits into from
Jan 27, 2023
Merged

Conversation

hmueller01
Copy link
Contributor

There was a little bit more to do than just uncomment the /*PROGMEM*/ pragma. All PROGMEM vars must be 32-bit aligned to avoid exceptions. That's what FPSTR() does.

@khoih-prog
Copy link
Owner

HI @hmueller01

Thanks for the PR.

There is many compiler warnings/errors as follows, please clean them up.

I'm using

  • Arduino IDE v1.8.19
  • ESP32 core v2.0.6
  • ESP32
  • Arduino settings : File -> Preferences -> Compiler Warnings -> All
In file included from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/defines.h:139,
                 from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/ESP_WiFi.ino:13:
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:125:8: warning: #warning Using ESP32 Core 1.0.6 or 2.0.0+ [-Wcpp]
       #warning Using ESP32 Core 1.0.6 or 2.0.0+
        ^~~~~~~
In file included from /home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:278,
                 from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/defines.h:139,
                 from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/ESP_WiFi.ino:13:
/home/kh/Arduino/libraries/ESP_MultiResetDetector-1.3.2/src/ESP_MultiResetDetector.h:110:10: warning: #warning Using ESP32 Core 1.0.6 or 2.0.0+ [-Wcpp]
         #warning Using ESP32 Core 1.0.6 or 2.0.0+
          ^~~~~~~
In file included from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/defines.h:139,
                 from /home/kh/Arduino/khoih-prog_working/ESP_WiFiManager_Lite_GitHub/examples/ESP_WiFi/ESP_WiFi.ino:13:
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h: In member function 'void ESP_WiFiManager_Lite::createHTML(String&)':
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:86: error: conversion from 'const __FlashStringHelper*' to 'const StringSumHelper' is ambiguous
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                                                                                      ^
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:393:9: note: candidate: 'StringSumHelper::StringSumHelper(long long unsigned int)' <near match>
         StringSumHelper(unsigned long long num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:393:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'long long unsigned int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:390:9: note: candidate: 'StringSumHelper::StringSumHelper(long long int)' <near match>
         StringSumHelper(long long num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:390:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'long long int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:381:9: note: candidate: 'StringSumHelper::StringSumHelper(long unsigned int)' <near match>
         StringSumHelper(unsigned long num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:381:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'long unsigned int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:378:9: note: candidate: 'StringSumHelper::StringSumHelper(long int)' <near match>
         StringSumHelper(long num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:378:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'long int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:375:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned int)' <near match>
         StringSumHelper(unsigned int num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:375:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'unsigned int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:372:9: note: candidate: 'StringSumHelper::StringSumHelper(int)' <near match>
         StringSumHelper(int num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:372:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'int' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:369:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned char)' <near match>
         StringSumHelper(unsigned char num) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:369:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'unsigned char' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:366:9: note: candidate: 'StringSumHelper::StringSumHelper(char)' <near match>
         StringSumHelper(char c) :
         ^~~~~~~~~~~~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:366:9: note:   conversion of argument 1 would be ill-formed:
In file included from /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/Arduino.h:166,
                 from sketch/ESP_WiFi.ino.cpp:1:
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:39:30: error: invalid conversion from 'const __FlashStringHelper*' to 'char' [-fpermissive]
 #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
                             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kh/Arduino/libraries/ESP_WiFiManager_Lite-1.10.3/src/ESP_WiFiManager_Lite.h:2662:24: note: in expansion of macro 'FPSTR'
         ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);
                        ^~~~~
/home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/cores/esp32/WString.h:186:34: note:   initializing argument 1 of 'StringSumHelper& operator+(const StringSumHelper&, const String&)'
         friend StringSumHelper & operator +(const StringSumHelper &lhs, const String &rhs);
                                  ^~~~~~~~
Multiple libraries were found for "WiFi.h"
 Used: /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/libraries/WiFi
 Not used: /home/kh/Downloads/Arduino/arduino-1.8.19/libraries/WiFi
 Not used: /home/kh/Arduino/libraries/Seeed_Arduino_WiFi_v1-0-2
 Not used: /home/kh/Arduino/libraries/WiFiNINA
 Not used: /home/kh/Arduino/libraries/WiFiEspAT
Multiple libraries were found for "WebServer.h"
 Used: /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/libraries/WebServer
 Not used: /home/kh/Arduino/libraries/Seeed_Arduino_WiFi_v1-0-2
Multiple libraries were found for "DNSServer.h"
 Used: /home/kh/.arduino15/packages/esp32/hardware/esp32/2.0.6/libraries/DNSServer
 Not used: /home/kh/Arduino/libraries/Seeed_Arduino_WiFi_v1-0-2
exit status 1
Error compiling for board ESP32 Dev Module.

@khoih-prog
Copy link
Owner

You can just change to

ListOfSSIDs += String(FPSTR(ESP_WM_LITE_OPTION_START)) + String(WiFi.SSID(indices[i])) + String(FPSTR(ESP_WM_LITE_OPTION_END));

from

ListOfSSIDs += FPSTR(ESP_WM_LITE_OPTION_START) + String(WiFi.SSID(indices[i])) + FPSTR(ESP_WM_LITE_OPTION_END);

@khoih-prog khoih-prog merged commit 1a5b5df into khoih-prog:main Jan 27, 2023
@khoih-prog
Copy link
Owner

HI @hmueller01

I modified the code as I think you're busy now. Merging now.

Thanks,

@hmueller01
Copy link
Contributor Author

I compiled with ESP8266 environment and had no warning. I forgot to test with ESP32 and your examples. Sorry. Tx for fixing!

@khoih-prog
Copy link
Owner

Thanks for your good works. Waiting for your PROGMEM PRs for the ESPAsync_WiFiManager_Lite library, and even many more.

Now I hope you could start experiencing the time-consuming and having to pay attention to all aspects when managing libraries, especially multi-function, multi-platform ones. You'll certainly do much better work in the future.

khoih-prog added a commit that referenced this pull request Jan 27, 2023
### Release v1.10.4

1. Using PROGMEM for HTML strings. Check [move HTML char* into PROGMEM #35](#35)
@khoih-prog
Copy link
Owner

Hi @hmueller01

The new ESP_WiFiManager_Lite releases v1.10.4 has just been published. Your contribution is added to the longer-everyday list in Contributions and Thanks

Best Regards,


Release v1.10.4

  1. Using PROGMEM for HTML strings. Check move HTML char* into PROGMEM #35

@hmueller01 hmueller01 deleted the progmem branch March 16, 2023 19:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants