Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit 76ad904

Browse files
authored
v1.12.2 to optimize code, etc.
### Releases v1.12.2 1. Optimize code by using passing by `reference` instead of by `value` 2. Delete all confusing, function-lacking `minimal` examples 3. Delete all `Modeless` examples 4. Display informational warnings only when `_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3`
1 parent 9ae37f1 commit 76ad904

File tree

21 files changed

+609
-281
lines changed

21 files changed

+609
-281
lines changed

examples/Async_AutoConnect/Async_AutoConnect.ino

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
1919
#endif
2020

21-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.1"
22-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012001
21+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.2"
22+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012002
2323

2424
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
2525
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3
@@ -51,15 +51,21 @@
5151
// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
5252
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2)
5353
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
54-
#warning Using ESP32 Core 1.0.6 or 2.0.0+
54+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
55+
#warning Using ESP32 Core 1.0.6 or 2.0.0+
56+
#endif
57+
5558
// The library has been merged into esp32 core from release 1.0.6
5659
#include <LittleFS.h> // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS
5760

5861
FS* filesystem = &LittleFS;
5962
#define FileFS LittleFS
6063
#define FS_Name "LittleFS"
6164
#else
62-
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
65+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
66+
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
67+
#endif
68+
6369
// The library has been merged into esp32 core from release 1.0.6
6470
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
6571

@@ -200,30 +206,39 @@ bool initialConfig = false;
200206

201207
// New in v1.0.11
202208
#define USING_CORS_FEATURE true
203-
//////
209+
210+
////////////////////////////////////////////
204211

205212
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
206213
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
207-
// Force DHCP to be true
214+
// Force DHCP to be true
208215
#if defined(USE_DHCP_IP)
209216
#undef USE_DHCP_IP
210217
#endif
211218
#define USE_DHCP_IP true
212219
#else
213220
// You can select DHCP or Static IP here
214-
//#define USE_DHCP_IP true
215-
#define USE_DHCP_IP false
221+
#define USE_DHCP_IP true
222+
//#define USE_DHCP_IP false
216223
#endif
217224

218-
#if ( USE_DHCP_IP || ( defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP ) )
225+
#if ( USE_DHCP_IP )
219226
// Use DHCP
220-
#warning Using DHCP IP
227+
228+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
229+
#warning Using DHCP IP
230+
#endif
231+
221232
IPAddress stationIP = IPAddress(0, 0, 0, 0);
222233
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
223234
IPAddress netMask = IPAddress(255, 255, 255, 0);
235+
224236
#else
225237
// Use static IP
226-
#warning Using static IP
238+
239+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
240+
#warning Using static IP
241+
#endif
227242

228243
#ifdef ESP32
229244
IPAddress stationIP = IPAddress(192, 168, 2, 232);
@@ -235,6 +250,9 @@ bool initialConfig = false;
235250
IPAddress netMask = IPAddress(255, 255, 255, 0);
236251
#endif
237252

253+
////////////////////////////////////////////
254+
255+
238256
#define USE_CONFIGURABLE_DNS true
239257

240258
IPAddress dns1IP = gatewayIP;

examples/Async_AutoConnectWithFSParameters/Async_AutoConnectWithFSParameters.ino

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
2020
#endif
2121

22-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.1"
23-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012001
22+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.2"
23+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012002
2424

2525
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
2626
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3
@@ -54,15 +54,21 @@
5454
// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
5555
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2)
5656
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
57-
#warning Using ESP32 Core 1.0.6 or 2.0.0+
57+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
58+
#warning Using ESP32 Core 1.0.6 or 2.0.0+
59+
#endif
60+
5861
// The library has been merged into esp32 core from release 1.0.6
5962
#include <LittleFS.h> // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS
6063

6164
FS* filesystem = &LittleFS;
6265
#define FileFS LittleFS
6366
#define FS_Name "LittleFS"
6467
#else
65-
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
68+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
69+
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
70+
#endif
71+
6672
// The library has been merged into esp32 core from release 1.0.6
6773
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
6874

@@ -215,30 +221,39 @@ String AP_PASS;
215221

216222
// New in v1.0.11
217223
#define USING_CORS_FEATURE true
218-
//////
224+
225+
////////////////////////////////////////////
219226

