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

Commit 0e2a7fb

Browse files
authored
v1.0.16
### Releases v1.0.16 1. Sync with EthernetWebServer v.1.0.9 2. Use 25MHz for W5x00. 3. Use EthernetWrapper feature of EthernetWebServer v.1.0.9.
1 parent a32ef75 commit 0e2a7fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3048
-1159
lines changed

examples/AM2315_W5500/AM2315_W5500.ino

Lines changed: 124 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Library modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
99
Built by Khoi Hoang https://github.com/khoih-prog/BlynkEthernet_WM
1010
Licensed under MIT license
11-
Version: 1.0.15
11+
Version: 1.0.16
1212
1313
Original Blynk Library author:
1414
@file BlynkGsmClient.h
@@ -29,10 +29,11 @@
2929
1.0.10 K Hoang 11/04/2020 Add MultiBlynk, dynamic parameters, special chars input
3030
1.0.11 K Hoang 14/04/2020 Fix bug
3131
1.0.12 K Hoang 15/04/2020 Drop W5100 and AVR Mega support because of not enough memory. Add SAMD51 support.
32-
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
32+
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
3333
Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
34-
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35-
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
34+
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35+
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
36+
1.0.16 K Hoang 15/05/2020 Sync with EthernetWebServer v.1.0.9 to use 25MHz for W5x00 and EthernetWrapper feature.
3637
*****************************************************************************************************************************/
3738
#include "defines.h"
3839
#include "Credentials.h"
@@ -99,69 +100,130 @@ void setup()
99100
Serial.println(F("Sensor not found, check wiring & pullups!"));
100101
}
101102

102-
// Just info to know how to connect correctly
103-
Serial.println("=========================");
104-
Serial.println("Default SPI pinout:");
105-
Serial.print("MOSI:");
106-
Serial.println(MOSI);
107-
Serial.print("MISO:");
108-
Serial.println(MISO);
109-
Serial.print("SCK:");
110-
Serial.println(SCK);
111-
Serial.print("SS:");
112-
Serial.println(SS);
113-
Serial.println("=========================");
114-
115-
#if defined(ESP8266)
116-
// For ESP8266, change for other boards if necessary
117-
#if ( USE_ETHERNET || USE_ETHERNET3 || USE_ETHERNET_LARGE )
118-
// For ESP8266
119-
// Pin D0(GPIO16) D1(GPIO5) D2(GPIO4) D3(GPIO0) D4(GPIO2) D8
120-
// Ethernet 0 X X X X 0
121-
// Ethernet2 X X X X X 0
122-
// Ethernet3 X X X X X 0
123-
// EthernetLarge X X X X X 0
124-
// Ethernet_ESP8266 0 0 0 0 0 0
125-
// D2 is safe to used for Ethernet, Ethernet2, Ethernet3, EthernetLarge libs
126-
// Must use library patch for Ethernet, EthernetLarge libraries
127-
Ethernet.setCsPin (D2);
128-
129-
#if USE_ETHERNET3
130-
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
131-
#define ETHERNET3_MAX_SOCK_NUM 4
103+
#if USE_ETHERNET_WRAPPER
104+
105+
EthernetInit();
106+
107+
#else
108+
109+
#if USE_ETHERNET
110+
LOGWARN(F("=========== USE_ETHERNET ==========="));
111+
#elif USE_ETHERNET2
112+
LOGWARN(F("=========== USE_ETHERNET2 ==========="));
113+
#elif USE_ETHERNET3
114+
LOGWARN(F("=========== USE_ETHERNET3 ==========="));
115+
#elif USE_ETHERNET_LARGE
116+
LOGWARN(F("=========== USE_ETHERNET_LARGE ==========="));
117+
#elif USE_ETHERNET_ESP8266
118+
LOGWARN(F("=========== USE_ETHERNET_ESP8266 ==========="));
119+
#else
120+
LOGWARN(F("========================="));
121+
#endif
122+
123+
LOGWARN(F("Default SPI pinout:"));
124+
LOGWARN1(F("MOSI:"), MOSI);
125+
LOGWARN1(F("MISO:"), MISO);
126+
LOGWARN1(F("SCK:"), SCK);
127+
LOGWARN1(F("SS:"), SS);
128+
LOGWARN(F("========================="));
129+
130+
#if defined(ESP8266)
131+
// For ESP8266, change for other boards if necessary
132+
#ifndef USE_THIS_SS_PIN
133+
#define USE_THIS_SS_PIN D2 // For ESP8266
134+
#endif
135+
136+
LOGWARN1(F("ESP8266 setCsPin:"), USE_THIS_SS_PIN);
137+
138+
#if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 )
139+
// For ESP8266
140+
// Pin D0(GPIO16) D1(GPIO5) D2(GPIO4) D3(GPIO0) D4(GPIO2) D8
141+
// Ethernet 0 X X X X 0
142+
// Ethernet2 X X X X X 0
143+
// Ethernet3 X X X X X 0
144+
// EthernetLarge X X X X X 0
145+
// Ethernet_ESP8266 0 0 0 0 0 0
146+
// D2 is safe to used for Ethernet, Ethernet2, Ethernet3, EthernetLarge libs
147+
// Must use library patch for Ethernet, EthernetLarge libraries
148+
//Ethernet.setCsPin (USE_THIS_SS_PIN);
149+
Ethernet.init (USE_THIS_SS_PIN);
132150

