This repository has been archived by the owner on Feb 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
defines.h
191 lines (146 loc) · 6.24 KB
/
defines.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/****************************************************************************************************************************
defines.h
For ESP32 boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
Based on and modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_Manager
Licensed under MIT license
*****************************************************************************************************************************/
#ifndef defines_h
#define defines_h
#ifndef ESP32
#error This code is intended to run on the ESP32 platform! Please check your Tools->Board setting.
#endif
#define BLYNK_PRINT Serial
#define BLYNK_HEARTBEAT 60
#define BLYNK_WM_DEBUG 1
#define USING_MRD true
#if USING_MRD
// These definitions must be placed before #include <ESP_MultiResetDetector.h> to be used
// Otherwise, default values (MRD_TIMES = 3, MRD_TIMEOUT = 10 seconds and MRD_ADDRESS = 0) will be used
// Number of subsequent resets during MRD_TIMEOUT to activate
#define MRD_TIMES 3
// Number of seconds after reset during which a subseqent reset will be considered a mlti reset.
#define MRD_TIMEOUT 10
// RTC/EEPPROM Address for the MultiResetDetector to use
#define MRD_ADDRESS 0
#define MULTIRESETDETECTOR_DEBUG true
#warning Using MultiResetDetector MRD
#else
// These definitions must be placed before #include <ESP_DoubleResetDetector.h> to be used
// Otherwise, default values (DRD_TIMEOUT = 10 seconds and DRD_ADDRESS = 0) will be used
// Number of subsequent resets during DRD_TIMEOUT to activate
// Number of seconds after reset during which a subseqent reset will be considered a mlti reset.
#define DRD_TIMEOUT 10
// RTC/EEPPROM Address for the DoubleResetDetector to use
#define DRD_ADDRESS 0
#define DOUBLERESETDETECTOR_DEBUG true
#warning Using DoubleResetDetector DRD
#endif
// Not use #define USE_LITTLEFS and #define USE_SPIFFS => using SPIFFS for configuration data in WiFiManager
// (USE_LITTLEFS == false) and (USE_SPIFFS == false) => using EEPROM for configuration data in WiFiManager
// (USE_LITTLEFS == true) and (USE_SPIFFS == false) => using LITTLEFS for configuration data in WiFiManager
// (USE_LITTLEFS == true) and (USE_SPIFFS == true) => using LITTLEFS for configuration data in WiFiManager
// (USE_LITTLEFS == false) and (USE_SPIFFS == true) => using SPIFFS for configuration data in WiFiManager
// Those above #define's must be placed before #include <BlynkSimpleEsp32_WFM.h>
#define USE_LITTLEFS true
#define USE_SPIFFS false
#if USE_LITTLEFS
#define CurrentFileFS F("LittleFS")
#elif USE_SPIFFS
#define CurrentFileFS F("SPIFFS")
#else
#define CurrentFileFS F("EEPROM")
// EEPROM_SIZE must be <= 2048 and >= CONFIG_DATA_SIZE (currently 172 bytes)
#define EEPROM_SIZE (2 * 1024)
// EEPROM_START + CONFIG_DATA_SIZE must be <= EEPROM_SIZE
#define EEPROM_START 0
#endif
// Force some params in Blynk, only valid for library version 1.0.1 and later
#define TIMEOUT_RECONNECT_WIFI 10000L
#define RESET_IF_CONFIG_TIMEOUT true
#define CONFIG_TIMEOUT_RETRYTIMES_BEFORE_RESET 5
// Config Timeout 120s (default 60s)
#define CONFIG_TIMEOUT 120000L
// Those above #define's must be placed before #include <BlynkSimpleEsp8266_WM.h>
// TTGO T-Call pin definitions
#define MODEM_RST 5
#define MODEM_PWKEY 4
#define MODEM_POWER_ON 23
#define MODEM_TX 27
#define MODEM_RX 26
#define I2C_SDA 21
#define I2C_SCL 22
// Select your modem:
#define TINY_GSM_MODEM_SIM800
//#define TINY_GSM_MODEM_SIM808
//#define TINY_GSM_MODEM_SIM868
//#define TINY_GSM_MODEM_SIM900
//#define TINY_GSM_MODEM_SIM5300
//#define TINY_GSM_MODEM_SIM5320
//#define TINY_GSM_MODEM_SIM5360
//#define TINY_GSM_MODEM_SIM7000
//#define TINY_GSM_MODEM_SIM7100
//#define TINY_GSM_MODEM_SIM7500
//#define TINY_GSM_MODEM_SIM7600
//#define TINY_GSM_MODEM_SIM7800
//#define TINY_GSM_MODEM_UBLOX
//#define TINY_GSM_MODEM_SARAR4
//#define TINY_GSM_MODEM_M95
//#define TINY_GSM_MODEM_BG96
//#define TINY_GSM_MODEM_A6
//#define TINY_GSM_MODEM_A7
//#define TINY_GSM_MODEM_M590
//#define TINY_GSM_MODEM_MC60
//#define TINY_GSM_MODEM_MC60E
//#define TINY_GSM_MODEM_XBEE
//#define TINY_GSM_MODEM_SEQUANS_MONARCH
// Increase RX buffer if needed
#define TINY_GSM_RX_BUFFER 1024
#include <TinyGsmClient.h>
//#define USE_BLYNK_WM false
#define USE_BLYNK_WM true
#include <BlynkSimpleTinyGSM_M.h>
#if USE_BLYNK_WM
#define USE_DYNAMIC_PARAMETERS true
#include <BlynkSimpleEsp32_GSM_WFM.h>
#else
#include <BlynkSimpleEsp32_GSM_WF.h>
// Your WiFi credentials.
#define ssid "****"
#define pass "****"
#define USE_LOCAL_SERVER true
//#define USE_LOCAL_SERVER false
#if USE_LOCAL_SERVER
#define wifi_blynk_tok "****"
#define gsm_blynk_tok "****"
//#define blynk_server "account.duckdns.org"
// Use direct IPAddress in case GPRS can't use DDNS fast enough and can't connect
#define blynk_server "xxx.xxx.xxx.xxx"
#else
#define wifi_blynk_tok "****"
#define gsm_blynk_tok "****"
#define blynk_server "blynk-cloud.com"
#endif
#define apn "rogers-core-appl1.apn"
#define gprsUser "" //"wapuser1"
#define gprsPass "" //"wap"
#endif //USE_BLYNK_WM
#define BLYNK_HARDWARE_PORT 8080
// Set serial for debug console (to the Serial Monitor, default speed 115200)
#define SerialMon Serial
#define RXD2 16
#define TXD2 17
// Use ESP32 Serial2 for GSM
#define SerialAT Serial2
// Uncomment this if you want to see all AT commands
#define DUMP_AT_COMMANDS false
#if DUMP_AT_COMMANDS
#include <StreamDebugger.h>
StreamDebugger debugger(SerialAT, SerialMon);
TinyGsm modem(debugger);
#else
TinyGsm modem(SerialAT);
#endif
#define HOST_NAME "ESP32-GSM-WiFi"
#endif //defines_h