Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
Major Release v1.1.0
Browse files Browse the repository at this point in the history
#### Major Release v1.1.0

1. Configurable **Customs HTML Headers**, including Customs Style, Customs Gead Elements, CORS Header.
2. Add support to boards using WiFi101 library such as MKR1000
3. Fix Config Portal Bug. 
4. Add functions to control Config Portal from software or Virtual Switches. Check [How to trigger a Config Portal from code #25](khoih-prog/Blynk_WM#25)
5. Use more efficient [FlashStorage_SAMD v1.1.0](https://github.com/khoih-prog/FlashStorage_SAMD) and [FlashStorage_STM32 v1.00](https://github.com/khoih-prog/FlashStorage_STM32)
6. Optimize code
7. Add Version String
  • Loading branch information
khoih-prog authored Feb 20, 2021
1 parent 574c238 commit a342a37
Show file tree
Hide file tree
Showing 60 changed files with 11,828 additions and 2,772 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If you don't find anything, please [open a new issue](https://github.com/khoih-p
Please ensure to specify the following:

* Arduino IDE version (e.g. 1.8.13) or Platform.io version
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.9, Adafruit SAMD core v1.6.4, Seeed Studio SAMD v1.8.1)
* `SAMD` Core Version (e.g. Arduino SAMD core v1.8.11, Adafruit SAMD core v1.6.5, Seeed Studio SAMD v1.8.1)
* Contextual information (e.g. what you were trying to achieve)
* Simplest possible steps to reproduce
* Anything that might be relevant in your opinion, such as:
Expand All @@ -27,9 +27,9 @@ Please ensure to specify the following:

```
Arduino IDE version: 1.8.13
Arduino SAMD Core Version 1.8.9
Arduino SAMD Core Version 1.8.11
OS: Ubuntu 20.04 LTS
Linux xy-Inspiron-3593 5.4.0-51-generic #56-Ubuntu SMP Mon Oct 5 14:28:49 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Linux xy-Inspiron-3593 5.4.0-65-generic #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Context:
The board couldn't autoreconnect to Local Blynk Server after router power recycling.
Expand Down
949 changes: 605 additions & 344 deletions README.md

Large diffs are not rendered by default.

31 changes: 10 additions & 21 deletions examples/Mega_WiFiNINA/Credentials.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
/****************************************************************************************************************************
Credentials.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.0.5
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
Credentials.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef Credentials_h
Expand Down Expand Up @@ -54,7 +43,7 @@ typedef struct Configuration
} WiFiNINA_Configuration;
*/

#define TO_LOAD_DEFAULT_CONFIG_DATA true
#define TO_LOAD_DEFAULT_CONFIG_DATA false

#if TO_LOAD_DEFAULT_CONFIG_DATA

Expand Down
56 changes: 33 additions & 23 deletions examples/Mega_WiFiNINA/Mega_WiFiNINA.ino
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
/****************************************************************************************************************************
Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.0.5
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
*****************************************************************************************************************************/
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.1.0
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
1.1.0 K Hoang 19/02/2021 Optimize code and use better FlashStorage_SAMD and FlashStorage_STM32.
Add customs HTML header feature. Fix bug.
**********************************************************************************************************************************/

#include "defines.h"
#include "Credentials.h"
#include "dynamicParams.h"
Expand Down Expand Up @@ -59,20 +62,27 @@ void check_status()

WiFiManager_NINA_Lite* WiFiManager_NINA;

#if USING_CUSTOMS_STYLE
const char NewCustomsStyle[] /*PROGMEM*/ = "<style>div,input{padding:5px;font-size:1em;}input{width:95%;}body{text-align: center;}\
button{background-color:blue;color:white;line-height:2.4rem;font-size:1.2rem;width:100%;}fieldset{border-radius:0.3rem;margin:0px;}</style>";
#endif

void setup()
{
// Debug console
Serial.begin(115200);
while (!Serial);

Serial.print(F("\nStart Mega_WiFiNINA on "));
Serial.println(BOARD_TYPE);
delay(200);

Serial.print(F("\nStarting Mega_WiFiNINA on ")); Serial.println(BOARD_TYPE);
Serial.println(WIFIMANAGER_NINA_LITE_VERSION);

WiFiManager_NINA = new WiFiManager_NINA_Lite();

// Optional to change default AP IP(192.168.4.1) and channel(10)
//WiFiManager_NINA->setConfigPortalIP(IPAddress(192, 168, 120, 1));
//WiFiManager_NINA->setConfigPortalChannel(1);
WiFiManager_NINA->setConfigPortalChannel(0);

// Set customized DHCP HostName
WiFiManager_NINA->begin(HOST_NAME);
Expand Down
110 changes: 84 additions & 26 deletions examples/Mega_WiFiNINA/defines.h
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
/****************************************************************************************************************************
defines.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.0.5
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
defines.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef defines_h
#define defines_h

/* Comment this out to disable prints and save space */
#define DEBUG_WIFI_WEBSERVER_PORT Serial
#define WIFININA_DEBUG_OUTPUT Serial
#define DEBUG_WIFI_WEBSERVER_PORT Serial
#define WIFININA_DEBUG_OUTPUT Serial

#define WIFININA_DEBUG false //true
#define _WIFININA_LOGLEVEL_ 2

#define DRD_GENERIC_DEBUG false //true
#define DRD_GENERIC_DEBUG true

#if !( defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) )
#error This code is intended to run only on the Arduino Mega 1280/2560 boards ! Please check your Tools->Board setting.
#if !( defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_ADK) )
#error This code is intended to run on the AVR Mega, Mega2560, Mega ADK platform! Please check your Tools->Board setting.
#endif

#if defined(ARDUINO_AVR_MEGA2560)
Expand All @@ -46,6 +35,75 @@
// Config data Size currently is 128 bytes)
#define EEPROM_START 0

/////////////////////////////////////////////

// Add customs headers from v1.1.0
#define USING_CUSTOMS_STYLE false
#define USING_CUSTOMS_HEAD_ELEMENT false
#define USING_CORS_FEATURE false

/////////////////////////////////////////////

#define USE_WIFI_NINA true
#define USE_WIFI101 false
#define USE_WIFI_CUSTOM false

#if USE_WIFI_NINA

#warning Using WIFININA_Generic Library
#define SHIELD_TYPE "WiFiNINA using WiFiNINA_Generic Library"

#include "WiFiNINA_Pinout_Generic.h"

#elif USE_WIFI101

#if defined(USE_WIFI_NINA)
#undef USE_WIFI_NINA
#endif

#define USE_WIFI_NINA false

#define SHIELD_TYPE "WINC1500 using WiFi101 Library"
#warning Using WiFi101 Library

#elif USE_WIFI_CUSTOM

#if defined(USE_WIFI_NINA)
#undef USE_WIFI_NINA
#endif

#define USE_WIFI_NINA false

#if defined(USE_WIFI101)
#undef USE_WIFI101
#endif

#define USE_WIFI101 false

#define SHIELD_TYPE "Custom using Custom WiFi Library"
#warning Using Custom WiFi Library. You must include here or compile error

#else

#define SHIELD_TYPE "Default WiFi using WiFi Library"
#warning Using fallback WiFi.h Library defined in WiFiWebServer Library.

#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

#define USE_DYNAMIC_PARAMETERS false

/////////////////////////////////////////////

#include <WiFiManager_NINA_Lite.h>

#define HOST_NAME "AVR-Master-Controller"
Expand Down
35 changes: 12 additions & 23 deletions examples/Mega_WiFiNINA/dynamicParams.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
/****************************************************************************************************************************
dynamicParams.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.0.5
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
dynamicParams.h for Mega_WiFiNINA.ino
For AVR or Generic boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef dynamicParams_h
#define dynamicParams_h

#include "defines.h"

#define USE_DYNAMIC_PARAMETERS true
// USE_DYNAMIC_PARAMETERS defined in defined.h

/////////////// Start dynamic Credentials ///////////////

Expand Down Expand Up @@ -67,8 +56,8 @@ MenuItem myMenuItems [] =
{ "tk1", "Token1", Blynk_Token1, MAX_BLYNK_TOKEN_LEN },
{ "sv2", "Blynk Server2", Blynk_Server2, MAX_BLYNK_SERVER_LEN },
{ "tk2", "Token2", Blynk_Token2, MAX_BLYNK_TOKEN_LEN },
{ "pt", "Port", Blynk_Port, MAX_BLYNK_PORT_LEN },
{ "mq", "MQTT Server", MQTT_Server, MAX_MQTT_SERVER_LEN },
{ "prt", "Port", Blynk_Port, MAX_BLYNK_PORT_LEN },
{ "mqt", "MQTT Server", MQTT_Server, MAX_MQTT_SERVER_LEN },
};

uint16_t NUM_MENU_ITEMS = sizeof(myMenuItems) / sizeof(MenuItem); //MenuItemSize;
Expand Down
31 changes: 10 additions & 21 deletions examples/SAMD_WiFiNINA/Credentials.h
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
/****************************************************************************************************************************
Credentials.h for SAMD_WiFiNINA.ino
For SAMD boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
Version: 1.0.5
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 26/03/2020 Initial coding
1.0.1 K Hoang 27/03/2020 Fix SAMD soft-reset bug. Add support to remaining boards
1.0.2 K Hoang 15/04/2020 Fix bug. Add SAMD51 support.
1.0.3 K Hoang 24/04/2020 Fix bug. Add nRF5 (Adafruit, NINA_B302_ublox, etc.) support. Add MultiWiFi, HostName capability.
SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.4 K Hoang 04/05/2020 Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
1.0.5 K Hoang 11/07/2020 Modify LOAD_DEFAULT_CONFIG_DATA logic. Enhance MultiWiFi connection logic. Add MQTT examples.
Credentials.h for SAMD_WiFiNINA.ino
For SAMD boards using WiFiNINA Modules/Shields, using much less code to support boards with smaller memory
WiFiManager_NINA_WM_Lite is a library for the Mega, Teensy, SAM DUE, SAMD and STM32 boards
(https://github.com/khoih-prog/WiFiManager_NINA_Lite) to enable store Credentials in EEPROM/LittleFS for easy
configuration/reconfiguration and autoconnect/autoreconnect of WiFi and other services without Hardcoding.
Built by Khoi Hoang https://github.com/khoih-prog/WiFiManager_NINA_Lite
Licensed under MIT license
*****************************************************************************************************************************/

#ifndef Credentials_h
Expand Down Expand Up @@ -54,7 +43,7 @@ typedef struct Configuration
} WiFiNINA_Configuration;
*/

#define TO_LOAD_DEFAULT_CONFIG_DATA true
#define TO_LOAD_DEFAULT_CONFIG_DATA false

#if TO_LOAD_DEFAULT_CONFIG_DATA

Expand Down
Loading

0 comments on commit a342a37

Please sign in to comment.