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

Commit dfc9a04

Browse files
authored
v1.0.1 to fix bug in examples
### Release v1.0.1 1. Fix bug in examples
1 parent 39eb614 commit dfc9a04

File tree

8 files changed

+58
-209
lines changed

8 files changed

+58
-209
lines changed

README.md

Lines changed: 38 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -178,170 +178,13 @@ Please take a look at other examples, as well.
178178

179179
#### 1. File [AsyncHTTPRequest.ino](examples/AsyncHTTPRequest/AsyncHTTPRequest.ino)
180180

181-
```cpp
182-
#include "defines.h"
183-
184-
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN_TARGET "AsyncHTTPRequest_RP2040W v1.0.0"
185-
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN 1000000
186-
187-
// To be included only in main(), .ino with setup() to avoid `Multiple Definitions` Linker Error
188-
#include <AsyncHTTPRequest_RP2040W.h> // https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W
189-
190-
AsyncHTTPRequest request;
191-
192-
int status = WL_IDLE_STATUS;
193-
194-
void sendRequest()
195-
{
196-
static bool requestOpenResult;
197-
198-
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
199-
{
200-
//requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/Europe/London.txt");
201-
requestOpenResult = request.open("GET", "http://worldtimeapi.org/api/timezone/America/Toronto.txt");
202-
//requestOpenResult = request.open("GET", "http://213.188.196.246/api/timezone/America/Toronto.txt");
203-
204-
if (requestOpenResult)
205-
{
206-
Serial.println("Request sent");
207-
208-
// Only send() if open() returns true, or crash
209-
request.send();
210-
}
211-
else
212-
{
213-
Serial.println("Can't send bad request");
214-
}
215-
}
216-
else
217-
{
218-
Serial.println("Can't send request");
219-
}
220-
}
221-
222-
void requestCB(void* optParm, AsyncHTTPRequest* request, int readyState)
223-
{
224-
(void) optParm;
225-
226-
if (readyState == readyStateDone)
227-
{
228-
Serial.println("\n**************************************");
229-
Serial.println(request->responseText());
230-
Serial.println("**************************************");
231-
232-
request->setDebug(false);
233-
}
234-
}
235-
236-
void printWifiStatus()
237-
{
238-
// print the SSID of the network you're attached to:
239-
Serial.print("SSID: ");
240-
Serial.println(WiFi.SSID());
241-
242-
// print your board's IP address:
243-
IPAddress ip = WiFi.localIP();
244-
Serial.print("Local IP Address: ");
245-
Serial.println(ip);
246-
247-
// print the received signal strength:
248-
long rssi = WiFi.RSSI();
249-
Serial.print("signal strength (RSSI):");
250-
Serial.print(rssi);
251-
Serial.println(" dBm");
252-
}
253-
254-
void setup()
255-
{
256-
Serial.begin(115200);
257-
while (!Serial);
258-
259-
Serial.print("\nStart AsyncHTTPRequest on "); Serial.println(BOARD_NAME);
260-
Serial.println(ASYNCTCP_RP2040W_VERSION);
261-
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION);
262-
263-
#if defined(ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN)
264-
if (ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT < ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN)
265-
{
266-
Serial.print("Warning. Must use this example on Version equal or later than : ");
267-
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN_TARGET);
268-
}
269-
#endif
270-
271-
///////////////////////////////////
272-
273-
// check for the WiFi module:
274-
if (WiFi.status() == WL_NO_MODULE)
275-
{
276-
Serial.println("Communication with WiFi module failed!");
277-
// don't continue
278-
while (true);
279-
}
280-
281-
Serial.print(F("Connecting to SSID: "));
282-
Serial.println(ssid);
283-
284-
status = WiFi.begin(ssid, pass);
285-
286-
delay(1000);
287-
288-
// attempt to connect to WiFi network
289-
while ( status != WL_CONNECTED)
290-
{
291-
delay(500);
292-
293-
// Connect to WPA/WPA2 network
294-
status = WiFi.status();
295-
}
296-
297-
printWifiStatus();
298-
299-
///////////////////////////////////
300-
301-
request.setDebug(false);
302-
303-
request.onReadyStateChange(requestCB);
304-
}
305-
306-
void sendRequestRepeat()
307-
{
308-
static unsigned long sendRequest_timeout = 0;
309-
310-
#define SEND_REQUEST_INTERVAL 60000L
311-
312-
// sendRequest every SEND_REQUEST_INTERVAL (60) seconds: we don't need to sendRequest frequently
313-
if ((millis() > sendRequest_timeout) || (sendRequest_timeout == 0))
314-
{
315-
sendRequest();
316-
317-
sendRequest_timeout = millis() + SEND_REQUEST_INTERVAL;
318-
}
319-
}
320-
321-
void loop()
322-
{
323-
sendRequestRepeat();
324-
}
325-
```
181+
https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/39eb61479ae868729b43ebb2c86bc11437fce2f8/examples/AsyncHTTPRequest/AsyncHTTPRequest.ino#L41-L177
326182