220227
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
221228
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
222-
// Force DHCP to be true
229+
// Force DHCP to be true
223230
#if defined(USE_DHCP_IP)
224231
#undef USE_DHCP_IP
225232
#endif
226233
#define USE_DHCP_IP true
227234
#else
228235
// You can select DHCP or Static IP here
229-
//#define USE_DHCP_IP true
230-
#define USE_DHCP_IP false
236+
#define USE_DHCP_IP true
237+
//#define USE_DHCP_IP false
231238
#endif
232239

233240
#if ( USE_DHCP_IP )
234241
// Use DHCP
235-
#warning Using DHCP IP
242+
243+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
244+
#warning Using DHCP IP
245+
#endif
246+
236247
IPAddress stationIP = IPAddress(0, 0, 0, 0);
237248
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
238249
IPAddress netMask = IPAddress(255, 255, 255, 0);
250+
239251
#else
240252
// Use static IP
241-
#warning Using static IP
253+
254+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
255+
#warning Using static IP
256+
#endif
242257

243258
#ifdef ESP32
244259
IPAddress stationIP = IPAddress(192, 168, 2, 232);
@@ -250,6 +265,9 @@ String AP_PASS;
250265
IPAddress netMask = IPAddress(255, 255, 255, 0);
251266
#endif
252267

268+
////////////////////////////////////////////
269+
270+
253271
#define USE_CONFIGURABLE_DNS true
254272

255273
IPAddress dns1IP = gatewayIP;

examples/Async_AutoConnectWithFSParametersAndCustomIP/Async_AutoConnectWithFSParametersAndCustomIP.ino

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
2020
#endif
2121

22-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.1"
23-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012001
22+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.2"
23+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012002
2424

2525
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
2626
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3
@@ -55,15 +55,21 @@
5555
// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
5656
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2)
5757
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
58-
#warning Using ESP32 Core 1.0.6 or 2.0.0+
58+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
59+
#warning Using ESP32 Core 1.0.6 or 2.0.0+
60+
#endif
61+
5962
// The library has been merged into esp32 core from release 1.0.6
6063
#include <LittleFS.h> // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS
6164

6265
FS* filesystem = &LittleFS;
6366
#define FileFS LittleFS
6467
#define FS_Name "LittleFS"
6568
#else
66-
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
69+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
70+
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
71+
#endif
72+
6773
// The library has been merged into esp32 core from release 1.0.6
6874
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
6975

@@ -213,39 +219,52 @@ String AP_PASS;
213219

214220
// New in v1.0.11
215221
#define USING_CORS_FEATURE true
216-
//////
222+
223+
////////////////////////////////////////////
217224

218225
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
219226
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
220-
// Force DHCP to be true
221-
#if defined(USE_DHCP_IP)
222-
#undef USE_DHCP_IP
223-
#endif
224-
#define USE_DHCP_IP true
227+
// Force DHCP to be true
228+
#if defined(USE_DHCP_IP)
229+
#undef USE_DHCP_IP
230+
#endif
231+
#define USE_DHCP_IP true
225232
#else
226-
// You can select DHCP or Static IP here
227-
//#define USE_DHCP_IP true
228-
#define USE_DHCP_IP false
233+
// You can select DHCP or Static IP here
234+
#define USE_DHCP_IP true
235+
//#define USE_DHCP_IP false
229236
#endif
230237

231238
#if ( USE_DHCP_IP )
232-
// Use DHCP
233-
#warning Using DHCP IP
234-
IPAddress stationIP = IPAddress(0, 0, 0, 0);
235-
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
236-
IPAddress netMask = IPAddress(255, 255, 255, 0);
237-
#else
238-
// Use static IP
239-
#warning Using static IP
240-
#ifdef ESP32
241-
IPAddress stationIP = IPAddress(192, 168, 2, 232);
239+
// Use DHCP
240+
241+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
242+
#warning Using DHCP IP
243+
#endif
244+
245+
IPAddress stationIP = IPAddress(0, 0, 0, 0);
246+
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
247+
IPAddress netMask = IPAddress(255, 255, 255, 0);
248+
242249
#else
243-
IPAddress stationIP = IPAddress(192, 168, 2, 186);
250+
// Use static IP
251+
252+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
253+
#warning Using static IP
254+
#endif
255+
256+
#ifdef ESP32
257+
IPAddress stationIP = IPAddress(192, 168, 2, 232);
258+
#else
259+
IPAddress stationIP = IPAddress(192, 168, 2, 186);
260+
#endif
261+
262+
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
263+
IPAddress netMask = IPAddress(255, 255, 255, 0);
244264
#endif
245265

