bugfixes in realtime handling
This commit is contained in:
parent
98d6e12836
commit
110e969ba8
@ -141,7 +141,7 @@ void refreshtheDisplay() {
|
|||||||
char buff[16]; // 16 chars line buffer
|
char buff[16]; // 16 chars line buffer
|
||||||
const char timeNosyncSymbol = '?';
|
const char timeNosyncSymbol = '?';
|
||||||
#ifdef HAS_IF482
|
#ifdef HAS_IF482
|
||||||
const char timesyncSymbol = '°';
|
const char timesyncSymbol = '+';
|
||||||
#else
|
#else
|
||||||
const char timesyncSymbol = '*';
|
const char timesyncSymbol = '*';
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,10 +73,6 @@ time_t get_gpstime(void) {
|
|||||||
if (gps.time.age() < 1500) {
|
if (gps.time.age() < 1500) {
|
||||||
t = tmConvert_t(gps.date.year(), gps.date.month(), gps.date.day(),
|
t = tmConvert_t(gps.date.year(), gps.date.month(), gps.date.day(),
|
||||||
gps.time.hour(), gps.time.minute(), gps.time.second());
|
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 {
|
} else {
|
||||||
ESP_LOGW(TAG, "GPS has no confident time");
|
ESP_LOGW(TAG, "GPS has no confident time");
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ void user_request_network_time_callback(void *pVoidUserUTCTime,
|
|||||||
setTime(*pUserUTCTime);
|
setTime(*pUserUTCTime);
|
||||||
ESP_LOGI(TAG, "LoRaWAN network has set the system time");
|
ESP_LOGI(TAG, "LoRaWAN network has set the system time");
|
||||||
#ifdef HAS_RTC
|
#ifdef HAS_RTC
|
||||||
if (!set_rtctime(*pUserUTCTime))
|
if (set_rtctime(*pUserUTCTime))
|
||||||
ESP_LOGE(TAG, "RTC set time failure");
|
ESP_LOGE(TAG, "RTC set time failure");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
11
src/main.cpp
11
src/main.cpp
@ -197,7 +197,7 @@ void setup() {
|
|||||||
ESP_LOGI(TAG, "Unable to sync system time with RTC");
|
ESP_LOGI(TAG, "Unable to sync system time with RTC");
|
||||||
else
|
else
|
||||||
ESP_LOGI(TAG, "RTC has set the system time");
|
ESP_LOGI(TAG, "RTC has set the system time");
|
||||||
setSyncInterval(TIME_SYNC_INTERVAL_RTC);
|
setSyncInterval(TIME_SYNC_INTERVAL_RTC * 60);
|
||||||
#endif // HAS_RTC
|
#endif // HAS_RTC
|
||||||
|
|
||||||
#ifdef HAS_IF482
|
#ifdef HAS_IF482
|
||||||
@ -426,9 +426,14 @@ void setup() {
|
|||||||
setSyncProvider(&get_gpstime);
|
setSyncProvider(&get_gpstime);
|
||||||
if (timeStatus() != timeSet)
|
if (timeStatus() != timeSet)
|
||||||
ESP_LOGI(TAG, "Unable to sync system time with GPS");
|
ESP_LOGI(TAG, "Unable to sync system time with GPS");
|
||||||
else
|
else {
|
||||||
ESP_LOGI(TAG, "GPS has set the system time");
|
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
|
#endif
|
||||||
|
|
||||||
// start RTC interrupt
|
// start RTC interrupt
|
||||||
|
@ -82,8 +82,8 @@
|
|||||||
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
#define RESPONSE_TIMEOUT_MS 60000 // firmware binary server connection timeout [milliseconds]
|
||||||
|
|
||||||
// settings for syncing time of node and external time sources
|
// 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_GPS 60 // sync time each ... minutes with GPS [default = 60], 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_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 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
|
#define IF482_OFFSET 984 // 1sec minus IF482 serial transmit time [ms]: e.g. 9 bits * 17 bytes * 1/9600 bps = 16ms
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user