From 47f95a10b8ec3670bac850a82f90d9a700601698 Mon Sep 17 00:00:00 2001 From: PaulZC Date: Thu, 1 Apr 2021 12:45:34 +0100 Subject: [PATCH] .end now returns void. Update getUnixEpoch so it runs correctly on the ATmega328P --- src/SparkFun_u-blox_GNSS_Arduino_Library.cpp | 26 ++++++++++---------- src/SparkFun_u-blox_GNSS_Arduino_Library.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp index 915a1b1..3fde61c 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.cpp @@ -53,7 +53,7 @@ SFE_UBLOX_GNSS::SFE_UBLOX_GNSS(void) } //Stop all automatic message processing. Free all used RAM -boolean SFE_UBLOX_GNSS::end(void) +void SFE_UBLOX_GNSS::end(void) { //Note: payloadCfg is not deleted @@ -9283,12 +9283,12 @@ uint32_t SFE_UBLOX_GNSS::getUnixEpoch(uint16_t maxWait) packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.sec = false; packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false; // assemble time elements into time_t - credits to Thomas Roell @ https://github.com/GrumpyOldPizza - uint32_t t = (uint32_t)(((((((packetUBXNAVPVT->data.year - 1970) * 365) + (((packetUBXNAVPVT->data.year - 1970) + 3) / 4)) + - DAYS_SINCE_MONTH[(packetUBXNAVPVT->data.year - 1970) & 3][packetUBXNAVPVT->data.month] + - (packetUBXNAVPVT->data.day - 1)) * 24 + - packetUBXNAVPVT->data.hour) * 60 + - packetUBXNAVPVT->data.min) * 60 + - packetUBXNAVPVT->data.sec); + uint32_t t = ((((((((uint32_t)packetUBXNAVPVT->data.year - 1970) * 365) + ((((uint32_t)packetUBXNAVPVT->data.year - 1970) + 3) / 4)) + + DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] + + ((uint32_t)packetUBXNAVPVT->data.day - 1)) * 24 + + (uint32_t)packetUBXNAVPVT->data.hour) * 60 + + (uint32_t)packetUBXNAVPVT->data.min) * 60 + + (uint32_t)packetUBXNAVPVT->data.sec); return t; } @@ -9310,12 +9310,12 @@ uint32_t SFE_UBLOX_GNSS::getUnixEpoch(uint32_t& microsecond, uint16_t maxWait) packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.nano = false; packetUBXNAVPVT->moduleQueried.moduleQueried1.bits.all = false; // assemble time elements into time_t - credits to Thomas Roell @ https://github.com/GrumpyOldPizza - uint32_t t = (uint32_t)(((((((packetUBXNAVPVT->data.year - 1970) * 365) + (((packetUBXNAVPVT->data.year - 1970) + 3) / 4)) + - DAYS_SINCE_MONTH[(packetUBXNAVPVT->data.year - 1970) & 3][packetUBXNAVPVT->data.month] + - (packetUBXNAVPVT->data.day - 1)) * 24 + - packetUBXNAVPVT->data.hour) * 60 + - packetUBXNAVPVT->data.min) * 60 + - packetUBXNAVPVT->data.sec); + uint32_t t = ((((((((uint32_t)packetUBXNAVPVT->data.year - 1970) * 365) + ((((uint32_t)packetUBXNAVPVT->data.year - 1970) + 3) / 4)) + + DAYS_SINCE_MONTH[((uint32_t)packetUBXNAVPVT->data.year - 1970) & 3][(uint32_t)packetUBXNAVPVT->data.month] + + ((uint32_t)packetUBXNAVPVT->data.day - 1)) * 24 + + (uint32_t)packetUBXNAVPVT->data.hour) * 60 + + (uint32_t)packetUBXNAVPVT->data.min) * 60 + + (uint32_t)packetUBXNAVPVT->data.sec); int32_t us = packetUBXNAVPVT->data.nano / 1000; microsecond = (uint32_t)us; // adjust t if nano is negative diff --git a/src/SparkFun_u-blox_GNSS_Arduino_Library.h b/src/SparkFun_u-blox_GNSS_Arduino_Library.h index 219db4e..515a87d 100644 --- a/src/SparkFun_u-blox_GNSS_Arduino_Library.h +++ b/src/SparkFun_u-blox_GNSS_Arduino_Library.h @@ -482,7 +482,7 @@ public: //serialPort needs to be perviously initialized to correct baud rate boolean begin(Stream &serialPort); //Returns true if module is detected - boolean end(void); //Stop all automatic message processing. Free all used RAM + void end(void); //Stop all automatic message processing. Free all used RAM void setI2CpollingWait(uint8_t newPollingWait_ms); // Allow the user to change the I2C polling wait if required