platform: arduino: wifi: use new hostname api to set up mdns

This commit is contained in:
Torrie Fischer 2023-12-23 11:05:24 +01:00
parent cc9c719e3c
commit 19f2a4f35c

View File

@ -3,10 +3,13 @@
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#endif
#ifdef ESP32
#include <WiFi.h>
#include "ESPmDNS.h"
#endif
#include "Static.h"
#include "WiFiTask.h"
@ -18,6 +21,11 @@ WiFiTask::onStart()
Log.notice("Starting wifi...");
WiFi.mode(WIFI_STA);
WiFi.begin("The Frequency", "thepasswordkenneth");
if (MDNS.begin(Platform::deviceHostname().c_str())) {
Log.notice("mDNS started with hostname %s", Platform::deviceHostname().c_str());
} else {
Log.error("mDNS failed to start!");
}
}
InputEvent