Skip to content

Commit

Permalink
Properly allocate string and remove warning (#2652)
Browse files Browse the repository at this point in the history
* Properly allocate string and remove warning

The former way generates the following warning:
ISO C++ forbids converting a string constant to 'char*'

This change makes a character array the size of the string with null ending. It's clearer and gets rid of the warning.

* Better way

Since this is technically immutable, the type should reflect this too.
  • Loading branch information
Arsham Skrenes authored and me-no-dev committed Apr 12, 2019
1 parent 25c0b52 commit 1412606
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/ESP32/examples/ESPNow/Basic/Slave/Slave.ino
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void InitESPNow() {

// config AP SSID
void configDeviceAP() {
char* SSID = "Slave_1";
const char *SSID = "Slave_1";
bool result = WiFi.softAP(SSID, "Slave_1_Password", CHANNEL, 0);
if (!result) {
Serial.println("AP Config failed.");
Expand Down

0 comments on commit 1412606

Please sign in to comment.