Skip to content

Commit 56623fa

Browse files
author
Federico Fissore
committed
Examples: mass code format. See example_formatter.conf
1 parent 9c4cbd8 commit 56623fa

File tree

11 files changed

+49
-45
lines changed

11 files changed

+49
-45
lines changed

examples/ConnectNoEncryption/ConnectNoEncryption.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ void setup() {
3333
}
3434

3535
String fv = WiFi.firmwareVersion();
36-
if ( fv != "1.1.0" )
36+
if (fv != "1.1.0") {
3737
Serial.println("Please upgrade the firmware");
38+
}
3839

3940
// attempt to connect to Wifi network:
40-
while ( status != WL_CONNECTED) {
41+
while (status != WL_CONNECTED) {
4142
Serial.print("Attempting to connect to open SSID: ");
4243
Serial.println(ssid);
4344
status = WiFi.begin(ssid);

examples/ConnectWithWEP/ConnectWithWEP.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ void setup() {
4545
}
4646

4747
String fv = WiFi.firmwareVersion();
48-
if ( fv != "1.1.0" )
48+
if (fv != "1.1.0") {
4949
Serial.println("Please upgrade the firmware");
50+
}
5051

5152
// attempt to connect to Wifi network:
52-
while ( status != WL_CONNECTED) {
53+
while (status != WL_CONNECTED) {
5354
Serial.print("Attempting to connect to WEP network, SSID: ");
5455
Serial.println(ssid);
5556
status = WiFi.begin(ssid, keyIndex, key);

examples/ConnectWithWPA/ConnectWithWPA.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ void setup() {
3434
}
3535

3636
String fv = WiFi.firmwareVersion();
37-
if ( fv != "1.1.0" )
37+
if (fv != "1.1.0") {
3838
Serial.println("Please upgrade the firmware");
39+
}
3940

4041
// attempt to connect to Wifi network:
41-
while ( status != WL_CONNECTED) {
42+
while (status != WL_CONNECTED) {
4243
Serial.print("Attempting to connect to WPA SSID: ");
4344
Serial.println(ssid);
4445
// Connect to WPA/WPA2 network:

examples/ScanNetworks/ScanNetworks.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ void setup() {
3333
}
3434

3535
String fv = WiFi.firmwareVersion();
36-
if ( fv != "1.1.0" )
36+
if (fv != "1.1.0") {
3737
Serial.println("Please upgrade the firmware");
38+
}
3839

3940
// Print WiFi MAC address:
4041
printMacAddress();
@@ -75,8 +76,7 @@ void listNetworks() {
7576
// scan for nearby networks:
7677
Serial.println("** Scan Networks **");
7778
int numSsid = WiFi.scanNetworks();
78-
if (numSsid == -1)
79-
{
79+
if (numSsid == -1) {
8080
Serial.println("Couldn't get a wifi connection");
8181
while (true);
8282
}

examples/SimpleWebServerWiFi/SimpleWebServerWiFi.ino

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ void setup() {
4141
}
4242

4343
String fv = WiFi.firmwareVersion();
44-
if ( fv != "1.1.0" )
44+
if (fv != "1.1.0") {
4545
Serial.println("Please upgrade the firmware");
46+
}
4647

4748
// attempt to connect to Wifi network:
48-
while ( status != WL_CONNECTED) {
49+
while (status != WL_CONNECTED) {
4950
Serial.print("Attempting to connect to Network named: ");
5051
Serial.println(ssid); // print the network name (SSID);
5152

@@ -88,12 +89,10 @@ void loop() {
8889
client.println();
8990
// break out of the while loop:
9091
break;
91-
}
92-
else { // if you got a newline, then clear currentLine:
92+
} else { // if you got a newline, then clear currentLine:
9393
currentLine = "";
9494
}
95-
}
96-
else if (c != '\r') { // if you got anything else but a carriage return character,
95+
} else if (c != '\r') { // if you got anything else but a carriage return character,
9796
currentLine += c; // add it to the end of the currentLine
9897
}
9998

examples/WiFiChatServer/WiFiChatServer.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ void setup() {
4848
}
4949

5050
String fv = WiFi.firmwareVersion();
51-
if ( fv != "1.1.0" )
51+
if (fv != "1.1.0") {
5252
Serial.println("Please upgrade the firmware");
53+
}
5354

5455
// attempt to connect to Wifi network:
55-
while ( status != WL_CONNECTED) {
56+
while (status != WL_CONNECTED) {
5657
Serial.print("Attempting to connect to SSID: ");
5758
Serial.println(ssid);
5859
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:

examples/WiFiUdpNtpClient/WiFiUdpNtpClient.ino

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing pack
3636
// A UDP instance to let us send and receive packets over UDP
3737
WiFiUDP Udp;
3838

39-
void setup()
40-
{
39+
void setup() {
4140
// Open serial communications and wait for port to open:
4241
Serial.begin(9600);
4342
while (!Serial) {
@@ -52,11 +51,12 @@ void setup()
5251
}
5352

5453
String fv = WiFi.firmwareVersion();
55-
if ( fv != "1.1.0" )
54+
if (fv != "1.1.0") {
5655
Serial.println("Please upgrade the firmware");
56+
}
5757

5858
// attempt to connect to Wifi network:
59-
while ( status != WL_CONNECTED) {
59+
while (status != WL_CONNECTED) {
6060
Serial.print("Attempting to connect to SSID: ");
6161
Serial.println(ssid);
6262
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
@@ -73,13 +73,12 @@ void setup()
7373
Udp.begin(localPort);
7474
}
7575

76-
void loop()
77-
{
76+
void loop() {
7877
sendNTPpacket(timeServer); // send an NTP packet to a time server
7978
// wait to see if a reply is available
8079
delay(1000);
81-
Serial.println( Udp.parsePacket() );
82-
if ( Udp.parsePacket() ) {
80+
Serial.println(Udp.parsePacket());
81+
if (Udp.parsePacket()) {
8382
Serial.println("packet received");
8483
// We've received a packet, read the data from it
8584
Udp.read(packetBuffer, NTP_PACKET_SIZE); // read the packet into the buffer
@@ -92,7 +91,7 @@ void loop()
9291
// combine the four bytes (two words) into a long integer
9392
// this is NTP time (seconds since Jan 1 1900):
9493
unsigned long secsSince1900 = highWord << 16 | lowWord;
95-
Serial.print("Seconds since Jan 1 1900 = " );
94+
Serial.print("Seconds since Jan 1 1900 = ");
9695
Serial.println(secsSince1900);
9796

9897
// now convert NTP time into everyday time:
@@ -109,13 +108,13 @@ void loop()
109108
Serial.print("The UTC time is "); // UTC is the time at Greenwich Meridian (GMT)
110109
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
111110
Serial.print(':');
112-
if ( ((epoch % 3600) / 60) < 10 ) {
111+
if (((epoch % 3600) / 60) < 10) {
113112
// In the first 10 minutes of each hour, we'll want a leading '0'
114113
Serial.print('0');
115114
}
116115
Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
117116
Serial.print(':');
118-
if ( (epoch % 60) < 10 ) {
117+
if ((epoch % 60) < 10) {
119118
// In the first 10 seconds of each minute, we'll want a leading '0'
120119
Serial.print('0');
121120
}
@@ -126,8 +125,7 @@ void loop()
126125
}
127126

128127
// send an NTP request to the time server at the given address
129-
unsigned long sendNTPpacket(IPAddress& address)
130-
{
128+
unsigned long sendNTPpacket(IPAddress& address) {
131129
//Serial.println("1");
132130
// set all bytes in the buffer to 0
133131
memset(packetBuffer, 0, NTP_PACKET_SIZE);

examples/WiFiUdpSendReceiveString/WiFiUdpSendReceiveString.ino

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ void setup() {
4545
}
4646

4747
String fv = WiFi.firmwareVersion();
48-
if ( fv != "1.1.0" )
48+
if (fv != "1.1.0") {
4949
Serial.println("Please upgrade the firmware");
50+
}
5051

5152
// attempt to connect to Wifi network:
52-
while ( status != WL_CONNECTED) {
53+
while (status != WL_CONNECTED) {
5354
Serial.print("Attempting to connect to SSID: ");
5455
Serial.println(ssid);
5556
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
@@ -70,8 +71,7 @@ void loop() {
7071

7172
// if there's data available, read a packet
7273
int packetSize = Udp.parsePacket();
73-
if (packetSize)
74-
{
74+
if (packetSize) {
7575
Serial.print("Received packet of size ");
7676
Serial.println(packetSize);
7777
Serial.print("From ");
@@ -82,7 +82,9 @@ void loop() {
8282

8383
// read the packet into packetBufffer
8484
int len = Udp.read(packetBuffer, 255);
85-
if (len > 0) packetBuffer[len] = 0;
85+
if (len > 0) {
86+
packetBuffer[len] = 0;
87+
}
8688
Serial.println("Contents:");
8789
Serial.println(packetBuffer);
8890

examples/WiFiWebClient/WiFiWebClient.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ void setup() {
5454
}
5555

5656
String fv = WiFi.firmwareVersion();
57-
if ( fv != "1.1.0" )
57+
if (fv != "1.1.0") {
5858
Serial.println("Please upgrade the firmware");
59+
}
5960

6061
// attempt to connect to Wifi network:
6162
while (status != WL_CONNECTED) {

examples/WiFiWebClientRepeating/WiFiWebClientRepeating.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include <SPI.h>
2121
#include <WiFi.h>
22-
22+
2323
char ssid[] = "yourNetwork"; // your network SSID (name)
2424
char pass[] = "secretPassword"; // your network password
2525
int keyIndex = 0; // your network key Index number (needed only for WEP)
@@ -51,11 +51,12 @@ void setup() {
5151
}
5252

5353
String fv = WiFi.firmwareVersion();
54-
if ( fv != "1.1.0" )
54+
if (fv != "1.1.0") {
5555
Serial.println("Please upgrade the firmware");
56+
}
5657

5758
// attempt to connect to Wifi network:
58-
while ( status != WL_CONNECTED) {
59+
while (status != WL_CONNECTED) {
5960
Serial.print("Attempting to connect to SSID: ");
6061
Serial.println(ssid);
6162
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
@@ -103,8 +104,7 @@ void httpRequest() {
103104

104105
// note the time that the connection was made:
105106
lastConnectionTime = millis();
106-
}
107-
else {
107+
} else {
108108
// if you couldn't make a connection:
109109
Serial.println("connection failed");
110110
}

0 commit comments

Comments
 (0)