Merge pull request #640 from oseiler2/master

Fix: issue #639, if no LORA time source available and GPS time in fir…
This commit is contained in:
Verkehrsrot 2020-09-27 12:03:24 +02:00 committed by GitHub
commit c1095f0c82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View File

@ -39,8 +39,8 @@ void setABPParameters() {
// devices' ping slots. LMIC does not have an easy way to define set this // devices' ping slots. LMIC does not have an easy way to define set this
// frequency and support for class B is spotty and untested, so this // frequency and support for class B is spotty and untested, so this
// frequency is not configured here. // frequency is not configured here.
#elif defined(CFG_us915) #elif defined(CFG_us915) || defined(CFG_au915)
// NA-US channels 0-71 are configured automatically // NA-US and AU channels 0-71 are configured automatically
// but only one group of 8 should (a subband) should be active // but only one group of 8 should (a subband) should be active
// TTN recommends the second sub band, 1 in a zero based count. // TTN recommends the second sub band, 1 in a zero based count.
// https://github.com/TheThingsNetwork/gateway-conf/blob/master/US-global_conf.json // https://github.com/TheThingsNetwork/gateway-conf/blob/master/US-global_conf.json

View File

@ -35,8 +35,10 @@ void calibrateTime(void) {
timesync_request(); timesync_request();
#endif #endif
// (only!) if we lost time, we try to fallback to local time source RTS or GPS // if no LORA timesource is available, or if we lost time, then fallback to
if (timeSource == _unsynced) { // local time source RTS or GPS
if (((!TIME_SYNC_LORASERVER) && (!TIME_SYNC_LORAWAN)) ||
(timeSource == _unsynced)) {
// has RTC -> fallback to RTC time // has RTC -> fallback to RTC time
#ifdef HAS_RTC #ifdef HAS_RTC
@ -50,7 +52,6 @@ void calibrateTime(void) {
timeSource = _gps; timeSource = _gps;
#endif #endif
if (t)
setMyTime((uint32_t)t, t_msec, timeSource); // set time setMyTime((uint32_t)t, t_msec, timeSource); // set time
} // fallback } // fallback