@@ -42,14 +42,14 @@ class MicroNMEALocationProvider : public LocationProvider {
4242 int8_t _claims = 0 ;
4343 int _pin_reset;
4444 int _pin_en;
45- long next_check = 0 ;
45+ unsigned long next_check = 0 ;
4646 long time_valid = 0 ;
4747 unsigned long _last_time_sync = 0 ;
4848 static const unsigned long TIME_SYNC_INTERVAL = 1800000 ; // Re-sync every 30 minutes
4949
5050public :
5151 MicroNMEALocationProvider (Stream& ser, mesh::RTCClock* clock = NULL , int pin_reset = GPS_RESET , int pin_en = GPS_EN ,RefCountedDigitalPin* peripher_power=NULL ) :
52- _gps_serial (&ser), nmea(_nmeaBuffer, sizeof (_nmeaBuffer)), _pin_reset(pin_reset ), _pin_en(pin_en ), _clock(clock ), _peripher_power(peripher_power ) {
52+ nmea (_nmeaBuffer, sizeof (_nmeaBuffer)), _clock(clock ), _gps_serial(&ser ), _peripher_power(peripher_power ), _pin_reset(pin_reset), _pin_en(pin_en ) {
5353 if (_pin_reset != -1 ) {
5454 pinMode (_pin_reset, OUTPUT );
5555 digitalWrite (_pin_reset, GPS_RESET_FORCE );
@@ -62,9 +62,7 @@ public :
6262
6363 void claim () {
6464 _claims++;
65- if (_claims > 0 ) {
66- if (_peripher_power) _peripher_power->claim ();
67- }
65+ if (_peripher_power) _peripher_power->claim ();
6866 }
6967
7068 void release () {
@@ -143,7 +141,7 @@ public :
143141
144142 if (!isValid ()) time_valid = 0 ;
145143
146- if (millis () > next_check) {
144+ if (( long )( millis () - next_check) > 0 ) {
147145 next_check = millis () + 1000 ;
148146 // Re-enable time sync periodically when GPS has valid fix
149147 if (!_time_sync_needed && _clock != NULL && (millis () - _last_time_sync) > TIME_SYNC_INTERVAL ) {
0 commit comments