133-
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
134-
#endif
151+
#elif USE_ETHERNET3
152+
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
153+
#ifndef ETHERNET3_MAX_SOCK_NUM
154+
#define ETHERNET3_MAX_SOCK_NUM 4
155+
#endif
156+
157+
Ethernet.setCsPin (USE_THIS_SS_PIN);
158+
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
159+
160+
#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )
161+
162+
#elif defined(ESP32)
135163

136-
#elif ( USE_ETHERNET2 )
137-
Ethernet.init (D2);
138-
#endif
139-
140-
#else
141-
142-
#define USE_THIS_SS_PIN 10
143-
// For other boards, to change if necessary
144-
#if ( USE_ETHERNET || USE_ETHERNET3 || USE_ETHERNET_LARGE )
145-
// Must use library patch for Ethernet, EthernetLarge libraries
146-
// ESP32 => GPIO13 OK with Ethernet, EthernetLarge, not Ethernet3
164+
// You can use Ethernet.init(pin) to configure the CS pin
165+
//Ethernet.init(10); // Most Arduino shields
166+
//Ethernet.init(5); // MKR ETH shield
167+
//Ethernet.init(0); // Teensy 2.0
168+
//Ethernet.init(20); // Teensy++ 2.0
169+
//Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet
170+
//Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet
171+
172+
#ifndef USE_THIS_SS_PIN
173+
#define USE_THIS_SS_PIN 22 // For ESP32
174+
#endif
175+
176+
LOGWARN1(F("ESP32 setCsPin:"), USE_THIS_SS_PIN);
177+
178+
// For other boards, to change if necessary
179+
#if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 )
180+
// Must use library patch for Ethernet, EthernetLarge libraries
181+
// ESP32 => GPIO2,4,5,13,15,21,22 OK with Ethernet, Ethernet2, EthernetLarge
182+
// ESP32 => GPIO2,4,5,15,21,22 OK with Ethernet3
183+
184+
//Ethernet.setCsPin (USE_THIS_SS_PIN);
185+
Ethernet.init (USE_THIS_SS_PIN);
147186

148-
Serial.println("setCsPin " + String(USE_THIS_SS_PIN));
149-
Ethernet.setCsPin (USE_THIS_SS_PIN);
150-
151-
#if USE_ETHERNET3
152-
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
153-
#define ETHERNET3_MAX_SOCK_NUM 4
187+
#elif USE_ETHERNET3
188+
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
189+
#ifndef ETHERNET3_MAX_SOCK_NUM
190+
#define ETHERNET3_MAX_SOCK_NUM 4
191+
#endif
192+
193+
Ethernet.setCsPin (USE_THIS_SS_PIN);
194+
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
195+
196+
#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )
154197

155-
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
156-
#endif
198+
#else //defined(ESP8266)
199+
// unknown board, do nothing, use default SS = 10
200+
#ifndef USE_THIS_SS_PIN
201+
#define USE_THIS_SS_PIN 10 // For other boards
202+
#endif
203+
204+
LOGWARN1(F("Unknown board setCsPin:"), USE_THIS_SS_PIN);
157205

