Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/helpers/sensors/RakLocationProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class RakLocationProvider : public LocationProvider {
RakI2cGpsDriver& _driver; // RAK12500 (I2C)
NmeaGpsDriver _nmeaDriver; // serial NMEA module
MicroNMEALocationProvider _nmea;
mesh::RTCClock* _clock;
bool _detected = false;
bool _useI2c = false;
uint32_t _gpsPeriodSeconds = 0;
Expand All @@ -31,7 +32,7 @@ class RakLocationProvider : public LocationProvider {
// serialPower, if given, switches the serial module's supply (WB_IO2 on WisBlock bases).
RakLocationProvider(RakI2cGpsDriver& driver, mesh::RTCClock* clock = nullptr,
UART_TYPE& serial = Serial1, RefCountedDigitalPin* serialPower = nullptr)
: _driver(driver), _nmeaDriver(serial, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN, serialPower),
: _driver(driver), _clock(clock), _nmeaDriver(serial, PIN_GPS_TX, PIN_GPS_RX, GPS_RESET, GPS_EN, serialPower),
_nmea(_nmeaDriver, clock) {}

void syncTime() override {
Expand Down Expand Up @@ -177,6 +178,10 @@ class RakLocationProvider : public LocationProvider {
fixStatsFix((uint32_t)(millis() - _acquisitionStarted));
}
saveRak12500Fix();
if (_time_sync_needed && _clock != nullptr && _lastFix.timestamp > 0) {
_clock->setCurrentTime(_lastFix.timestamp);
_time_sync_needed = false;
}
}

if (_gpsPeriodSeconds > 0 && _acquiringPeriodically && hasCurrentFix) {
Expand Down
Loading