Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae7dae9

Browse files
committedFeb 24, 2019
- applied per1234's suggestions on #31
1 parent bff994e commit ae7dae9

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed
 

‎examples/ArduinoIoTCloud_LED_switch/ArduinoIoTCloud_LED_switch.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
88
IMPORTANT:
99
This sketch will work with both WiFi and GSM enabled boards supported by Arduino IoT Cloud.
10-
By default settings for WiFi are chosen. If you prefer to use a GSM board take a look at thingProperties.h arduino_secrets.h,
10+
By default, settings for WiFi are chosen. If you prefer to use a GSM board take a look at thingProperties.h arduino_secrets.h,
1111
to make sure you uncomment what's needed and comment incompatible instructions.
1212
1313
*/

‎examples/ArduinoIoTCloud_LED_switch/thingProperties.h

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include <ArduinoIoTCloud.h>
2-
/*
3-
The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
2+
/*
3+
The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
44
*/
55
#include <WiFiConnectionManager.h>
6-
/*
7-
If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
6+
/*
7+
If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
88
*/
99
//#include <GSMConnectionManager.h>
1010

@@ -22,11 +22,11 @@ void initProperties() {
2222
ArduinoCloud.addProperty(potentiometer, READ, ON_CHANGE);
2323
}
2424

25-
/*
26-
The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
25+
/*
26+
The following include line is used for WiFi enabled boards (MKR1000, MKR WiFi 1010)
2727
*/
2828
ConnectionManager *ArduinoIoTPreferredConnection = new WiFiConnectionManager(SECRET_SSID, SECRET_PASS);
29-
/*
30-
If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
29+
/*
30+
If you prefer using a MKR GSM 1400 comment the line above and uncommet the following.
3131
*/
32-
//ConnectionManager *ArduinoIoTPreferredConnection = new GSMConnectionManager(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);
32+
//ConnectionManager *ArduinoIoTPreferredConnection = new GSMConnectionManager(SECRET_PIN, SECRET_APN, SECRET_LOGIN, SECRET_PASS);

‎src/GSMConnectionManager.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void GSMConnectionManager::check() {
130130
init();
131131
break;
132132
case CONNECTION_STATE_CONNECTING:
133-
/*** Blocking Call when 4th parameter == true ***/
133+
// NOTE: Blocking Call when 4th parameter == true
134134
GSM3_NetworkStatus_t networkStatus;
135135
networkStatus = gprs.attachGPRS(apn, login, pass, true);
136136
sprintf(msgBuffer, "GPRS.attachGPRS(): %d", networkStatus);
@@ -174,7 +174,6 @@ void GSMConnectionManager::check() {
174174
}
175175
break;
176176
case CONNECTION_STATE_CONNECTED:
177-
/*** keep testing network connection ***/
178177
gsmAccessAlive = gsmAccess.isAccessAlive();
179178
sprintf(msgBuffer, "GPRS.isAccessAlive(): %d", gsmAccessAlive);
180179
debugMessage(msgBuffer, 4);

‎src/WiFiConnectionManager.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void WiFiConnectionManager::check() {
139139
debugMessage(msgBuffer, 4);
140140
if (networkStatus != NETWORK_CONNECTED) {
141141
sprintf(msgBuffer, "Connection to \"%s\" failed", ssid);
142-
debugMessage(msgBuffer, 0);
142+
debugMessage(msgBuffer, 0);
143143
sprintf(msgBuffer, "Retrying in \"%d\" milliseconds", connectionTickTimeInterval);
144144
debugMessage(msgBuffer, 2);
145145
//changeConnectionState(CONNECTION_STATE_CONNECTING);

‎src/utility/NTPUtils.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include "Arduino.h"
33
/*
44
This Utility Class is derived from the example code found here https://www.arduino.cc/en/Tutorial/UdpNTPClient
5-
For more information on NPT (Network Time Protocol) you can refer to this WikiPedia article https://en.wikipedia.org/wiki/Network_Time_Protocol
5+
For more information on NTP (Network Time Protocol) you can refer to this Wikipedia article https://en.wikipedia.org/wiki/Network_Time_Protocol
66
*/
77

88

@@ -56,9 +56,7 @@ unsigned long NTPUtils::getTime() {
5656
Udp.begin(localPort);
5757
sendNTPpacket(packetBuffer);
5858
long start = millis();
59-
while (!Udp.parsePacket() && (millis() - start < 10000)) {
60-
61-
}
59+
while (!Udp.parsePacket() && (millis() - start < 10000)){}
6260
if (millis() - start >= 1000) {
6361
//timeout reached
6462
return 0;
@@ -72,6 +70,5 @@ unsigned long NTPUtils::getTime() {
7270
unsigned long epoch = secsSince1900 - seventyYears;
7371

7472
Udp.stop();
75-
7673
return epoch;
77-
}
74+
}

‎src/utility/NTPUtils.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __NTP_UTILS__
33
/*
44
This Utility Class is derived from the example code found here https://www.arduino.cc/en/Tutorial/UdpNTPClient
5-
For more information on NPT (Network Time Protocol) you can refer to this WikiPedia article https://en.wikipedia.org/wiki/Network_Time_Protocol
5+
For more information on NTP (Network Time Protocol) you can refer to this Wikipedia article https://en.wikipedia.org/wiki/Network_Time_Protocol
66
*/
77

88
#include "Udp.h"
@@ -20,4 +20,4 @@ class NTPUtils {
2020
UDP& Udp;
2121
};
2222

23-
#endif
23+
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.