-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwifi.h
45 lines (33 loc) · 898 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
44
45
#ifndef WIFI_H
#define WIFI_H
#include <ESP8266WiFi.h>
#include "fileio.h"
IPAddress local_ip;
IPAddress gateway;
IPAddress subnet;
void print_WiFi() {
Serial.println(F("[INFO] Access Point started"));
Serial.print(F("[INFO] IP Address: "));
Serial.println(WiFi.softAPIP());
}
void reload_wifi_config() {
local_ip.fromString(ipConfig.ip);
gateway.fromString(ipConfig.gateway);
subnet.fromString(ipConfig.subnet);
}
void restart_wifi() {
WiFi.softAPdisconnect();
WiFi.mode(WIFI_AP);
reload_wifi_config();
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(config.ssid, config.pass);
print_WiFi();
}
void start_wifi() {
WiFi.mode(WIFI_AP);
reload_wifi_config();
WiFi.softAPConfig(local_ip, gateway, subnet);
WiFi.softAP(config.ssid, config.pass);
print_WiFi();
}
#endif