327183
---
328184

329185
#### 2. File [defines.h](examples/AsyncHTTPRequest/defines.h)
330186

331-
332-
```cpp
333-
#ifndef defines_h
334-
#define defines_h
335-
336-
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
337-
#error For RASPBERRY_PI_PICO_W only
338-
#endif
339-
340-
char ssid[] = "your_ssid"; // your network SSID (name)
341-
char pass[] = "12345678"; // your network password (use for WPA, or use as key for WEP), length must be 8+
342-
343-
#endif //defines_h
344-
```
187+
https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/39eb61479ae868729b43ebb2c86bc11437fce2f8/examples/AsyncHTTPRequest/defines.h#L1-L30
345188

346189
---
347190
---
@@ -351,50 +194,50 @@ char pass[] = "12345678"; // your network password (use for WPA, or use
351194
#### 1. [AsyncHTTPRequest](examples/AsyncHTTPRequest) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
352195

353196
```
354-
Start AsyncHTTPRequest on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
197+
198+
Start AsyncHTTPRequest on RASPBERRY_PI_PICO_W
355199
AsyncTCP_RP2040W v1.0.0
356-
AsyncHTTPRequest_RP2040W v1.0.0
200+
AsyncHTTPRequest_RP2040W v1.0.1
357201
Connecting to SSID: HueNet1
358202
SSID: HueNet1
359-
Local IP Address: 192.168.2.94
360-
signal strength (RSSI):-25 dBm
361-
203+
Local IP Address: 192.168.2.180
362204
Request sent
205+
363206
**************************************
364-
abbreviation: EST
365-
client_ip: aaa.bbb.ccc.ddd
366-
datetime: 2022-01-23T19:06:29.846071-05:00
367-
day_of_week: 0
368-
day_of_year: 23
369-
dst: false
370-
dst_from:
371-
dst_offset: 0
372-
dst_until:
207+
abbreviation: EDT
208+
client_ip: 69.165.159.183
209+
datetime: 2022-08-15T21:53:32.353173-04:00
210+
day_of_week: 1
211+
day_of_year: 227
212+
dst: true
213+
dst_from: 2022-03-13T07:00:00+00:00
214+
dst_offset: 3600
215+
dst_until: 2022-11-06T06:00:00+00:00
373216
raw_offset: -18000
374217
timezone: America/Toronto
375-
unixtime: 1642982789
376-
utc_datetime: 2022-01-24T00:06:29.846071+00:00
377-
utc_offset: -05:00
378-
week_number: 3
218+
unixtime: 1660614812
219+
utc_datetime: 2022-08-16T01:53:32.353173+00:00
220+
utc_offset: -04:00
221+
week_number: 33
379222
**************************************
380223
Request sent
381224
382225
**************************************
383-
abbreviation: EST
384-
client_ip: aaa.bbb.ccc.ddd
385-
datetime: 2022-01-23T19:08:29.871390-05:00
386-
day_of_week: 0
387-
day_of_year: 23
388-
dst: false
389-
dst_from:
390-
dst_offset: 0
391-
dst_until:
226+
abbreviation: EDT
227+
client_ip: 69.165.159.183
228+
datetime: 2022-08-15T21:54:32.316488-04:00
229+
day_of_week: 1
230+
day_of_year: 227
231+
dst: true
232+
dst_from: 2022-03-13T07:00:00+00:00
233+
dst_offset: 3600
234+
dst_until: 2022-11-06T06:00:00+00:00
392235
raw_offset: -18000
393236
timezone: America/Toronto
394-
unixtime: 1642982909
395-
utc_datetime: 2022-01-24T00:08:29.871390+00:00
396-
utc_offset: -05:00
397-
week_number: 3
237+
unixtime: 1660614872
238+
utc_datetime: 2022-08-16T01:54:32.316488+00:00
239+
utc_offset: -04:00
240+
week_number: 33
398241
**************************************
399242
```
400243

@@ -405,11 +248,10 @@ week_number: 3
405248
```
406249
Start AsyncDweetPOST on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
407250
AsyncTCP_RP2040W v1.0.0
408-
AsyncHTTPRequest_RP2040W v1.0.0
251+
AsyncHTTPRequest_RP2040W v1.0.1
409252
Connecting to SSID: HueNet1
410253
SSID: HueNet1
411-
Local IP Address: 192.168.2.94
412-
signal strength (RSSI):-25 dBm
254+
Local IP Address: 192.168.2.180
413255
414256
Making new POST request
415257
@@ -426,13 +268,12 @@ Actual value: 88
426268
#### 3. [AsyncWebClientRepeating](examples/AsyncWebClientRepeating) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
427269

428270
```
429-
Start AsyncWebClientRepeating on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
271+
Start AsyncWebClientRepeating on RASPBERRY_PI_PICO_W
430272
AsyncTCP_RP2040W v1.0.0
431-
AsyncHTTPRequest_RP2040W v1.0.0
273+
AsyncHTTPRequest_RP2040W v1.0.1
432274
Connecting to SSID: HueNet1
433275
SSID: HueNet1
434-
Local IP Address: 192.168.2.94
435-
signal strength (RSSI):-26 dBm
276+
Local IP Address: 192.168.2.180
436277
437278
**************************************
438279

