-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathConfig.h
95 lines (75 loc) · 1.76 KB
/
Config.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Config.h
#ifndef _CONFIG_h
#define _CONFIG_h
//#define DEBUG
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
//#define CONNECTION_LED 0 // Connection LED pin (External)
#define CONNECTION_LED 2 // Connection LED pin (Built in)
#define AP_ENABLE_BUTTON 4 // Button pin to enable AP during startup for configuration
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ArduinoJson.h>
typedef struct {
String ssid;
String password;
byte IP[4];
byte Netmask[4];
byte Gateway[4];
byte DNS[4];
boolean dhcp;
String ntpServerName;
long Update_Time_Via_NTP_Every;
long timezone;
boolean daylight;
String DeviceName;
//int connectionLed;
} strConfig;
typedef struct {
String APssid = "ESP"; // ChipID is appended to this name
String APpassword = "12345678";
boolean APenable = false; // AP disabled by default
} strApConfig;
typedef struct {
boolean auth;
String wwwUsername;
String wwwPassword;
} strHTTPAuth;
extern strConfig config; // General and WiFi configuration
extern strApConfig apConfig; // Static AP config settings
extern strHTTPAuth httpAuth;
/**
* converts a single hex digit character to its integer value
* @param[in] hex character
* @param[out] number that represents hex digit
*/
unsigned char h2int(char c);
/**
* Loads default system configuration
*/
void defaultConfig();
/**
* Loads system configuration from SPIFFS file
* @param[out] true if OK
*/
boolean load_config();
/**
* Saves system configuration to SPIFFS file
* @param[out] true if OK
*/
boolean save_config();
/**
* Loads HTTP secret from SPIFFS file
* @param[out] true if OK
*/
boolean loadHTTPAuth();
/**
* Saves HTTP secret to SPIFFS file
* @param[out] true if OK
*/
boolean saveHTTPAuth();
#endif