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 #ifdef ESP8266
#include <ESP8266WiFi.h> #include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#endif #endif
#ifdef ESP32 #ifdef ESP32
#include <WiFi.h> #include <WiFi.h>
#include "ESPmDNS.h"
#endif #endif
#include "Static.h" #include "Static.h"
#include "WiFiTask.h" #include "WiFiTask.h"
@ -18,6 +21,11 @@ WiFiTask::onStart()
Log.notice("Starting wifi..."); Log.notice("Starting wifi...");
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin("The Frequency", "thepasswordkenneth"); 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 InputEvent