Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
v1.0.10
Browse files Browse the repository at this point in the history
### Releases v1.0.10

1. Use ESP8266/ESP32 MultiWiFi feature to autoconnect to the best and available WiFi SSID.
2. Auto format SPIFFS/LittleFS for first time usage.
3. Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
  • Loading branch information
khoih-prog authored Aug 26, 2020
1 parent 84f6e82 commit b0bbb2b
Show file tree
Hide file tree
Showing 35 changed files with 2,416 additions and 1,949 deletions.
966 changes: 496 additions & 470 deletions README.md

Large diffs are not rendered by default.

200 changes: 103 additions & 97 deletions examples/ESP32_GSM/Credentials.h
Original file line number Diff line number Diff line change
@@ -1,115 +1,121 @@
/****************************************************************************************************************************
Credentials.h for ESP32_GSM.ino
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.
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
Licensed under MIT license
Version: 1.0.9
Credentials.h
For ESP32 TTGO-TCALL boards to run GSM/GPRS and WiFi simultaneously, using config portal feature
Uploading SHT3x temperature and humidity data to Blynk
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
Version: 1.0.10
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library.
1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size
1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously
1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData()
1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size.
1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md
1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch
1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.8 K Hoang 14/04/2020 Fix bug.
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
Version Modified By Date Comments
------- ----------- ---------- -----------
1.0.0 K Hoang 17/01/2020 Initial coding. Add config portal similar to Blynk_WM library.
1.0.1 K Hoang 27/01/2020 Change Synch XMLHttpRequest to Async (https://xhr.spec.whatwg.org/). Reduce code size
1.0.2 K Hoang 08/02/2020 Enable GSM/GPRS and WiFi running simultaneously
1.0.3 K Hoang 18/02/2020 Add checksum. Add clearConfigData()
1.0.4 K Hoang 14/03/2020 Enhance Config Portal GUI. Reduce code size.
1.0.5 K Hoang 20/03/2020 Add more modem supports. See the list in README.md
1.0.6 K Hoang 07/04/2020 Enable adding dynamic custom parameters from sketch
1.0.7 K Hoang 09/04/2020 SSID password maxlen is 63 now. Permit special chars # and % in input data.
1.0.8 K Hoang 14/04/2020 Fix bug.
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
*****************************************************************************************************************************/

#ifndef Credentials_h
#define Credentials_h

/// Start Default Config Data //////////////////

/*
// Defined in <BlynkSimpleESP8266_GSM_WFM.h>
#if USE_BLYNK_WM

#define SSID_MAX_LEN 32
//From v1.0.10, WPA2 passwords can be up to 63 characters long.
#define PASS_MAX_LEN 64
/// Start Default Config Data //////////////////

typedef struct
{
char wifi_ssid[SSID_MAX_LEN];
char wifi_pw [PASS_MAX_LEN];
} WiFi_Credentials;
#define BLYNK_SERVER_MAX_LEN 32
#define BLYNK_TOKEN_MAX_LEN 36
/*
// Defined in <BlynkSimpleESP8266_GSM_WFM.h>
typedef struct
{
char blynk_server [BLYNK_SERVER_MAX_LEN];
char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN];
char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN];
} Blynk_Credentials;
#define SSID_MAX_LEN 32
//From v1.0.10, WPA2 passwords can be up to 63 characters long.
#define PASS_MAX_LEN 64
typedef struct
{
char wifi_ssid[SSID_MAX_LEN];
char wifi_pw [PASS_MAX_LEN];
} WiFi_Credentials;
#define BLYNK_SERVER_MAX_LEN 32
#define BLYNK_TOKEN_MAX_LEN 36
typedef struct
{
char blynk_server [BLYNK_SERVER_MAX_LEN];
char wifi_blynk_token [BLYNK_TOKEN_MAX_LEN];
char gsm_blynk_token [BLYNK_TOKEN_MAX_LEN];
} Blynk_Credentials;
#define NUM_WIFI_CREDENTIALS 2
#define NUM_BLYNK_CREDENTIALS 2
// Configurable items besides fixed Header
#define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) )
#define DEFAULT_GPRS_PIN "1234"
typedef struct Configuration
{
char header [16];
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
int blynk_port;
// YOUR GSM / GPRS RELATED
char apn [32];
char gprsUser [32];
char gprsPass [32];
char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
// END OF YOUR GSM / GPRS RELATED
char board_name [24];
int checkSum;
} Blynk_WF_Configuration;
#define NUM_WIFI_CREDENTIALS 2
#define NUM_BLYNK_CREDENTIALS 2
*/

// Configurable items besides fixed Header
#define NUM_CONFIGURABLE_ITEMS ( 6 + (2 * NUM_WIFI_CREDENTIALS) + (3 * NUM_BLYNK_CREDENTIALS) )
#define DEFAULT_GPRS_PIN "1234"
//bool LOAD_DEFAULT_CONFIG_DATA = true;
bool LOAD_DEFAULT_CONFIG_DATA = false;

typedef struct Configuration
Blynk_WF_Configuration defaultConfig =
{
char header [16];
WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS];
Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
int blynk_port;
//char header[16], dummy, not used
"GSM",
//WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]
//WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw
"SSID1", "password1",
"SSID2", "password2",
// Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
// Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token
"account.ddns.net", "wifi_token", "gsm_token",
"account.duckdns.org", "wifi_token1", "gsm_token1",
//int blynk_port;
8080,
// YOUR GSM / GPRS RELATED
char apn [32];
char gprsUser [32];
char gprsPass [32];
char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
// END OF YOUR GSM / GPRS RELATED
char board_name [24];
int checkSum;
} Blynk_WF_Configuration;
*/

