Skip to content

Commit f35aad0

Browse files
authored
Merge pull request mysensors#19 from MartinHjelmare/fix-gps-sensor
Fix missing presentation function
2 parents d20bbd6 + fb7cda7 commit f35aad0

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

examples/GPSSensor/GPSSensor.ino

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@
2020
*
2121
* REVISION HISTORY
2222
* Version 1.0 - Henrik Ekblad
23-
*
23+
*
2424
* DESCRIPTION
25-
* Example sketch showing how to interface with a GPS sensor.
25+
* Example sketch showing how to interface with a GPS sensor.
2626
* A GPS is also an excellent atomic time source.
2727
* http://www.mysensors.org/build/gps
28-
*/
28+
*/
2929

3030
// Enable debug prints to serial monitor
31-
#define MY_DEBUG
31+
#define MY_DEBUG
3232

3333
// Enable and select radio type attached
3434
#define MY_RADIO_NRF24
3535
//#define MY_RADIO_RFM69
3636

3737
// GPS position send interval (in millisectonds)
38-
#define GPS_SEND_INTERVAL 10000
38+
#define GPS_SEND_INTERVAL 10000
3939

4040
// The child id used for the gps sensor
4141
#define CHILD_ID_GPS 1
@@ -47,7 +47,7 @@ static const int GPS_PIN = A0;
4747
static const uint32_t GPSBaud = 9600;
4848

4949
// Offset hours adjustment from gps time (UTC)
50-
const int offset = 1;
50+
const int offset = 1;
5151

5252
#include <SPI.h>
5353
#include <TimeLib.h>
@@ -61,15 +61,15 @@ TinyGPSPlus gps;
6161
MyMessage msg(CHILD_ID_GPS, V_POSITION);
6262

6363
// The serial connection to the GPS device
64-
// A5 pin can be left unconnected
65-
SoftwareSerial ss(GPS_PIN, A5);
64+
// A5 pin can be left unconnected
65+
SoftwareSerial ss(GPS_PIN, A5);
6666

6767
// Last time GPS position was sent to controller
6868
unsigned long lastGPSSent = 0;
6969

70-
// Some buffers
70+
// Some buffers
7171
char latBuf[11];
72-
char lngBuf[11];
72+
char lngBuf[11];
7373
char altBuf[6];
7474
char payload[30];
7575
char sz[64];
@@ -81,7 +81,7 @@ void setup() {
8181
}
8282

8383

84-
void present() {
84+
void presentation() {
8585
// Send the sketch version information to the gateway and Controller
8686
sendSketchInfo("GPS Sensor", "1.0");
8787

@@ -96,10 +96,10 @@ void loop()
9696
// Evaluate if it is time to send a new position
9797
bool timeToSend = currentTime - lastGPSSent > GPS_SEND_INTERVAL;
9898

99-
// Read gps data
100-
while (ss.available())
99+
// Read gps data
100+
while (ss.available())
101101
gps.encode(ss.read());
102-
102+
103103
if (timeToSend) {
104104
// Sync gps time with Arduino
105105
updateTime();
@@ -121,7 +121,7 @@ void loop()
121121
sprintf(sz, "%02d/%02d/%02d %02d:%02d:%02d", month(), day(), year(), hour(), minute(), second());
122122
Serial.println(sz);
123123

124-
124+
125125
} else {
126126
if (millis() > 5000 && gps.charsProcessed() < 10)
127127
Serial.println(F("No GPS data received: check wiring"));
@@ -141,8 +141,6 @@ void updateTime()
141141
setTime(t.hour(), t.minute(), t.second(), d.day(), d.month(), d.year());
142142
adjustTime(offset * SECS_PER_HOUR);
143143
return;
144-
}
144+
}
145145
Serial.println(F("Unable to adjust time from GPS"));
146146
}
147-
148-

0 commit comments

Comments
 (0)