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

Commit 4b56b00

Browse files
authored
Update README.md and use allman astyle
1 parent f48c4a7 commit 4b56b00

File tree

24 files changed

+1869
-1852
lines changed

24 files changed

+1869
-1852
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Please ensure to specify the following:
2929
Arduino IDE version: 1.8.19
3030
ESP32 Core Version 2.0.5
3131
OS: Ubuntu 20.04 LTS
32-
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
32+
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
3333
3434
Context:
3535
I encountered a crash while using this library

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
# AsyncHTTPRequest_Generic
1+
# AsyncHTTPRequest_Generic Library
22

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

9+
910
<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>
1011
<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>
12+
<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>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_Generic/count.svg" title="AsyncHTTPRequest_Generic Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_Generic/count.svg" style="height: 30px;width: 200px;"></a>
1114

1215
---
1316
---
@@ -212,18 +215,22 @@ The best and easiest way is to use `Arduino Library Manager`. Search for `AsyncH
212215

213216
#### 1. For STM32 boards to use LAN8720
214217

218+
For `Generic STM32F4 series` boards, such as `STM32F407VE`, using `LAN8720`, please use STM32 core `v2.2.0` as breaking core `v2.3.0` creates the compile error.
219+
220+
---
221+
215222
To use LAN8720 on some STM32 boards
216223

217224
- **Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)**
218225
- **Discovery (DISCO_F746NG)**
219226
- **STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)**
220227

221-
you have to copy the files [stm32f4xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.3.0/system/STM32F4xx) and [stm32f7xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.3.0/system/STM32F7xx) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system) to overwrite the old files.
228+
you have to copy the files [stm32f4xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.2.0/system/STM32F4xx) and [stm32f7xx_hal_conf_default.h](Packages_Patches/STM32/hardware/stm32/2.2.0/system/STM32F7xx) into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system) to overwrite the old files.
222229

223-
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
230+
Supposing the STM32 stm32 core version is 2.2.0. These files must be copied into the directory:
224231

225-
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h` for STM32F4.
226-
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h` for Nucleo-144 STM32F7.
232+
- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h` for STM32F4.
233+
- `~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h` for Nucleo-144 STM32F7.
227234

228235
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz,
229236
these files must be copied into the corresponding directory:
@@ -238,14 +245,14 @@ these files must be copied into the corresponding directory:
238245

239246
Supposing the STM32 stm32 core version is 2.3.0. These files must be copied into the directory:
240247

