diff --git a/src/display.cpp b/src/display.cpp index 8e143742..cf3207c7 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -141,7 +141,7 @@ void refreshtheDisplay() { char buff[16]; // 16 chars line buffer const char timeNosyncSymbol = '?'; #ifdef HAS_IF482 - const char timesyncSymbol = '°'; + const char timesyncSymbol = '+'; #else const char timesyncSymbol = '*'; #endif diff --git a/src/gpsread.cpp b/src/gpsread.cpp index 07bfd9ee..2aff4947 100644 --- a/src/gpsread.cpp +++ b/src/gpsread.cpp @@ -73,10 +73,6 @@ time_t get_gpstime(void) { if (gps.time.age() < 1500) { t = tmConvert_t(gps.date.year(), gps.date.month(), gps.date.day(), gps.time.hour(), gps.time.minute(), gps.time.second()); -#ifdef HAS_RTC - if (!set_rtctime(t)) - ESP_LOGE(TAG, "RTC set time failure"); -#endif } else { ESP_LOGW(TAG, "GPS has no confident time"); } diff --git a/src/lorawan.cpp b/src/lorawan.cpp index d8350b5b..654b1469 100644 --- a/src/lorawan.cpp +++ b/src/lorawan.cpp @@ -457,7 +457,7 @@ void user_request_network_time_callback(void *pVoidUserUTCTime, setTime(*pUserUTCTime); ESP_LOGI(TAG, "LoRaWAN network has set the system time"); #ifdef HAS_RTC - if (!set_rtctime(*pUserUTCTime)) + if (set_rtctime(*pUserUTCTime)) ESP_LOGE(TAG, "RTC set time failure"); #endif } \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 6d7a324b..5703501f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -197,7 +197,7 @@ void setup() { ESP_LOGI(TAG, "Unable to sync system time with RTC"); else ESP_LOGI(TAG, "RTC has set the system time"); - setSyncInterval(TIME_SYNC_INTERVAL_RTC); + setSyncInterval(TIME_SYNC_INTERVAL_RTC * 60); #endif // HAS_RTC #ifdef HAS_IF482 @@ -426,9 +426,14 @@ void setup() { setSyncProvider(&get_gpstime); if (timeStatus() != timeSet) ESP_LOGI(TAG, "Unable to sync system time with GPS"); - else + else { ESP_LOGI(TAG, "GPS has set the system time"); - setSyncInterval(TIME_SYNC_INTERVAL_GPS); +#ifdef HAS_RTC + if (set_rtctime(now())) + ESP_LOGE(TAG, "RTC set time failure"); +#endif + } + setSyncInterval(TIME_SYNC_INTERVAL_GPS * 60); #endif // start RTC interrupt diff --git a/src/paxcounter.conf b/src/paxcounter.conf index 11151144..a97f8b9e 100644 --- a/src/paxcounter.conf +++ b/src/paxcounter.conf @@ -82,9 +82,9 @@ #define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds] // settings for syncing time of node and external time sources -#define TIME_SYNC_INTERVAL_GPS 5 // sync time each ... minutes with GPS [default = 5], comment out means off -#define TIME_SYNC_INTERVAL_RTC 5 // sync time each ... minutes with RTC [default = 5], comment out means off -//#define TIME_SYNC_INTERVAL_LORA 60 // sync time each ... minutes with LORA network [default = 60], comment out means off +#define TIME_SYNC_INTERVAL_GPS 60 // sync time each ... minutes with GPS [default = 60], comment out means off +#define TIME_SYNC_INTERVAL_RTC 60 // sync time each ... minutes with RTC [default = 60], comment out means off +//#define TIME_SYNC_INTERVAL_LORA 60 // sync time each ... minutes with LORA network [default = 60], comment out means off #define IF482_OFFSET 984 // 1sec minus IF482 serial transmit time [ms]: e.g. 9 bits * 17 bytes * 1/9600 bps = 16ms // time zone, see https://github.com/JChristensen/Timezone/blob/master/examples/WorldClock/WorldClock.ino