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

Commit 0e927b5

Browse files
authored
v1.10.1 to use new WiFi101_Generic library
### Releases v1.10.1 1. Using new [`WiFi101_Generic library`](https://github.com/khoih-prog/WiFi101_Generic) for sending larger data 2. Update `Packages' Patches`
1 parent 42be38f commit 0e927b5

File tree

24 files changed

+733
-660
lines changed

24 files changed

+733
-660
lines changed

examples/HTTPClient/BasicAuthGet/BasicAuthGet.ino

+36-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
BasicAuthGet.ino - Simple Arduino web server sample for WiFi shield
33
44
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
5-
5+
66
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
77
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
88
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
@@ -51,10 +51,13 @@ void printWifiStatus()
5151
void setup()
5252
{
5353
Serial.begin(115200);
54+
5455
while (!Serial && millis() < 5000);
5556

56-
Serial.print(F("\nStarting BasicAuthGet on ")); Serial.print(BOARD_NAME);
57-
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
57+
Serial.print(F("\nStarting BasicAuthGet on "));
58+
Serial.print(BOARD_NAME);
59+
Serial.print(F(" with "));
60+
Serial.println(SHIELD_TYPE);
5861
Serial.println(WIFI_WEBSERVER_VERSION);
5962

6063
#if WIFI_USING_ESP_AT
@@ -65,46 +68,49 @@ void setup()
6568
WiFi.init(&EspSerial);
6669

6770
Serial.println(F("WiFi shield init done"));
68-
71+
6972
#endif
7073

7174
#if !(ESP32 || ESP8266)
72-
75+
7376
// check for the presence of the shield
74-
#if USE_WIFI_NINA
75-
if (WiFi.status() == WL_NO_MODULE)
76-
#else
77-
if (WiFi.status() == WL_NO_SHIELD)
78-
#endif
79-
{
80-
Serial.println(F("WiFi shield not present"));
81-
// don't continue
82-
while (true);
83-
}
84-
85-
#if USE_WIFI_NINA
86-
String fv = WiFi.firmwareVersion();
87-
88-
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
89-
{
90-
Serial.println(F("Please upgrade the firmware"));
91-
}
92-
#endif
93-
77+
#if USE_WIFI_NINA
78+
79+
if (WiFi.status() == WL_NO_MODULE)
80+
#else
81+
if (WiFi.status() == WL_NO_SHIELD)
82+
#endif
83+
{
84+
Serial.println(F("WiFi shield not present"));
85+
86+
// don't continue
87+
while (true);
88+
}
89+
90+
#if USE_WIFI_NINA
91+
String fv = WiFi.firmwareVersion();
92+
93+
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
94+
{
95+
Serial.println(F("Please upgrade the firmware"));
96+
}
97+
98+
#endif
99+
94100
#endif
95101

96102
Serial.print(F("Connecting to SSID: "));
97103
Serial.println(ssid);
98-
104+
99105
status = WiFi.begin(ssid, pass);
100106

101107
delay(1000);
102-
108+
103109
// attempt to connect to WiFi network
104110
while ( status != WL_CONNECTED)
105111
{
106112
delay(500);
107-
113+
108114
// Connect to WPA/WPA2 network
109115
status = WiFi.status();
110116
}
@@ -113,7 +119,7 @@ void setup()
113119
printWifiStatus();
114120
}
115121

116-
void loop()
122+
void loop()
117123
{
118124
Serial.println("making GET request with HTTP basic authentication");
119125
httpClient.beginRequest();
@@ -129,7 +135,7 @@ void loop()
129135
Serial.println(statusCode);
130136
Serial.print("Response: ");
131137
Serial.println(response);
132-
138+
133139
Serial.println("Wait five seconds");
134140
delay(5000);
135141
}