changelog.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
## Table of Contents
1212

1313
* [Changelog](#changelog)
14-
* [Initial Releases v1.0.0](#Initial-Releases-v100)
14+
* [Release v1.0.1](#Release-v101)
15+
* [Initial Release v1.0.0](#Initial-Release-v100)
1516

1617
---
1718
---
1819

1920
## Changelog
2021

22+
### Release v1.0.1
2123

22-
### Initial Releases v1.0.0
24+
1. Fix bug in examples
25+
26+
### Initial Release v1.0.0
2327

2428
1. Initial coding to support **RASPBERRY_PI_PICO_W with CYW43439 WiFi**, using [**arduino-pico core v2.4.0+**](https://github.com/earlephilhower/arduino-pico)

library.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "AsyncHTTPRequest_RP2040W",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"keywords": "communication, http, async, websocket, webserver, async-webserver, async-tcp, async-udp, async-websocket, async-http, ssl, tls, mbed, mbed-portenta, portenta-h7, portentah7, portenta-h7-m7, portenta-h7-m4, portentah7-m7, portentah7-m4, stm32h7",
55
"description": "Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_RP2040W library for RASPBERRY_PI_PICO_W with CYW43439 WiFi. This library, which relies on AsyncTCP_RP2040W, is part of a series of advanced Async libraries, such as AsyncTCP_RP2040W, AsyncUDP_RP2040W, AsyncWebSockets_RP2040W, AsyncWebServer_RP2040W, AsyncHTTPRequest_RP2040W, AsyncHTTPSRequest_RP2040W, etc.",
66
"authors":
@@ -19,7 +19,7 @@
1919
"repository":
2020
{
2121
"type": "git",
22-
"url": "https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W"
22+
"url": "//https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W"
2323
},
2424
"homepage": "https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W",
2525
"export": {

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=AsyncHTTPRequest_RP2040W
2-
version=1.0.0
2+
version=1.0.1
33
author=Bob Lemaire,Khoi Hoang
44
maintainer=Khoi Hoang <khoih.prog@gmail.com>
55
sentence=Simple Async HTTP Request library, supporting GET, POST, PUT, PATCH, DELETE and HEAD, on top of AsyncTCP_RP2040W library for RASPBERRY_PI_PICO_W with CYW43439 WiFi.

src/AsyncHTTPRequest_RP2040W.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1616
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
18-
Version: 1.0.0
18+
Version: 1.0.1
1919
2020
Version Modified By Date Comments
2121
------- ----------- ---------- -----------
2222
1.0.0 K Hoang 14/08/2022 Initial coding for RP2040W with CYW43439 WiFi
23+
1.0.1 K Hoang 15/08/2022 Fix bug in examples
2324
*****************************************************************************************************************************/
2425

2526
#pragma once

src/AsyncHTTPRequest_RP2040W.hpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1616
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
18-
Version: 1.0.0
18+
Version: 1.0.1
1919
2020
Version Modified By Date Comments
2121
------- ----------- ---------- -----------
2222
1.0.0 K Hoang 14/08/2022 Initial coding for RP2040W with CYW43439 WiFi
23+
1.0.1 K Hoang 15/08/2022 Fix bug in examples
2324
*****************************************************************************************************************************/
2425

2526
#pragma once
@@ -59,13 +60,13 @@
5960
#define SHIELD_TYPE "RP2040W CYW43439 WiFi"
6061
#endif
6162

62-
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION "AsyncHTTPRequest_RP2040W v1.0.0"
63+
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION "AsyncHTTPRequest_RP2040W v1.0.1"
6364

6465
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MAJOR 1
6566
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_MINOR 0
66-
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_PATCH 0
67+
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_PATCH 1
6768

68-
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT 1000000
69+
#define ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT 1000001
6970

7071
#include "AsyncTCP_RP2040W.h"
7172

src/AsyncHTTPRequest_RP2040W_Debug.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1616
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
18-
Version: 1.0.0
18+
Version: 1.0.1
1919
2020
Version Modified By Date Comments
2121
------- ----------- ---------- -----------
2222
1.0.0 K Hoang 14/08/2022 Initial coding for RP2040W with CYW43439 WiFi
23+
1.0.1 K Hoang 15/08/2022 Fix bug in examples
2324
*****************************************************************************************************************************/
2425

2526
#pragma once

0 commit comments

Comments
 (0)