mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Migrate from astyle to clang-format (#8464)
This commit is contained in:
committed by
Max Prokhorov
parent
46190b61f1
commit
19b7a29720
@ -31,7 +31,6 @@ void setup() {
|
||||
|
||||
WiFi.mode(WIFI_STA);
|
||||
WiFiMulti.addAP("SSID", "PASSWORD");
|
||||
|
||||
}
|
||||
|
||||
void loop() {
|
||||
@ -39,13 +38,13 @@ void loop() {
|
||||
if ((WiFiMulti.run() == WL_CONNECTED)) {
|
||||
|
||||
WiFiClient client;
|
||||
HTTPClient http; //must be declared after WiFiClient for correct destruction order, because used by http.begin(client,...)
|
||||
HTTPClient http; // must be declared after WiFiClient for correct destruction order, because used by http.begin(client,...)
|
||||
|
||||
Serial.print("[HTTP] begin...\n");
|
||||
|
||||
// configure server and url
|
||||
http.begin(client, "http://jigsaw.w3.org/HTTP/connection.html");
|
||||
//http.begin(client, "jigsaw.w3.org", 80, "/HTTP/connection.html");
|
||||
// http.begin(client, "jigsaw.w3.org", 80, "/HTTP/connection.html");
|
||||
|
||||
Serial.print("[HTTP] GET...\n");
|
||||
// start connection and send HTTP header
|
||||
@ -70,23 +69,19 @@ void loop() {
|
||||
// or "by hand"
|
||||
|
||||
// get tcp stream
|
||||
WiFiClient * stream = &client;
|
||||
WiFiClient* stream = &client;
|
||||
|
||||
// read all data from server
|
||||
while (http.connected() && (len > 0 || len == -1)) {
|
||||
// read up to 128 byte
|
||||
int c = stream->readBytes(buff, std::min((size_t)len, sizeof(buff)));
|
||||
Serial.printf("readBytes: %d\n", c);
|
||||
if (!c) {
|
||||
Serial.println("read timeout");
|
||||
}
|
||||
if (!c) { Serial.println("read timeout"); }
|
||||
|
||||
// write it to Serial
|
||||
Serial.write(buff, c);
|
||||
|
||||
if (len > 0) {
|
||||
len -= c;
|
||||
}
|
||||
if (len > 0) { len -= c; }
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user