bool LOAD_DEFAULT_CONFIG_DATA = true;
//bool LOAD_DEFAULT_CONFIG_DATA = false;

Blynk_WF_Configuration defaultConfig =
{
//char header[16], dummy, not used
"GSM",
//WiFi_Credentials WiFi_Creds [NUM_WIFI_CREDENTIALS]
//WiFi_Creds.wifi_ssid and WiFi_Creds.wifi_pw
"SSID1", "password1",
"SSID2", "password2",
// Blynk_Credentials Blynk_Creds [NUM_BLYNK_CREDENTIALS];
// Blynk_Creds.blynk_server, Blynk_Creds.wifi_blynk_token and Blynk_Creds.gsm_blynk_token
"account.ddns.net", "wifi_token", "gsm_token",
"account.duckdns.org", "wifi_token1", "gsm_token1",
//int blynk_port;
8080,
// YOUR GSM / GPRS RELATED
//char apn [32];
"rogers-core-appl1.apn",
//char gprsUser [32];
"wapuser1",
//char gprsPass [32];
"wap",
//char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
"1245678",
// END OF YOUR GSM / GPRS RELATED
//char board_name [24];
"ESP32-GSM-WiFi",
//int checkSum, dummy, not used
0
};

/////////// End Default Config Data /////////////
//char apn [32];
"rogers-core-appl1.apn",
//char gprsUser [32];
"wapuser1",
//char gprsPass [32];
"wap",
//char gprsPin [12]; // A PIN (Personal Identification Number) is a 4-8 digit passcode
"1245678",
// END OF YOUR GSM / GPRS RELATED
//char board_name [24];
"ESP32-GSM-WiFi",
//int checkSum, dummy, not used
0
};

/////////// End Default Config Data /////////////

#endif // #if USE_BLYNK_WM

#endif //Credentials_h
33 changes: 26 additions & 7 deletions examples/ESP32_GSM/ESP32_GSM.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
For ESP32 to run GSM/GPRS and WiFi simultaneously, using config portal feature
Library to enable GSM/GPRS and WiFi running simultaneously , with WiFi config portal.
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
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
Version: 1.0.9
Version: 1.0.10
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,8 @@
1.0.8 K Hoang 14/04/2020 Fix bug.
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
*****************************************************************************************************************************/

#include "defines.h"
Expand Down Expand Up @@ -86,7 +88,8 @@ void setup()
while (!SerialMon);

SerialMon.print(F("\nStart ESP32-WIFI-GSM using "));
SerialMon.println(CurrentFileFS);
SerialMon.print(CurrentFileFS);
SerialMon.println(" on " + String(ARDUINO_BOARD));

// Set-up modem reset, enable, power pins
pinMode(MODEM_PWKEY, OUTPUT);
Expand All @@ -107,12 +110,28 @@ void setup()
Serial.println(F("Use WiFi to connect Blynk"));

#if USE_BLYNK_WM

// Set config portal SSID and Password
Blynk_WF.setConfigPortal("TestPortal-ESP32", "TestPortalPass");

// Use configurable AP IP, instead of default IP 192.168.4.1
Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 240, 1));
// Use channel = 0 => random Config Portal WiFi channel to avoid conflict
Blynk_WF.setConfigPortalIP(IPAddress(192, 168, 232, 1));
// Set config portal channel, default = 1. Use 0 => random channel from 1-12 to avoid conflict
Blynk_WF.setConfigPortalChannel(0);
// Set personalized Hostname

// Select either one of these to set static IP + DNS
Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0));
//Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
// IPAddress(192, 168, 2, 1), IPAddress(8, 8, 8, 8));
//Blynk_WF.setSTAStaticIPConfig(IPAddress(192, 168, 2, 232), IPAddress(192, 168, 2, 1), IPAddress(255, 255, 255, 0),
// IPAddress(4, 4, 4, 4), IPAddress(8, 8, 8, 8));

// Use this to default DHCP hostname to ESP8266-XXXXXX or ESP32-XXXXXX
//Blynk_WF.begin();
// Use this to personalize DHCP hostname (RFC952 conformed)
// 24 chars max,- only a..z A..Z 0..9 '-' and no '-' as last char
Blynk_WF.begin("ESP32-WiFi-GSM");

#else
Blynk_WF.begin(wifi_blynk_tok, ssid, pass, blynk_server, BLYNK_HARDWARE_PORT);

Expand Down
10 changes: 6 additions & 4 deletions examples/ESP32_GSM/defines.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/****************************************************************************************************************************
defines.h for ESP32_GSM.ino
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.
Forked from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
Built by Khoi Hoang https://github.com/khoih-prog/BlynkGSM_ESPManager
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
Version: 1.0.9
Version: 1.0.10
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,8 @@
1.0.8 K Hoang 14/04/2020 Fix bug.
1.0.9 K Hoang 31/05/2020 Update to use LittleFS for ESP8266 core 2.7.1+. Add Configurable Config Portal Title,
Default Config Data and DRD. Add MultiWiFi/Blynk features for WiFi and GPRS/GSM
1.0.10 K Hoang 26/08/2020 Use MultiWiFi. Auto format SPIFFS/LittleFS for first time usage.
Fix bug and logic of USE_DEFAULT_CONFIG_DATA.
*****************************************************************************************************************************/

#ifndef defines_h
Expand Down
Loading

0 comments on commit b0bbb2b

Please sign in to comment.