246-
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
247-
IPAddress netMask = IPAddress(255, 255, 255, 0);
248-
#endif
266+
////////////////////////////////////////////
267+
249268

250269
#define USE_CONFIGURABLE_DNS true
251270

examples/Async_AutoConnectWithFeedback/Async_AutoConnectWithFeedback.ino

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#error This code is intended to run on the ESP8266 or ESP32 platform! Please check your Tools->Board setting.
1919
#endif
2020

21-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.1"
22-
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012001
21+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN_TARGET "ESPAsync_WiFiManager v1.12.2"
22+
#define ESP_ASYNC_WIFIMANAGER_VERSION_MIN 1012002
2323

2424
// Use from 0 to 4. Higher number, more debugging messages and memory usage.
2525
#define _ESPASYNC_WIFIMGR_LOGLEVEL_ 3
@@ -51,15 +51,21 @@
5151
// Check cores/esp32/esp_arduino_version.h and cores/esp32/core_version.h
5252
//#if ( ESP_ARDUINO_VERSION >= ESP_ARDUINO_VERSION_VAL(2, 0, 0) ) //(ESP_ARDUINO_VERSION_MAJOR >= 2)
5353
#if ( defined(ESP_ARDUINO_VERSION_MAJOR) && (ESP_ARDUINO_VERSION_MAJOR >= 2) )
54-
#warning Using ESP32 Core 1.0.6 or 2.0.0+
54+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
55+
#warning Using ESP32 Core 1.0.6 or 2.0.0+
56+
#endif
57+
5558
// The library has been merged into esp32 core from release 1.0.6
5659
#include <LittleFS.h> // https://github.com/espressif/arduino-esp32/tree/master/libraries/LittleFS
5760

5861
FS* filesystem = &LittleFS;
5962
#define FileFS LittleFS
6063
#define FS_Name "LittleFS"
6164
#else
62-
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
65+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
66+
#warning Using ESP32 Core 1.0.5-. You must install LITTLEFS library
67+
#endif
68+
6369
// The library has been merged into esp32 core from release 1.0.6
6470
#include <LITTLEFS.h> // https://github.com/lorol/LITTLEFS
6571

@@ -204,30 +210,39 @@ String AP_PASS;
204210

205211
// New in v1.0.11
206212
#define USING_CORS_FEATURE true
207-
//////
213+
214+
////////////////////////////////////////////
208215

209216
// Use USE_DHCP_IP == true for dynamic DHCP IP, false to use static IP which you have to change accordingly to your network
210217
#if (defined(USE_STATIC_IP_CONFIG_IN_CP) && !USE_STATIC_IP_CONFIG_IN_CP)
211-
// Force DHCP to be true
218+
// Force DHCP to be true
212219
#if defined(USE_DHCP_IP)
213220
#undef USE_DHCP_IP
214221
#endif
215222
#define USE_DHCP_IP true
216223
#else
217224
// You can select DHCP or Static IP here
218-
//#define USE_DHCP_IP true
219-
#define USE_DHCP_IP false
225+
#define USE_DHCP_IP true
226+
//#define USE_DHCP_IP false
220227
#endif
221228

222229
#if ( USE_DHCP_IP )
223230
// Use DHCP
224-
#warning Using DHCP IP
231+
232+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
233+
#warning Using DHCP IP
234+
#endif
235+
225236
IPAddress stationIP = IPAddress(0, 0, 0, 0);
226237
IPAddress gatewayIP = IPAddress(192, 168, 2, 1);
227238
IPAddress netMask = IPAddress(255, 255, 255, 0);
239+
228240
#else
229241
// Use static IP
230-
#warning Using static IP
242+
243+
#if (_ESPASYNC_WIFIMGR_LOGLEVEL_ > 3)
244+
#warning Using static IP
245+
#endif
231246

232247
#ifdef ESP32
233248
IPAddress stationIP = IPAddress(192, 168, 2, 232);
@@ -239,6 +254,9 @@ String AP_PASS;
239254
IPAddress netMask = IPAddress(255, 255, 255, 0);
240255
#endif
241256

257+
////////////////////////////////////////////
258+
259+
242260
#define USE_CONFIGURABLE_DNS true
243261

244262
IPAddress dns1IP = gatewayIP;

0 commit comments

Comments
 (0)