158-
#elif ( USE_ETHERNET2 )
159-
// ESP32 => GPIO13 OK with Ethernet2
160-
Serial.println("setCsPin " + String(USE_THIS_SS_PIN));
161-
Ethernet.init (USE_THIS_SS_PIN);
162-
#endif
163-
164-
#endif //defined(ESP8266)
206+
// For other boards, to change if necessary
207+
#if ( USE_ETHERNET || USE_ETHERNET_LARGE || USE_ETHERNET2 )
208+
// Must use library patch for Ethernet, Ethernet2, EthernetLarge libraries
209+
210+
Ethernet.init (USE_THIS_SS_PIN);
211+
212+
#elif USE_ETHERNET3
213+
// Use MAX_SOCK_NUM = 4 for 4K, 2 for 8K, 1 for 16K RX/TX buffer
214+
#ifndef ETHERNET3_MAX_SOCK_NUM
215+
#define ETHERNET3_MAX_SOCK_NUM 4
216+
#endif
217+
218+
Ethernet.setCsPin (USE_THIS_SS_PIN);
219+
Ethernet.init (ETHERNET3_MAX_SOCK_NUM);
220+
221+
#endif //( USE_ETHERNET || USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )
222+
223+
#endif //defined(ESP8266)
224+
225+
226+
#endif //USE_ETHERNET_WRAPPER
165227

166228
#if USE_BLYNK_WM
167229
Blynk.begin();

examples/AM2315_W5500/Credentials.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Library modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
99
Built by Khoi Hoang https://github.com/khoih-prog/BlynkEthernet_WM
1010
Licensed under MIT license
11-
Version: 1.0.15
11+
Version: 1.0.16
1212
1313
Original Blynk Library author:
1414
@file BlynkGsmClient.h
@@ -29,10 +29,11 @@
2929
1.0.10 K Hoang 11/04/2020 Add MultiBlynk, dynamic parameters, special chars input
3030
1.0.11 K Hoang 14/04/2020 Fix bug
3131
1.0.12 K Hoang 15/04/2020 Drop W5100 and AVR Mega support because of not enough memory. Add SAMD51 support.
32-
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
32+
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
3333
Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
34-
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35-
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
34+
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35+
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
36+
1.0.16 K Hoang 15/05/2020 Sync with EthernetWebServer v.1.0.9 to use 25MHz for W5x00 and EthernetWrapper feature.
3637
*****************************************************************************************************************************/
3738

3839
#ifndef Credentials_h
@@ -110,7 +111,7 @@ Blynk_Configuration defaultConfig =
110111

111112
bool LOAD_DEFAULT_CONFIG_DATA = false;
112113

113-
Blynk_WM_Configuration defaultConfig;
114+
Blynk_Configuration defaultConfig;
114115

115116
#endif // TO_LOAD_DEFAULT_CONFIG_DATA
116117

examples/AM2315_W5500/defines.h

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Library modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
99
Built by Khoi Hoang https://github.com/khoih-prog/BlynkEthernet_WM
1010
Licensed under MIT license
11-
Version: 1.0.15
11+
Version: 1.0.16
1212
1313
Original Blynk Library author:
1414
@file BlynkGsmClient.h
@@ -29,10 +29,11 @@
2929
1.0.10 K Hoang 11/04/2020 Add MultiBlynk, dynamic parameters, special chars input
3030
1.0.11 K Hoang 14/04/2020 Fix bug
3131
1.0.12 K Hoang 15/04/2020 Drop W5100 and AVR Mega support because of not enough memory. Add SAMD51 support.
32-
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
32+
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
3333
Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
34-
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35-
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
34+
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35+
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
36+
1.0.16 K Hoang 15/05/2020 Sync with EthernetWebServer v.1.0.9 to use 25MHz for W5x00 and EthernetWrapper feature.
3637
*****************************************************************************************************************************/
3738

3839
#ifndef defines_h
@@ -261,22 +262,70 @@
261262
#define EEPROM_START 0
262263
#endif
263264

