-
Notifications
You must be signed in to change notification settings - Fork 11
/
config.h
159 lines (143 loc) · 3.37 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#ifndef CONFIG_H_
#define CONFIG_H_
#include <Arduino.h>
#include <CircularBuffer.h>
#include "version.h"
// #define DEBUG
// ESP32 PINS TO CONTROL LAN8720
#define ETH_CLK_MODE_1 ETH_CLOCK_GPIO17_OUT
#define ETH_POWER_PIN_ALTERNATIVE_1 5
#define ETH_POWER_PIN_1 -1
#define ETH_TYPE_1 ETH_PHY_LAN8720
#define ETH_ADDR_1 0
#define ETH_MDC_PIN_1 23
#define ETH_MDIO_PIN_1 18
// ESP32 PINS TO CONTROL CC2652P
#define CC2652P_RST 16
#define CC2652P_FLASH 32
#define CC2652P_RXD 36
#define CC2652P_TXD 4
#define BTN 35
#define MODE_SWITCH 33
#define DEBOUNCE_TIME 70
#define TCP_LISTEN_PORT 9999
#define FORMAT_LITTLEFS_IF_FAILED true
// CC2652 settings (FOR BSL VALIDATION!)
#define NEED_BSL_PIN 15 // CC2652 pin number (FOR BSL VALIDATION!)
#define NEED_BSL_LEVEL 0 // 0-LOW 1-HIGH
const int16_t overseerInterval = 5 * 1000; // check lan or wifi connection every 5sec
const uint8_t overseerMaxRetry = 3; // 5x12 = 60sec delay for AP start
const uint8_t LED_USB = 12; // RED
const uint8_t LED_PWR = 14; // BLUE
const uint8_t MAX_SOCKET_CLIENTS = 5;
enum COORDINATOR_MODE_t : uint8_t
{
COORDINATOR_MODE_LAN,
COORDINATOR_MODE_WIFI,
COORDINATOR_MODE_USB
};
extern const char *coordMode;// coordMode node name
extern const char *prevCoordMode;// prevCoordMode node name
extern const char *configFileSystem;
extern const char *configFileWifi;
extern const char *configFileEther;
extern const char *configFileGeneral;
extern const char *configFileSecurity;
extern const char *configFileSerial;
extern const char *configFileMqtt;
extern const char *configFileWg;
extern const char *deviceModel;
struct ConfigSettingsStruct
{
char ssid[50];
char password[50];
char ipAddressWiFi[18];
char ipMaskWiFi[16];
char ipGWWiFi[18];
bool dhcpWiFi;
bool dhcp;
bool connectedEther;
char ipAddress[18];
char ipMask[16];
char ipGW[18];
int serialSpeed;
int socketPort;
bool disableWeb;
int refreshLogs;
char hostname[50];
bool connectedSocket[10];
int connectedClients;
unsigned long socketTime;
int tempOffset;
bool webAuth;
char webUser[50];
char webPass[50];
bool disableLedUSB;
bool disableLedPwr;
// bool disablePingCtrl;
bool disableLeds;
COORDINATOR_MODE_t coordinator_mode;
COORDINATOR_MODE_t prevCoordinator_mode; // for button
bool keepWeb;
bool apStarted;
bool wifiWebSetupInProgress;
bool fwEnabled;
IPAddress fwIp;
bool zbLedState;
bool zbFlashing;
char timeZone[50];
};
struct MqttSettingsStruct
{
bool enable;
char server[50];
IPAddress serverIP;
int port;
char user[50];
char pass[50];
char topic[50];
// bool retain;
int interval;
bool discovery;
unsigned long reconnectTime;
unsigned long heartbeatTime;
};
struct WgSettingsStruct
{
bool enable;
bool init = 0;
char localAddr[20];
IPAddress localIP;
char localPrivKey[45];
char endAddr[45];
char endPubKey[45];
int endPort;
};
/*
struct InfosStruct
{
char device[8];
char mac[8];
char flash[8];
};
*/
struct zbVerStruct
{
uint32_t zbRev;
uint8_t maintrel;
uint8_t minorrel;
uint8_t majorrel;
uint8_t product;
uint8_t transportrev;
String chipID;
};
typedef CircularBuffer<char, 8024> LogConsoleType;
// #define WL_MAC_ADDR_LENGTH 6
#ifdef DEBUG
#define DEBUG_PRINT(x) Serial.print(String(x))
#define DEBUG_PRINTLN(x) Serial.println(String(x))
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTLN(x)
#endif
#endif