Closed
Description
Basic Infos
- [ x ] This issue complies with the issue POLICY doc.
- [ x ] I have read the documentation at readthedocs and the issue is not addressed there.
- [ x ] I have tested that the issue is present in current master branch (aka latest git).
- [ x ] I have searched the issue tracker for a similar issue.
- [ x ] If there is a stack dump, I have decoded it.
- [ x ] I have filled out all fields below.
Platform
- Hardware: ESP-12
- Core Version: 2.6.3
- Development Env: Arduino IDE
- Operating System: Windows
Settings in IDE
- Module: Wemos D1 mini r2 & Feather Huzzah
- Flash Mode: qio
- Flash Size: 4MB
- lwip Variant: v2 Lower Memory
- Reset Method:
- Flash Frequency: 40Mhz
- CPU Frequency: 80Mhz
- Upload Using: OTA & SERIAL
- Upload Speed: 115200
Problem Description
ESP8266HTTPUpdateServer
example WebUpdater
mDNS does not work. Everything else seems to work as expected. Tried on multiple boards both OTA and Serial uploads. Tried reinstalling board definitions. If I change Wifi.mode(WIFI_AP_STA)
to Wifi.mode(WIFI_STA)
then it works! Likely mDNS library does not expect basic service to work in AP mode (which makes sense).
I'm thinking it's just a legacy error in the example code, but it could be a problem with the mDNS library?
MCVE Sketch
This is the slightly modified example code:
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
#ifndef STASSID
#define STASSID "your-ssid"
#define STAPSK "your-password"
#endif
const char* host = "esp8266-update";
const char* ssid = STASSID;
const char* password = STAPSK;
ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;
void setup(void) {
Serial.begin(115200);
Serial.println();
Serial.println("Booting Sketch...");
// WiFi.mode(WIFI_AP_STA); // THIS DOES NOT WORK
WiFi.mode(WIFI_STA); // THIS WORKS FINE
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
WiFi.begin(ssid, password);
Serial.println("WiFi failed, retrying.");
}
MDNS.begin(host);
httpUpdater.setup(&httpServer);
httpServer.begin();
MDNS.addService("http", "tcp", 80);
Serial.printf("HTTPUpdateServer ready! Open http://%s.local/update in your browser\n", host);
}
void loop(void) {
httpServer.handleClient();
MDNS.update();
}
Metadata
Metadata
Assignees
Labels
No labels