Skip to content

Commit 47f95a1

Browse files
committed
.end now returns void. Update getUnixEpoch so it runs correctly on the ATmega328P
1 parent e483b11 commit 47f95a1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/SparkFun_u-blox_GNSS_Arduino_Library.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SFE_UBLOX_GNSS::SFE_UBLOX_GNSS(void)
5353
}
5454

5555
//Stop all automatic message processing. Free all used RAM
56-
boolean SFE_UBLOX_GNSS::end(void)
56+
void SFE_UBLOX_GNSS::end(void)
5757
{
5858
//Note: payloadCfg is not deleted
5959

@@ -9283,12 +9283,12 @@ uint32_t SFE_UBLOX_GNSS::getUnixEpoch(uint16_t maxWait)
92839283
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.sec = false;
92849284
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false;
92859285
// assemble time elements into time_t - credits to Thomas Roell @ https://github.com/GrumpyOldPizza
9286-
uint32_t t = (uint32_t)(((((((packetUBXNAVPVT->data.year - 1970) * 365) + (((packetUBXNAVPVT->data.year - 1970) + 3) / 4)) +
9287-
DAYS_SINCE_MONTH[(packetUBXNAVPVT->data.year - 1970) & 3][packetUBXNAVPVT->data.month] +
9288-
(packetUBXNAVPVT->data.day - 1)) * 24 +
9289-
packetUBXNAVPVT->data.hour) * 60 +
9290-
packetUBXNAVPVT->data.min) * 60 +
9291-
packetUBXNAVPVT->data.sec);
9286+
uint32_t t = ((((((((uint32_t)packetUBXNAVPVT->data.year - 1970) * 365) + ((((uint32_t)packetUBXNAVPVT->data.year - 1970) + 3) / 4)) +
9287+
DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] +
9288+
((uint32_t)packetUBXNAVPVT->data.day - 1)) * 24 +
9289+
(uint32_t)packetUBXNAVPVT->data.hour) * 60 +
9290+
(uint32_t)packetUBXNAVPVT->data.min) * 60 +
9291+
(uint32_t)packetUBXNAVPVT->data.sec);
92929292
return t;
92939293
}
92949294

@@ -9310,12 +9310,12 @@ uint32_t SFE_UBLOX_GNSS::getUnixEpoch(uint32_t& microsecond, uint16_t maxWait)
93109310
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.nano = false;
93119311
packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false;
93129312
// assemble time elements into time_t - credits to Thomas Roell @ https://github.com/GrumpyOldPizza
9313-
uint32_t t = (uint32_t)(((((((packetUBXNAVPVT->data.year - 1970) * 365) + (((packetUBXNAVPVT->data.year - 1970) + 3) / 4)) +
9314-
DAYS_SINCE_MONTH[(packetUBXNAVPVT->data.year - 1970) & 3][packetUBXNAVPVT->data.month] +
9315-
(packetUBXNAVPVT->data.day - 1)) * 24 +
9316-
packetUBXNAVPVT->data.hour) * 60 +
9317-
packetUBXNAVPVT->data.min) * 60 +
9318-
packetUBXNAVPVT->data.sec);
9313+
uint32_t t = ((((((((uint32_t)packetUBXNAVPVT->data.year - 1970) * 365) + ((((uint32_t)packetUBXNAVPVT->data.year - 1970) + 3) / 4)) +
9314+
DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] +
9315+
((uint32_t)packetUBXNAVPVT->data.day - 1)) * 24 +
9316+
(uint32_t)packetUBXNAVPVT->data.hour) * 60 +
9317+
(uint32_t)packetUBXNAVPVT->data.min) * 60 +
9318+
(uint32_t)packetUBXNAVPVT->data.sec);
93199319
int32_t us = packetUBXNAVPVT->data.nano / 1000;
93209320
microsecond = (uint32_t)us;
93219321
// adjust t if nano is negative

src/SparkFun_u-blox_GNSS_Arduino_Library.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ class SFE_UBLOX_GNSS
482482
//serialPort needs to be perviously initialized to correct baud rate
483483
boolean begin(Stream &serialPort); //Returns true if module is detected
484484

485-
boolean end(void); //Stop all automatic message processing. Free all used RAM
485+
void end(void); //Stop all automatic message processing. Free all used RAM
486486

487487
void setI2CpollingWait(uint8_t newPollingWait_ms); // Allow the user to change the I2C polling wait if required
488488

0 commit comments

Comments
 (0)