From 2902e0bfbd5c61194a98d81da3a47e155c106138 Mon Sep 17 00:00:00 2001
From: Khoi Hoang <57012152+khoih-prog@users.noreply.github.com>
Date: Mon, 21 Feb 2022 19:12:34 -0500
Subject: [PATCH] v1.8.2 to optimize code, etc.
### Release v1.8.2
1. Optimize code by using passing by `reference` instead of by `value`
2. Optional `Board_Name` in Menu. Check [option to remove board name from web page #25](https://github.com/khoih-prog/WiFiManager_NINA_Lite/issues/25)
3. Add function `isConfigMode()` to signal system is in Config Portal mode.
---
examples/ESPAsync_WiFi/ESPAsync_WiFi.ino | 13 +++++++++----
examples/ESPAsync_WiFi/defines.h | 5 +++++
examples/ESPAsync_WiFi_MQTT/ESPAsync_WiFi_MQTT.ino | 9 +++++++--
examples/ESPAsync_WiFi_MQTT/defines.h | 5 +++++
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/examples/ESPAsync_WiFi/ESPAsync_WiFi.ino b/examples/ESPAsync_WiFi/ESPAsync_WiFi.ino
index 2120042..0a740ff 100644
--- a/examples/ESPAsync_WiFi/ESPAsync_WiFi.ino
+++ b/examples/ESPAsync_WiFi/ESPAsync_WiFi.ino
@@ -14,14 +14,21 @@
#include "Credentials.h"
#include "dynamicParams.h"
+ESPAsync_WiFiManager_Lite* ESPAsync_WiFiManager;
+
void heartBeatPrint()
{
static int num = 1;
if (WiFi.status() == WL_CONNECTED)
- Serial.print(F("H")); // H means connected to WiFi
+ Serial.print("H"); // H means connected to WiFi
else
- Serial.print(F("F")); // F means not connected to WiFi
+ {
+ if (ESPAsync_WiFiManager->isConfigMode())
+ Serial.print("C"); // C means in Config Mode
+ else
+ Serial.print("F"); // F means not connected to WiFi
+ }
if (num == 80)
{
@@ -48,8 +55,6 @@ void check_status()
}
}
-ESPAsync_WiFiManager_Lite* ESPAsync_WiFiManager;
-
#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "";
diff --git a/examples/ESPAsync_WiFi/defines.h b/examples/ESPAsync_WiFi/defines.h
index a34e7af..42d7f27 100644
--- a/examples/ESPAsync_WiFi/defines.h
+++ b/examples/ESPAsync_WiFi/defines.h
@@ -124,6 +124,11 @@
/////////////////////////////////////////////
+// Optional, to use Board Name in Menu
+#define USING_BOARD_NAME true
+
+/////////////////////////////////////////////
+
#include
#if ESP8266
diff --git a/examples/ESPAsync_WiFi_MQTT/ESPAsync_WiFi_MQTT.ino b/examples/ESPAsync_WiFi_MQTT/ESPAsync_WiFi_MQTT.ino
index 2113aa9..7fb26f4 100644
--- a/examples/ESPAsync_WiFi_MQTT/ESPAsync_WiFi_MQTT.ino
+++ b/examples/ESPAsync_WiFi_MQTT/ESPAsync_WiFi_MQTT.ino
@@ -52,9 +52,14 @@ void heartBeatPrint()
static int num = 1;
if (WiFi.status() == WL_CONNECTED)
- Serial.print("W"); // W means connected to WiFi
+ Serial.print("H"); // H means connected to WiFi
else
- Serial.print("N"); // N means not connected to WiFi
+ {
+ if (ESPAsync_WiFiManager->isConfigMode())
+ Serial.print("C"); // C means in Config Mode
+ else
+ Serial.print("F"); // F means not connected to WiFi
+ }
if (num == 40)
{
diff --git a/examples/ESPAsync_WiFi_MQTT/defines.h b/examples/ESPAsync_WiFi_MQTT/defines.h
index 2279b61..2ae7b83 100644
--- a/examples/ESPAsync_WiFi_MQTT/defines.h
+++ b/examples/ESPAsync_WiFi_MQTT/defines.h
@@ -124,6 +124,11 @@
/////////////////////////////////////////////
+// Optional, to use Board Name in Menu
+#define USING_BOARD_NAME true
+
+/////////////////////////////////////////////
+
#include
#if ESP8266