mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-20 08:41:41 +00:00
RP2040: Add mDNS support
This commit is contained in:
parent
cd837a7716
commit
94dd567186
@ -20,6 +20,8 @@
|
|||||||
#include <ESPmDNS.h>
|
#include <ESPmDNS.h>
|
||||||
#include <esp_wifi.h>
|
#include <esp_wifi.h>
|
||||||
static void WiFiEvent(WiFiEvent_t event);
|
static void WiFiEvent(WiFiEvent_t event);
|
||||||
|
#else // ARCH_RP2040
|
||||||
|
#include <SimpleMDNS.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DISABLE_NTP
|
#ifndef DISABLE_NTP
|
||||||
@ -59,17 +61,19 @@ static void onNetworkConnected()
|
|||||||
// Start web server
|
// Start web server
|
||||||
LOG_INFO("Start WiFi network services");
|
LOG_INFO("Start WiFi network services");
|
||||||
|
|
||||||
|
// start mdns
|
||||||
#ifdef ARCH_ESP32
|
#ifdef ARCH_ESP32
|
||||||
// start mdns
|
|
||||||
if (!MDNS.begin("Meshtastic")) {
|
if (!MDNS.begin("Meshtastic")) {
|
||||||
LOG_ERROR("Error setting up MDNS responder!");
|
LOG_ERROR("Error setting up MDNS responder!");
|
||||||
} else {
|
} else {
|
||||||
LOG_INFO("mDNS responder started");
|
|
||||||
LOG_INFO("mDNS Host: Meshtastic.local");
|
LOG_INFO("mDNS Host: Meshtastic.local");
|
||||||
MDNS.addService("http", "tcp", 80);
|
MDNS.addService("http", "tcp", 80);
|
||||||
MDNS.addService("https", "tcp", 443);
|
MDNS.addService("https", "tcp", 443);
|
||||||
}
|
}
|
||||||
#else // ESP32 handles this in WiFiEvent
|
#else
|
||||||
|
MDNS.begin("Meshtastic");
|
||||||
|
// ARCH_RP2040 does not support HTTPS
|
||||||
|
MDNS.addService("meshtastic", "tcp", 4403);
|
||||||
LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str());
|
LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -106,7 +110,7 @@ static void onNetworkConnected()
|
|||||||
APStartupComplete = true;
|
APStartupComplete = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected'
|
// FIXME this is kinda yucky, instead we should just have an observable for 'wifireconnected'
|
||||||
#ifndef MESHTASTIC_EXCLUDE_MQTT
|
#ifndef MESHTASTIC_EXCLUDE_MQTT
|
||||||
if (mqtt)
|
if (mqtt)
|
||||||
mqtt->reconnect();
|
mqtt->reconnect();
|
||||||
|
Loading…
Reference in New Issue
Block a user