Skip to content

Commit

Permalink
Fix LeamDNS examples (esp8266#5563)
Browse files Browse the repository at this point in the history
* Fix LeamDNS examples

* Fix Style check error

* Another style fix
  • Loading branch information
hreintke authored and devyte committed Dec 29, 2018
1 parent eb5d636 commit 62b8ac6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions libraries/ESP8266mDNS/examples/LEAmDNS/mDNS_Clock/mDNS_Clock.ino
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
p_pMDNSResponder->setDynamicServiceTxtCallback(hMDNSService, MDNSDynamicServiceTxtCallback, 0);
}
}
}
} else {
// Change hostname, use '-' as divider between base name and index
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
p_pMDNSResponder->setHostname(pcHostDomain);
} else {
// Change hostname, use '-' as divider between base name and index
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
p_pMDNSResponder->setHostname(pcHostDomain);
} else {
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
}
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
}
}
}
Expand Down Expand Up @@ -241,8 +241,8 @@ void handleHTTPClient(WiFiClient& client) {
if (req == "/") {
IPAddress ip = WiFi.localIP();
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
s += ipStr;
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
s += WiFi.hostname() + " at " + ipStr;
// Simple addition of the current time
s += "\r\nCurrent time is: ";
s += getTimeString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ bool MDNSProbeResultCallback(MDNSResponder* p_pMDNSResponder,
}
}
}
}
} else {
// Change hostname, use '-' as divider between base name and index
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
p_pMDNSResponder->setHostname(pcHostDomain);
} else {
// Change hostname, use '-' as divider between base name and index
if (MDNSResponder::indexDomain(pcHostDomain, "-", 0)) {
p_pMDNSResponder->setHostname(pcHostDomain);
} else {
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
}
Serial.println("MDNSProbeResultCallback: FAILED to update hostname!");
}
}
}
Expand Down Expand Up @@ -280,8 +280,8 @@ void handleHTTPClient(WiFiClient& client) {
if (req == "/") {
IPAddress ip = WiFi.localIP();
String ipStr = String(ip[0]) + '.' + String(ip[1]) + '.' + String(ip[2]) + '.' + String(ip[3]);
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ESP8266 at ";
s += ipStr;
s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n<!DOCTYPE HTML>\r\n<html>Hello from ";
s += WiFi.hostname() + " at " + ipStr;
// Simple addition of the current time
s += "<br/>Local HTTP services:<br/>";
s += strHTTPServices;
Expand Down

0 comments on commit 62b8ac6

Please sign in to comment.