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

Commit b1ff0df

Browse files
authored
Update README.md and use allman astyle
1 parent 6401650 commit b1ff0df

File tree

16 files changed

+613
-604
lines changed

16 files changed

+613
-604
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Arduino IDE version: 1.8.19
3131
RP2040 core v2.6.3
3232
RASPBERRY_PI_PICO_W Module
3333
OS: Ubuntu 20.04 LTS
34-
Linux xy-Inspiron-3593 5.15.0-52-generic #58~20.04.1-Ubuntu SMP Thu Oct 13 13:09:46 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
34+
Linux xy-Inspiron-3593 5.15.0-53-generic #59~20.04.1-Ubuntu SMP Thu Oct 20 15:10:22 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
3535
3636
Context:
3737
I encountered a crash while using this library

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
# AsyncHTTPRequest_RP2040W
1+
# AsyncHTTPRequest_RP2040W Library
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncHTTPRequest_RP2040W.svg?)](https://www.ardu-badge.com/AsyncHTTPRequest_RP2040W)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncHTTPRequest_RP2040W.svg)](https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/releases)
55
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
66
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/AsyncHTTPRequest_RP2040W.svg)](http://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/issues)
77

8+
89
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
910
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
11+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_RP2040W/count.svg" title="AsyncHTTPRequest_RP2040W Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_RP2040W/count.svg" style="height: 30px;width: 200px;"></a>
1013

1114
---
1215
---
@@ -196,7 +199,7 @@ https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/blob/73cdc771d7613d2f09a4
196199

197200
#### 1. [AsyncHTTPRequest](examples/AsyncHTTPRequest) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
198201

199-
```
202+
```cpp
200203
Start AsyncHTTPRequest on RASPBERRY_PI_PICO_W
201204
AsyncTCP_RP2040W v1.1.0
202205
AsyncHTTPRequest_RP2040W v1.2.2
@@ -228,7 +231,7 @@ week_number: 45
228231

229232
#### 2. [AsyncDweetPOST](examples/AsyncDweetPOST) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
230233

231-
```
234+
```cpp
232235
Start AsyncDweetPOST on RASPBERRY_PI_PICO_W with RP2040W CYW43439 WiFi
233236
AsyncTCP_RP2040W v1.1.0
234237
AsyncHTTPRequest_RP2040W v1.2.2
@@ -250,7 +253,7 @@ Actual value: 88
250253
251254
#### 3. [AsyncWebClientRepeating](examples/AsyncWebClientRepeating) running on RASPBERRY_PI_PICO_W using CYW43439 WiFi
252255
253-
```
256+
```cpp
254257
Start AsyncWebClientRepeating on RASPBERRY_PI_PICO_W
255258
AsyncTCP_RP2040W v1.1.0
256259
AsyncHTTPRequest_RP2040W v1.2.2
@@ -397,7 +400,7 @@ If you want to contribute to this project:
397400

398401
Copyright (C) <2018> <Bob Lemaire, IoTaWatt, Inc.>
399402

400-
Copyright 2022- Khoi Hoang
403+
Copyright (C) 2022- Khoi Hoang
401404

402405

403406

changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
# AsyncHTTPRequest_RP2040W
1+
# AsyncHTTPRequest_RP2040W Library
22

33
[![arduino-library-badge](https://www.ardu-badge.com/badge/AsyncHTTPRequest_RP2040W.svg?)](https://www.ardu-badge.com/AsyncHTTPRequest_RP2040W)
44
[![GitHub release](https://img.shields.io/github/release/khoih-prog/AsyncHTTPRequest_RP2040W.svg)](https://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/releases)
55
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](#Contributing)
66
[![GitHub issues](https://img.shields.io/github/issues/khoih-prog/AsyncHTTPRequest_RP2040W.svg)](http://github.com/khoih-prog/AsyncHTTPRequest_RP2040W/issues)
77

8+
9+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Donate to my libraries using BuyMeACoffee" style="height: 50px !important;width: 181px !important;" ></a>
10+
<a href="https://www.buymeacoffee.com/khoihprog6" title="Donate to my libraries using BuyMeACoffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-orange.svg?logo=buy-me-a-coffee&logoColor=FFDD00" style="height: 20px !important;width: 200px !important;" ></a>
11+
<a href="https://profile-counter.glitch.me/khoih-prog/count.svg" title="Total khoih-prog Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog/count.svg" style="height: 30px;width: 200px;"></a>
12+
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_RP2040W/count.svg" title="AsyncHTTPRequest_RP2040W Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_RP2040W/count.svg" style="height: 30px;width: 200px;"></a>
13+
814
---
915
---
1016

examples/AsyncCustomHeader/AsyncCustomHeader.ino

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -41,137 +41,137 @@ int status = WL_IDLE_STATUS;
4141

4242
void sendRequest()
4343
{
44-
static bool requestOpenResult;
45-
46-
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
47-
{
48-
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
49-
50-
requestOpenResult = request.open("GET", GET_ServerAddress);
51-
52-
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
53-
if (requestOpenResult)
54-
{
55-
// Only send() if open() returns true, or crash
56-
request.send();
57-
}
58-
else
59-
{
60-
Serial.println("Can't send bad request");
61-
}
62-
}
63-
else
64-
{
65-
Serial.println("Can't send request");
66-
}
44+
static bool requestOpenResult;
45+
46+
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
47+
{
48+
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
49+
50+
requestOpenResult = request.open("GET", GET_ServerAddress);
51+
52+
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
53+
if (requestOpenResult)
54+
{
55+
// Only send() if open() returns true, or crash
56+
request.send();
57+
}
58+
else
59+
{
60+
Serial.println("Can't send bad request");
61+
}
62+
}
63+
else
64+
{
65+
Serial.println("Can't send request");
66+
}
6767
}
6868

6969
void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
7070
{
71-
(void) optParm;
72-
73-
if (readyState == readyStateDone)
74-
{
75-
AHTTP_LOGWARN(F("\n**************************************"));
76-
AHTTP_LOGWARN1(F("Response Code = "), request->responseHTTPString());
77-
78-
if (request->responseHTTPcode() == 200)
79-
{
80-
Serial.println(F("\n**************************************"));
81-
Serial.println(request->responseText());
82-
Serial.println(F("**************************************"));
83-
}
84-
}
71+
(void) optParm;
72+
73+
if (readyState == readyStateDone)
74+
{
75+
AHTTP_LOGWARN(F("\n**************************************"));
76+
AHTTP_LOGWARN1(F("Response Code = "), request->responseHTTPString());
77+
78+
if (request->responseHTTPcode() == 200)
79+
{
80+
Serial.println(F("\n**************************************"));
81+
Serial.println(request->responseText());
82+
Serial.println(F("**************************************"));
83+
}
84+
}
8585
}
8686

8787
void printWifiStatus()
8888
{
89-
// print the SSID of the network you're attached to:
90-
Serial.print("SSID: ");
91-
Serial.println(WiFi.SSID());
92-
93-
// print your board's IP address:
94-
IPAddress ip = WiFi.localIP();
95-
Serial.print("Local IP Address: ");
96-
Serial.println(ip);
89+
// print the SSID of the network you're attached to:
90+
Serial.print("SSID: ");
91+
Serial.println(WiFi.SSID());
92+
93+
// print your board's IP address:
94+
IPAddress ip = WiFi.localIP();
95+
Serial.print("Local IP Address: ");
96+
Serial.println(ip);
9797
}
9898

9999
void setup()
100100
{
101-
Serial.begin(115200);
101+
Serial.begin(115200);
102102

103-
while (!Serial && millis() < 5000);
103+
while (!Serial && millis() < 5000);
104104

105-
Serial.print("\nStart AsyncCustomHeader on ");
106-
Serial.println(BOARD_NAME);
107-
Serial.println(ASYNCTCP_RP2040W_VERSION);
108-
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION);
105+
Serial.print("\nStart AsyncCustomHeader on ");
106+
Serial.println(BOARD_NAME);
107+
Serial.println(ASYNCTCP_RP2040W_VERSION);
108+
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION);
109109

110110
#if defined(ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN)
111111

112-
if (ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT < ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN)
113-
{
114-
Serial.print("Warning. Must use this example on Version equal or later than : ");
115-
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN);
116-
}
112+
if (ASYNC_HTTP_REQUEST_RP2040W_VERSION_INT < ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN)
113+
{
114+
Serial.print("Warning. Must use this example on Version equal or later than : ");
115+
Serial.println(ASYNC_HTTP_REQUEST_RP2040W_VERSION_MIN);
116+
}
117117

118118
#endif
119119

120-
///////////////////////////////////
120+
///////////////////////////////////
121121

122-
// check for the WiFi module:
123-
if (WiFi.status() == WL_NO_MODULE)
124-
{
125-
Serial.println("Communication with WiFi module failed!");
122+
// check for the WiFi module:
123+
if (WiFi.status() == WL_NO_MODULE)
124+
{
125+
Serial.println("Communication with WiFi module failed!");
126126

127-
// don't continue
128-
while (true);
129-
}
127+
// don't continue
128+
while (true);
129+
}
130130

131-
Serial.print(F("Connecting to SSID: "));
132-
Serial.println(ssid);
131+
Serial.print(F("Connecting to SSID: "));
132+
Serial.println(ssid);
133133

134-
status = WiFi.begin(ssid, pass);
134+
status = WiFi.begin(ssid, pass);
135135

136-
delay(1000);
136+
delay(1000);
137137

138-
// attempt to connect to WiFi network
139-
while ( status != WL_CONNECTED)
140-
{
141-
delay(500);
138+
// attempt to connect to WiFi network
139+
while ( status != WL_CONNECTED)
140+
{
141+
delay(500);
142142

143-
// Connect to WPA/WPA2 network
144-
status = WiFi.status();
145-
}
143+
// Connect to WPA/WPA2 network
144+
status = WiFi.status();
145+
}
146146

147-
printWifiStatus();
147+
printWifiStatus();
148148

149-
///////////////////////////////////
149+
///////////////////////////////////
150150

151-
request.setDebug(false);
151+
request.setDebug(false);
152152

153-
// 5s timeout
154-
request.setTimeout(5);
153+
// 5s timeout
154+
request.setTimeout(5);
155155

156-
request.onReadyStateChange(requestCB);
156+
request.onReadyStateChange(requestCB);
157157
}
158158

159159
void sendRequestRepeat()
160160
{
161-
static unsigned long sendRequest_timeout = 0;
161+
static unsigned long sendRequest_timeout = 0;
162162

163163
#define SEND_REQUEST_INTERVAL 60000L
164164

165-
// sendRequest every SEND_REQUEST_INTERVAL (60) seconds: we don't need to sendRequest frequently
166-
if ((millis() > sendRequest_timeout) || (sendRequest_timeout == 0))
167-
{
168-
sendRequest();
165+
// sendRequest every SEND_REQUEST_INTERVAL (60) seconds: we don't need to sendRequest frequently
166+
if ((millis() > sendRequest_timeout) || (sendRequest_timeout == 0))
167+
{
168+
sendRequest();
169169

170-
sendRequest_timeout = millis() + SEND_REQUEST_INTERVAL;
171-
}
170+
sendRequest_timeout = millis() + SEND_REQUEST_INTERVAL;
171+
}
172172
}
173173

174174
void loop()
175175
{
176-
sendRequestRepeat();
176+
sendRequestRepeat();
177177
}

examples/AsyncCustomHeader/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define defines_h
2222

2323
#if !( defined(ARDUINO_RASPBERRY_PI_PICO_W) )
24-
#error For RASPBERRY_PI_PICO_W only
24+
#error For RASPBERRY_PI_PICO_W only
2525
#endif
2626

2727
char ssid[] = "your_ssid"; // your network SSID (name)

0 commit comments

Comments
 (0)