265+
// To use faster 25MHz clock instead of defaulf 14MHz. Only for W5200 and W5500. W5100 also tested OK.
266+
//#define USE_W5100 false
267+
268+
#define USE_ETHERNET_WRAPPER true
269+
//#define USE_ETHERNET_WRAPPER false
270+
271+
// Use true for ENC28J60 and UIPEthernet library (https://github.com/UIPEthernet/UIPEthernet)
272+
// Use false for W5x00 and Ethernetx library (https://www.arduino.cc/en/Reference/Ethernet)
273+
274+
//#define USE_UIP_ETHERNET true
275+
//#define USE_UIP_ETHERNET false
276+
277+
#define USE_CUSTOM_ETHERNET false //true
278+
264279
// Note: To rename ESP628266 Ethernet lib files to Ethernet_ESP8266.h and Ethernet_ESP8266.cpp
265-
// Only one if the following to be true. If none selected, default to Ethernet lib
266-
#define USE_ETHERNET2 false
280+
// In order to USE_ETHERNET_ESP8266
281+
#if ( !defined(USE_UIP_ETHERNET) || !USE_UIP_ETHERNET )
282+
283+
// To override the default CS/SS pin. Don't use unless you know exactly which pin to use
284+
//#define USE_THIS_SS_PIN 22 //21 //5 //4 //2 //15
285+
286+
// Only one if the following to be true
287+
#define USE_ETHERNET2 true
267288
#define USE_ETHERNET3 false //true
268289
#define USE_ETHERNET_LARGE false //true
290+
#define USE_ETHERNET_ESP8266 false //true
291+
292+
#if !USE_ETHERNET_WRAPPER
269293

270-
#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE )
271-
#define USE_CUSTOM_ETHERNET true
294+
#if ( USE_ETHERNET2 || USE_ETHERNET3 || USE_ETHERNET_LARGE || USE_ETHERNET_ESP8266 )
295+
#ifdef USE_CUSTOM_ETHERNET
296+
#undef USE_CUSTOM_ETHERNET
297+
#endif
298+
#define USE_CUSTOM_ETHERNET true
299+
#endif
300+
301+
#if USE_ETHERNET3
302+
#include "Ethernet3.h"
303+
#warning Use Ethernet3 lib
304+
#elif USE_ETHERNET2
305+
#include "Ethernet2.h"
306+
#warning Use Ethernet2 lib
307+
#elif USE_ETHERNET_LARGE
308+
#include "EthernetLarge.h"
309+
#warning Use EthernetLarge lib
310+
#elif USE_ETHERNET_ESP8266
311+
#include "Ethernet_ESP8266.h"
312+
#warning Use Ethernet_ESP8266 lib
313+
#elif USE_CUSTOM_ETHERNET
314+
#include "Ethernet_XYZ.h"
315+
#warning Use Custom Ethernet library from EthernetWrapper. You must include a library here or error.
272316
#else
273317
#define USE_ETHERNET true
318+
#include "Ethernet.h"
319+
#warning Use Ethernet lib
274320
#endif
275321

276322
// Ethernet_Shield_W5200, EtherCard, EtherSia not supported
277323
// Select just 1 of the following #include if uncomment #define USE_CUSTOM_ETHERNET
278324
// Otherwise, standard Ethernet library will be used for W5x00
279325

326+
#endif //#if !USE_UIP_ETHERNET
327+
#endif //USE_ETHERNET_WRAPPER
328+
280329

281330
#if USE_SSL
282331
// Need ArduinoECCX08 and ArduinoBearSSL libraries

examples/AM2315_W5500/dynamicParams.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Library modified from Blynk library v0.6.1 https://github.com/blynkkk/blynk-library/releases
99
Built by Khoi Hoang https://github.com/khoih-prog/BlynkEthernet_WM
1010
Licensed under MIT license
11-
Version: 1.0.15
11+
Version: 1.0.16
1212
1313
Original Blynk Library author:
1414
@file BlynkGsmClient.h
@@ -29,10 +29,11 @@
2929
1.0.10 K Hoang 11/04/2020 Add MultiBlynk, dynamic parameters, special chars input
3030
1.0.11 K Hoang 14/04/2020 Fix bug
3131
1.0.12 K Hoang 15/04/2020 Drop W5100 and AVR Mega support because of not enough memory. Add SAMD51 support.
32-
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
32+
1.0.13 K Hoang 29/04/2020 Add ESP32, including u-blox NINA-W10 series (ESP32) and ESP8266 support.
3333
Add Configurable Config Portal Title, Default Config Data and DRD. Update examples.
34-
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35-
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
34+
1.0.14 K Hoang 01/05/2020 Add support to Adafruit nRF522, including NINA_B302_ublox.
35+
1.0.15 K Hoang 12/05/2020 Fix bug and Update to use LittleFS for ESP8266 core 2.7.1+.
36+
1.0.16 K Hoang 15/05/2020 Sync with EthernetWebServer v.1.0.9 to use 25MHz for W5x00 and EthernetWrapper feature.
3637
*****************************************************************************************************************************/
3738

3839
#ifndef dynamicParams_h

0 commit comments

Comments
 (0)