examples/HTTPClient/BasicAuthGet/defines.h

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/****************************************************************************************************************************
22
defines.h
33
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
4-
4+
55
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
66
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
77
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
@@ -36,21 +36,21 @@
3636

3737
#define USE_WIFI_NINA false
3838

39-
// To use the default WiFi library here
39+
// To use the default WiFi library here
4040
#define USE_WIFI_CUSTOM false
41-
41+
4242
#elif (ESP32)
4343

4444
#define USE_WIFI_NINA false
4545

46-
// To use the default WiFi library here
46+
// To use the default WiFi library here
4747
#define USE_WIFI_CUSTOM false
4848

4949
#elif (ESP8266)
5050

5151
#define USE_WIFI_NINA false
5252

53-
// To use the default WiFi library here
53+
// To use the default WiFi library here
5454
#define USE_WIFI_CUSTOM true
5555

5656
#elif ( defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) )
@@ -66,23 +66,23 @@
6666
#define USE_WIFI_CUSTOM false
6767

6868
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
69-
69+
7070
#define USE_WIFI_NINA false
7171
#define USE_WIFI101 false
7272
#define USE_WIFI_CUSTOM false
7373

7474
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
75-
75+
7676
#define USE_WIFI_NINA false
7777
#define USE_WIFI101 true
7878
#define USE_WIFI_CUSTOM false
79-
79+
8080
#else
8181

8282
#define USE_WIFI_NINA false
8383
#define USE_WIFI101 false
84-
85-
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
84+
85+
// If not USE_WIFI_NINA, you can USE_WIFI_CUSTOM, then include the custom WiFi library here
8686
#define USE_WIFI_CUSTOM true
8787

8888
#endif
@@ -115,32 +115,32 @@
115115
#define SHIELD_TYPE "ESP WiFi using WiFi Library"
116116
#elif defined(ARDUINO_RASPBERRY_PI_PICO_W)
117117
#warning Using RP2040W CYW43439 WiFi
118-
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
118+
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
119119
#elif USE_WIFI_CUSTOM
120120
#warning Using Custom WiFi using Custom WiFi Library
121121
#define SHIELD_TYPE "Custom WiFi using Custom WiFi Library"
122122
#else
123-
#define SHIELD_TYPE "Unknown WiFi shield/Library"
123+
#define SHIELD_TYPE "Unknown WiFi shield/Library"
124124
#endif
125125

126126
#if ( defined(NRF52840_FEATHER) || defined(NRF52832_FEATHER) || defined(NRF52_SERIES) || defined(ARDUINO_NRF52_ADAFRUIT) || \
127127
defined(NRF52840_FEATHER_SENSE) || defined(NRF52840_ITSYBITSY) || defined(NRF52840_CIRCUITPLAY) || defined(NRF52840_CLUE) || \
128128
defined(NRF52840_METRO) || defined(NRF52840_PCA10056) || defined(PARTICLE_XENON) || defined(NINA_B302_ublox) || defined(NINA_B112_ublox) )
129-
#if defined(WIFI_USE_NRF528XX)
130-
#undef WIFI_USE_NRF528XX
131-
#endif
132-
#define WIFI_USE_NRF528XX true
129+
#if defined(WIFI_USE_NRF528XX)
130+
#undef WIFI_USE_NRF528XX
131+
#endif
132+
#define WIFI_USE_NRF528XX true
133133
#endif
134134

135135
#if ( defined(ARDUINO_SAMD_ZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRWIFI1010) \
136136
|| defined(ARDUINO_SAMD_NANO_33_IOT) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRWAN1310) \
137137
|| defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRNB1500) || defined(ARDUINO_SAMD_MKRVIDOR4000) || defined(__SAMD21G18A__) \
138138
|| defined(ARDUINO_SAMD_CIRCUITPLAYGROUND_EXPRESS) || defined(__SAMD21E18A__) || defined(__SAMD51__) || defined(__SAMD51J20A__) || defined(__SAMD51J19A__) \
139139
|| defined(__SAMD51G19A__) || defined(__SAMD51P19A__) || defined(__SAMD21G18A__) )
140-
#if defined(WIFI_USE_SAMD)
141-
#undef WIFI_USE_SAMD
142-
#endif
143-
#define WIFI_USE_SAMD true
140+
#if defined(WIFI_USE_SAMD)
141+
#undef WIFI_USE_SAMD
142+
#endif
143+
#define WIFI_USE_SAMD true
144144
#endif
145145

146146
#if ( defined(ARDUINO_SAM_DUE) || defined(__SAM3X8E__) )
@@ -154,10 +154,10 @@
154154
#if ( defined(STM32F0) || defined(STM32F1) || defined(STM32F2) || defined(STM32F3) ||defined(STM32F4) || defined(STM32F7) || \
155155
defined(STM32L0) || defined(STM32L1) || defined(STM32L4) || defined(STM32H7) ||defined(STM32G0) || defined(STM32G4) || \
156156
defined(STM32WB) || defined(STM32MP1) ) && ! ( defined(ARDUINO_PORTENTA_H7_M7) || defined(ARDUINO_PORTENTA_H7_M4) )
157-
#if defined(WIFI_USE_STM32)
158-
#undef WIFI_USE_STM32
159-
#endif
160-
#define WIFI_USE_STM32 true
157+
#if defined(WIFI_USE_STM32)
158+
#undef WIFI_USE_STM32
159+
#endif
160+
#define WIFI_USE_STM32 true
161161
#endif
162162

163163
#ifdef CORE_TEENSY
@@ -380,7 +380,7 @@
380380
#define BOARD_NAME BOARD_TYPE
381381
#else
382382
#define BOARD_NAME "Unknown Board"
383-
#endif
383+
#endif
384384
#endif
385385

386386
#include <WiFiHttpClient.h>

examples/HTTPClient/CustomHeader/CustomHeader.ino

+36-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
CustomHeader.ino - Simple Arduino web server sample for WiFi shield
33
44
For any WiFi shields, such as WiFiNINA W101, W102, W13x, or custom, such as ESP8266/ESP32-AT, Ethernet, etc
5-
5+
66
WiFiWebServer is a library for the ESP32-based WiFi shields to run WebServer
77
Based on and modified from ESP8266 https://github.com/esp8266/Arduino/releases
88
Based on and modified from Arduino WiFiNINA library https://www.arduino.cc/en/Reference/WiFiNINA
@@ -48,10 +48,13 @@ void printWifiStatus()
4848
void setup()
4949
{
5050
Serial.begin(115200);
51+
5152
while (!Serial && millis() < 5000);
5253

53-
Serial.print(F("\nStarting CustomHeader on ")); Serial.print(BOARD_NAME);
54-
Serial.print(F(" with ")); Serial.println(SHIELD_TYPE);
54+
Serial.print(F("\nStarting CustomHeader on "));
55+
Serial.print(BOARD_NAME);
56+
Serial.print(F(" with "));
57+
Serial.println(SHIELD_TYPE);
5558
Serial.println(WIFI_WEBSERVER_VERSION);
5659

5760
#if WIFI_USING_ESP_AT
@@ -62,46 +65,49 @@ void setup()
6265
WiFi.init(&EspSerial);
6366

6467
Serial.println(F("WiFi shield init done"));
65-
68+
6669
#endif
6770

6871
#if !(ESP32 || ESP8266)
69-
72+
7073
// check for the presence of the shield
71-
#if USE_WIFI_NINA
72-
if (WiFi.status() == WL_NO_MODULE)
73-
#else
74-
if (WiFi.status() == WL_NO_SHIELD)
75-
#endif
76-
{
77-
Serial.println(F("WiFi shield not present"));
78-
// don't continue
79-
while (true);
80-
}
81-
82-
#if USE_WIFI_NINA
83-
String fv = WiFi.firmwareVersion();
84-
85-
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
86-
{
87-
Serial.println(F("Please upgrade the firmware"));
88-
}
89-
#endif
90-
74+
#if USE_WIFI_NINA
75+
76+
if (WiFi.status() == WL_NO_MODULE)
77+
#else
78+
if (WiFi.status() == WL_NO_SHIELD)
79+
#endif
80+
{
81+
Serial.println(F("WiFi shield not present"));
82+
83+
// don't continue
84+
while (true);
85+
}
86+
87+
#if USE_WIFI_NINA
88+
String fv = WiFi.firmwareVersion();
89+
90+
if (fv < WIFI_FIRMWARE_LATEST_VERSION)
91+
{
92+
Serial.println(F("Please upgrade the firmware"));
93+
}
94+
95+
#endif
96+
9197
#endif
9298

9399
Serial.print(F("Connecting to SSID: "));
94100
Serial.println(ssid);
95-
101+
96102
status = WiFi.begin(ssid, pass);
97103

98104
delay(1000);
99-
105+
100106
// attempt to connect to WiFi network
101107
while ( status != WL_CONNECTED)
102108
{
103109
delay(500);
104-
110+
105111
// Connect to WPA/WPA2 network
106112
status = WiFi.status();
107113
}
@@ -110,11 +116,11 @@ void setup()
110116
printWifiStatus();
111117
}
112118

113-
void loop()
119+
void loop()
114120
{
115121
Serial.println("Making GET request");
116122
httpClient.beginRequest();
117-
123+
118124
httpClient.get("/");
119125
httpClient.sendHeader("X-CUSTOM-HEADER", "custom_value");
120126
httpClient.endRequest();

0 commit comments

Comments
 (0)