-
Notifications
You must be signed in to change notification settings - Fork 0
/
wifi.h
43 lines (38 loc) · 862 Bytes
/
wifi.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#pragma once
#include <Run.h>
#ifdef ESP8266
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <ESP8266LLMNR.h>
#else
#include <WiFi.h>
#include <ESPmDNS.h>
#endif
#include <time.h>
uint32_t wifiWait() {
if (WiFi.status() == WL_CONNECTED) {
Serial.println("");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
if (!MDNS.begin(sysName.c_str())) {
TDEBUG("[mDNS: failed]");
} else {
MDNS.addService("http", "tcp", 80); // Add service to MDNS-SD
TDEBUG("[mDNS: started]");
}
// LLMNR
#ifdef ESP8266
LLMNR.begin(sysName.c_str());
TDEBUG("[LLMNR: started]");
#endif
return RUN_DELETE;
}
TDEBUG(".");
return 500;
}
uint32_t wifiInit() {
WiFi.begin("E2", "fOlissio92");
//WiFi.begin("EW", "iMpress6264");
taskAdd(wifiWait);
return RUN_DELETE;
}