mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-14 11:25:56 +08:00
Add Compilation Condition for mDNS
Add Compilation Condition for mDNS as not mandatory
This commit is contained in:
parent
d90932a7cb
commit
29339aee3c
@ -37,7 +37,9 @@
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#if MDNS_FEATURE
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
@ -83,8 +85,10 @@ void setup() {
|
||||
|
||||
//main loop
|
||||
void loop() {
|
||||
#if MDNS_FEATURE
|
||||
// Check for any mDNS queries and send responses
|
||||
wifi_config.mdns.update();
|
||||
#endif
|
||||
//web requests
|
||||
web_interface.WebServer.handleClient();
|
||||
//TODO use a method to handle serial also in class and call it instead of this one
|
||||
|
@ -22,7 +22,9 @@
|
||||
#include "config.h"
|
||||
#include "ESP8266WiFi.h"
|
||||
#include "IPAddress.h"
|
||||
#if MDNS_FEATURE
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
extern "C" {
|
||||
#include "user_interface.h"
|
||||
}
|
||||
@ -132,6 +134,7 @@ bool WIFI_CONFIG::Setup()
|
||||
if (wifi_get_opmode()==WIFI_AP || wifi_get_opmode()==WIFI_AP_STA) configAP( local_ip, gateway, subnet);
|
||||
else WiFi.config( local_ip, gateway, subnet);
|
||||
}
|
||||
#if MDNS_FEATURE
|
||||
//Get IP
|
||||
if (wifi_get_opmode()==WIFI_STA)currentIP=WiFi.localIP();
|
||||
else currentIP=WiFi.softAPIP();
|
||||
@ -144,6 +147,7 @@ bool WIFI_CONFIG::Setup()
|
||||
if (!mdns.begin("esp8266", currentIP)) {
|
||||
Serial.println("Error setting up MDNS responder!");
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -21,15 +21,20 @@
|
||||
#ifndef WIFI_h
|
||||
#define WIFI_h
|
||||
#include <Arduino.h>
|
||||
#include "config.h"
|
||||
#include "IPAddress.h"
|
||||
#include <ESP8266WiFi.h>
|
||||
#if MDNS_FEATURE
|
||||
#include <ESP8266mDNS.h>
|
||||
#endif
|
||||
|
||||
class WIFI_CONFIG
|
||||
{
|
||||
public:
|
||||
// multicast DNS responder feature
|
||||
#if MDNS_FEATURE
|
||||
MDNSResponder mdns;
|
||||
#endif
|
||||
bool Setup();
|
||||
char * mac2str(uint8_t mac [WL_MAC_ADDR_LENGTH]);
|
||||
char * ip2str(IPAddress Ip );
|
||||
|
Loading…
x
Reference in New Issue
Block a user