Skip to content

Update/upgrade OTAWebUpdater.ino example #8839

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

Merged
merged 4 commits into from
Nov 9, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Changes requested by @me-no-dev
  • Loading branch information
lbernstone committed Nov 9, 2023
commit 524fc4af6c5b91a2401ef00428468c0386e9f837
10 changes: 5 additions & 5 deletions libraries/Update/examples/OTAWebUpdater/OTAWebUpdater.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <Ticker.h>
#include "html.h"

#define SSID_FORMAT "ESP32-%06X" // 12 chars total
#define SSID_FORMAT "ESP32-%06lX" // 12 chars total
//#define PASSWORD "test123456" // generate if remarked

WebServer server(80);
Expand All @@ -21,16 +21,16 @@ String generatePass(uint8_t str_len) {
}

void apMode() {
WiFi.mode(WIFI_AP);
char ssid[13];
char passwd[11];
uint32_t espmac = ESP.getEfuseMac() >> 24;
long unsigned int espmac = ESP.getEfuseMac() >> 24;
snprintf(ssid, 13, SSID_FORMAT, espmac);
#ifdef PASSWORD
snprintf(passwd, 11, PASSWORD);
#else
snprintf(passwd, 11, "%s", generatePass(10).c_str());
snprintf(passwd, 11, generatePass(10).c_str());
#endif
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid, passwd); // Set up the SoftAP
MDNS.begin("esp32");
Serial.printf("AP: %s, PASS: %s\n", ssid, passwd);
Expand Down Expand Up @@ -82,7 +82,7 @@ void webServerInit() {
});
server.onNotFound([]() {server.send(200, "text/html", indexHtml);});
server.begin();
Serial.printf("Web Server ready at http://esp32.local or http://%s\n", WiFi.softAPIP().toString());
Serial.printf("Web Server ready at http://esp32.local or http://%s\n", WiFi.softAPIP().toString().c_str());
}

void everySecond() {
Expand Down