-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmaxx-wifi-controller.ino
58 lines (45 loc) · 1.11 KB
/
maxx-wifi-controller.ino
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifdef ESP32
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <mDNS.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncWebSrv.h>
#include <ESP8266mDNS.h>
#endif
#include <EEPROM.h>
// Fixed Values
int IRledPin = 5; //D1 Port
const char* WiFi_Hostname = "maxxwifi";
const char* WiFi_AP_SSID = "Maxx-Wifi-Controller";
const char* WiFi_AP_Password = "12345678";
bool Load_WiFi_SSID_From_Eeprom(void);
bool Load_WiFi_Password_From_Eeprom(void);
boolean requestReboot = false;
boolean WiFi_Status_Up = false;
String WiFi_Stored_SSID;
String WiFi_Stored_Password = "";
String WiFi_List[50];
String WiFi_Ip_Adresse;
AsyncWebServer server(80);
void setup()
{
pinMode(IRledPin, OUTPUT);
Serial.begin(9600);
EEPROM.begin(512);
delay(100);
Serial.println("-= Maxx-WiFi-Controller =-");
setup_wifi();
setup_webserver();
Serial.printf("Open http://%s or http://%s.local\n", WiFi_Ip_Adresse.c_str(), WiFi_Hostname);
}
void loop()
{
if (requestReboot) {
Serial.println("Restart Maxx-Wifi-Controller...");
delay(500);
server.reset();
ESP.restart();
}
MDNS.update();
}