241-
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h` for Nucleo-144 NUCLEO_F767ZI.
242-
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h` for Nucleo-64 NUCLEO_L053R8.
248+
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/NUCLEO_F767ZI/variant.h` for Nucleo-144 NUCLEO_F767ZI.
249+
- `~/.arduino15/packages/STM32/hardware/stm32/2.3.0/variants/NUCLEO_L053R8/variant.h` for Nucleo-64 NUCLEO_L053R8.
243250

244251
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz,
245252
these files must be copied into the corresponding directory:
246253

247-
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h`
248-
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h`
254+
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/NUCLEO_F767ZI/variant.h`
255+
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/NUCLEO_L053R8/variant.h`
249256

250257
---
251258
---
@@ -402,7 +409,7 @@ Connect as follows. To program, use **STM32CubeProgrammer** or Arduino IDE with
402409
403410
404411
<p align="center">
405-
<img src="https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/master/Images/STM32F407VET6.png">
412+
<img src="https://github.com/khoih-prog/AsyncHTTPRequest_Generic/raw/master/Images/STM32F407VET6.png">
406413
</p>
407414
408415
---
@@ -495,7 +502,7 @@ https://github.com/khoih-prog/AsyncHTTPRequest_Generic/blob/639ce917e54c296f15fd
495502
496503
#### 1. [AsyncHTTPRequest_STM32](examples/AsyncHTTPRequest_STM32) running on STM32F7 Nucleo-144 NUCLEO_F767ZI using built-in LAN8742A
497504
498-
```
505+
```cpp
499506
Start AsyncHTTPRequest_STM32 on NUCLEO_F767ZI
500507
AsyncHTTPRequest_Generic v1.10.2
501508
AsyncHTTPRequest @ IP : 192.168.2.178
@@ -540,7 +547,7 @@ week_number: 42
540547

541548
#### 2. [AsyncHTTPRequest_ESP_WiFiManager](examples/AsyncHTTPRequest_ESP_WiFiManager) running on ESP8266_NODEMCU
542549

543-
```
550+
```cpp
544551
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP8266_NODEMCU
545552
AsyncHTTPRequest_Generic v1.10.2
546553
Stored: SSID = HueNet1, Pass = 12345678
@@ -572,7 +579,7 @@ HHHHHH
572579

573580
#### 3. [AsyncHTTPRequest_ESP_WiFiManager](examples/AsyncHTTPRequest_ESP_WiFiManager) running on ESP32_DEV
574581

575-
```
582+
```cpp
576583
Starting AsyncHTTPRequest_ESP_WiFiManager using SPIFFS on ESP32_DEV
577584
AsyncHTTPRequest_Generic v1.10.2
578585
Stored: SSID = HueNet1, Pass = 12345678
@@ -622,7 +629,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH
622629

623630
#### 4. [AsyncHTTPRequest_ESP](examples/AsyncHTTPRequest_ESP) running on ESP8266_NODEMCU
624631

625-
```
632+
```cpp
626633
Starting AsyncHTTPRequest_ESP using ESP8266_NODEMCU
627634
AsyncHTTPRequest_Generic v1.10.2
628635
Connecting to WiFi SSID: HueNet1
@@ -654,7 +661,7 @@ HHHHHHHHH HHHHHHHHHH HHHHHHHHHH H
654661
#### 5. [AsyncWebClientRepeating_STM32](examples/AsyncWebClientRepeating_STM32) running on STM32F7 Nucleo-144 NUCLEO_F767ZI using built-in LAN8742A
655662

656663

657-
```
664+
```cpp
658665
Start AsyncWebClientRepeating_STM32 on NUCLEO_F767ZI
659666
AsyncHTTPRequest_Generic v1.10.2
660667
AsyncHTTPRequest @ IP : 192.168.2.72
@@ -707,7 +714,7 @@ AsyncHTTPRequest @ IP : 192.168.2.72
707714

708715
#### 6. [AsyncHTTPRequest_WT32_ETH01](examples/WT32_ETH01/AsyncHTTPRequest_WT32_ETH01) on ESP32_DEV with ETH_PHY_LAN8720
709716

710-
```
717+
```cpp
711718
Starting AsyncHTTPRequest_WT32_ETH01 on ESP32_DEV with ETH_PHY_LAN8720
712719
WebServer_WT32_ETH01 v1.5.1
713720
AsyncHTTPRequest_Generic v1.10.2
@@ -737,7 +744,7 @@ week_number: 45
737744

738745
#### 7. [AsyncHTTPRequest_ESP_WiFiManager](examples/AsyncHTTPRequest_ESP_WiFiManager) running on ESP32C3_DEV
739746

740-
```
747+
```cpp
741748
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP32C3_DEV
742749
ESPAsync_WiFiManager v1.15.0
743750
AsyncHTTPRequest_Generic v1.10.2
@@ -788,7 +795,7 @@ week_number: 45
788795
#### 8. [AsyncHTTPRequest_ESP_WiFiManager](examples/AsyncHTTPRequest_ESP_WiFiManager) running on ESP32S3_DEV
789796

790797

791-
```
798+
```cpp
792799
Starting AsyncHTTPRequest_ESP_WiFiManager using LittleFS on ESP32S3_DEV
793800
ESPAsync_WiFiManager v1.15.0
794801
AsyncHTTPRequest_Generic v1.10.2
@@ -841,7 +848,7 @@ week_number: 45
841848

842849
The terminal output of [AsyncHTTPRequest_ESP_Multi example](examples/AsyncHTTPRequest_ESP_Multi) running on `ESP32_DEV` to demonstrate how to send requests to multiple addresses and receive responses from them.
843850

844-
```
851+
```cpp
845852
Starting AsyncHTTPRequest_ESP_Multi using ESP32_DEV
846853
AsyncHTTPRequest_Generic v1.10.2
847854
Connecting to WiFi SSID: HueNet1
@@ -902,7 +909,7 @@ HHH
902909

903910
The terminal output of [AsyncHTTPRequest_ESP8266_Ethernet example](examples/AsyncHTTPRequest_ESP8266_Ethernet) running on `ESP8266_NODEMCU_ESP12E` to demonstrate how to use ESP8266_W5500 Ethernet Async feature.
904911

905-
```
912+
```cpp
906913
Starting AsyncHTTPRequest_ESP8266_Ethernet on ESP8266_NODEMCU_ESP12E using ESP8266_W5500 Ethernet
907914
AsyncHTTPRequest_Generic v1.10.2
908915
Connecting ethernet..
@@ -952,7 +959,7 @@ HH
952959

953960
The terminal output of [AsyncHTTPRequest_ESP8266_Ethernet example](examples/AsyncHTTPRequest_ESP8266_Ethernet) running on `ESP8266_NODEMCU_ESP12E` to demonstrate how to use ESP8266_ENC28J60 Ethernet Async feature.
954961

955-
```
962+
```cpp
956963
Starting AsyncHTTPRequest_ESP8266_Ethernet on ESP8266_NODEMCU_ESP12E using ESP8266_ENC28J60 Ethernet
957964
AsyncHTTPRequest_Generic v1.10.2
958965
Connecting to network : ..........................................................
@@ -1124,7 +1131,7 @@ If you want to contribute to this project:
11241131

11251132
Copyright (C) <2018> <Bob Lemaire, IoTaWatt, Inc.>
11261133

1127-
Copyright 2020- Khoi Hoang
1134+
Copyright (C) 2020- Khoi Hoang
11281135

11291136

11301137

changelog.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
# AsyncHTTPRequest_Generic
1+
# AsyncHTTPRequest_Generic Library
22

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

9+
10+
<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>
11+
<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>
12+
<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>
13+
<a href="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_Generic/count.svg" title="AsyncHTTPRequest_Generic Visitor count"><img src="https://profile-counter.glitch.me/khoih-prog-AsyncHTTPRequest_Generic/count.svg" style="height: 30px;width: 200px;"></a>
14+
915
---
1016
---
1117

examples/AsyncCustomHeader_STM32/AsyncCustomHeader_STM32.ino

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -47,102 +47,102 @@ Ticker sendHTTPRequest(sendRequest, HTTP_REQUEST_INTERVAL_MS, 0, MILLIS);
4747

4848
void sendRequest(void)
4949
{
50-
static bool requestOpenResult;
51-
52-
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
53-
{
54-
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
55-
56-
requestOpenResult = request.open("GET", GET_ServerAddress);
57-
58-
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
59-
if (requestOpenResult)
60-
{
61-
// Only send() if open() returns true, or crash
62-
request.send();
63-
}
64-
else
65-
{
66-
Serial.println("Can't send bad request");
67-
}
68-
}
69-
else
70-
{
71-
Serial.println("Can't send request");
72-
}
50+
static bool requestOpenResult;
51+
52+
if (request.readyState() == readyStateUnsent || request.readyState() == readyStateDone)
53+
{
54+
Serial.println("\nSending GET Request to " + String(GET_ServerAddress));
55+
56+
requestOpenResult = request.open("GET", GET_ServerAddress);
57+
58+
//request.setReqHeader("X-CUSTOM-HEADER", "custom_value");
59+
if (requestOpenResult)
60+
{
61+
// Only send() if open() returns true, or crash
62+
request.send();
63+
}
64+
else
65+
{
66+
Serial.println("Can't send bad request");
67+
}
68+
}
69+
else
70+
{
71+
Serial.println("Can't send request");
72+
}
7373
}
7474

7575
void requestCB(void *optParm, AsyncHTTPRequest *request, int readyState)
7676
{
77-
(void) optParm;
78-
79-
if (readyState == readyStateDone)
80-
{
81-
Serial.println();
82-
AHTTP_LOGDEBUG(F("**************************************"));
83-
AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());
84-
85-
if (request->responseHTTPcode() == 200)
86-
{
87-
Serial.println(F("**************************************"));
88-
Serial.println(request->responseText());
89-
Serial.println(F("**************************************"));
90-
}
91-
else
92-
{
93-
AHTTP_LOGERROR(F("Response error"));
94-
}
95-
}
77+
(void) optParm;
78+
79+
if (readyState == readyStateDone)
80+
{
81+
Serial.println();
82+
AHTTP_LOGDEBUG(F("**************************************"));
83+
AHTTP_LOGDEBUG1(F("Response Code = "), request->responseHTTPString());
84+
85+
if (request->responseHTTPcode() == 200)
86+
{
87+
Serial.println(F("**************************************"));
88+
Serial.println(request->responseText());
89+
Serial.println(F("**************************************"));
90+
}
91+
else
92+
{
93+
AHTTP_LOGERROR(F("Response error"));
94+
}
95+
}
9696
}
9797

9898
void setup(void)
9999
{
100-
Serial.begin(115200);
100+
Serial.begin(115200);
101101

102-
while (!Serial && millis() < 5000);
102+
while (!Serial && millis() < 5000);
103103

104-
Serial.print("\nStart AsyncCustomHeader_STM32 on ");
105-
Serial.println(BOARD_NAME);
106-
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
104+
Serial.print("\nStart AsyncCustomHeader_STM32 on ");
105+
Serial.println(BOARD_NAME);
106+
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION);
107107

108108
#if defined(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
109109

110-
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
111-
{
112-
Serial.print("Warning. Must use this example on Version equal or later than : ");
113-
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
114-
}
110+
if (ASYNC_HTTP_REQUEST_GENERIC_VERSION_INT < ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN)
111+
{
112+
Serial.print("Warning. Must use this example on Version equal or later than : ");
113+
Serial.println(ASYNC_HTTP_REQUEST_GENERIC_VERSION_MIN_TARGET);
114+
}
115115

116116
#endif
117117

118-
// start the ethernet connection and the server
119-
// Use random mac
120-
uint16_t index = millis() % NUMBER_OF_MAC;
118+
// start the ethernet connection and the server
119+
// Use random mac
120+
uint16_t index = millis() % NUMBER_OF_MAC;
121121

122-
// Use Static IP
123-
//Ethernet.begin(mac[index], ip);
124-
// Use DHCP dynamic IP and random mac
125-
Ethernet.begin(mac[index]);
122+
// Use Static IP
123+
//Ethernet.begin(mac[index], ip);
124+
// Use DHCP dynamic IP and random mac
125+
Ethernet.begin(mac[index]);
126126

127-
Serial.print(F("AsyncHTTPRequest @ IP : "));
128-
Serial.println(Ethernet.localIP());
129-
Serial.println();
127+
Serial.print(F("AsyncHTTPRequest @ IP : "));
128+
Serial.println(Ethernet.localIP());
129+
Serial.println();
130130

131-
request.setDebug(false);
131+
request.setDebug(false);
132132

133-
// 5s timeout
134-
request.setTimeout(5);
133+
// 5s timeout
134+
request.setTimeout(5);
135135

136-
request.onReadyStateChange(requestCB);
136+
request.onReadyStateChange(requestCB);
137137

138-
sendHTTPRequest.start(); //start the ticker.
138+
sendHTTPRequest.start(); //start the ticker.
139139

140-
// Send first request now
141-
delay(10000);
142-
sendRequest();
140+
// Send first request now
141+
delay(10000);
142+
sendRequest();
143143
}
144144

145145
void loop(void)
146146
{
147-
sendHTTPRequest.update();
147+
sendHTTPRequest.update();
148148
}

0 commit comments

Comments
 (0)