mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-09 07:05:54 +02:00
Enhancement: mDNS Support in WiFi AP-Mode
This commit is contained in:
parent
c71377011b
commit
b2a0a24c2d
1 changed files with 11 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#define F(sl) (sl)
|
||||
#endif
|
||||
#include "ahoywifi.h"
|
||||
#include <ESP8266mDNS.h>
|
||||
|
||||
// NTP CONFIG
|
||||
#define NTP_PACKET_SIZE 48
|
||||
|
@ -83,6 +84,7 @@ void ahoywifi::tickWifiLoop() {
|
|||
if (mGotDisconnect) {
|
||||
mStaConn = RESET;
|
||||
}
|
||||
MDNS.update();
|
||||
return;
|
||||
case IN_AP_MODE:
|
||||
if (WiFi.softAPgetStationNum() == 0) {
|
||||
|
@ -180,6 +182,15 @@ void ahoywifi::tickWifiLoop() {
|
|||
mAppWifiCb(true);
|
||||
mGotDisconnect = false;
|
||||
mStaConn = IN_STA_MODE;
|
||||
|
||||
if (!MDNS.begin(mConfig->sys.deviceName)) {
|
||||
DPRINTLN(DBG_ERROR, F("Error setting up MDNS responder!"));
|
||||
} else {
|
||||
DBGPRINT(F("[WiFi] mDNS established: "));
|
||||
DBGPRINT(mConfig->sys.deviceName);
|
||||
DBGPRINTLN(F(".local"));
|
||||
}
|
||||
|
||||
break;
|
||||
case RESET:
|
||||
mGotDisconnect = false;
|
||||
|
@ -245,7 +256,6 @@ void ahoywifi::setupStation(void) {
|
|||
WiFi.hostname(mConfig->sys.deviceName);
|
||||
WiFi.mode(WIFI_AP_STA);
|
||||
|
||||
|
||||
DBGPRINT(F("connect to network '"));
|
||||
DBGPRINT(mConfig->sys.stationSsid);
|
||||
DBGPRINTLN(F("' ..."));
|
||||
|
|
Loading…
Add table
Reference in a new issue