commit
40e88d79ae
@ -45,7 +45,7 @@ description = Paxcounter is a device for metering passenger flows in realtime. I
|
|||||||
|
|
||||||
[common]
|
[common]
|
||||||
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
; for release_version use max. 10 chars total, use any decimal format like "a.b.c"
|
||||||
release_version = 1.9.91
|
release_version = 1.9.92
|
||||||
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
; DEBUG LEVEL: For production run set to 0, otherwise device will leak RAM while running!
|
||||||
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
|
||||||
debug_level = 3
|
debug_level = 3
|
||||||
|
@ -120,8 +120,8 @@ void process_timesync_req(void *taskparameter) {
|
|||||||
// calculate time offset with millisecond precision using LMIC's time base,
|
// calculate time offset with millisecond precision using LMIC's time base,
|
||||||
// since we use LMIC's ostime_t txEnd as tx timestamp.
|
// since we use LMIC's ostime_t txEnd as tx timestamp.
|
||||||
// Also apply calibration const to compensate processing time.
|
// Also apply calibration const to compensate processing time.
|
||||||
time_offset_ms +=
|
time_offset_ms += milliseconds(osticks2ms(os_getTime())) -
|
||||||
milliseconds(osticks2ms(os_getTime())) + milliseconds(TIME_SYNC_FIXUP);
|
milliseconds(millis()) + milliseconds(TIME_SYNC_FIXUP);
|
||||||
|
|
||||||
// calculate absolute time in UTC epoch: convert to whole seconds, round to
|
// calculate absolute time in UTC epoch: convert to whole seconds, round to
|
||||||
// ceil, and calculate fraction milliseconds
|
// ceil, and calculate fraction milliseconds
|
||||||
@ -208,10 +208,9 @@ int recv_timesync_ans(const uint8_t buf[], const uint8_t buf_len) {
|
|||||||
uint16_t timestamp_msec = 4 * buf[0];
|
uint16_t timestamp_msec = 4 * buf[0];
|
||||||
|
|
||||||
// construct the timepoint when message was seen on gateway
|
// construct the timepoint when message was seen on gateway
|
||||||
time_sync_rx[k] +=
|
time_sync_rx[k] += seconds(timestamp_sec) + milliseconds(timestamp_msec);
|
||||||
seconds(timestamp_sec) + milliseconds(timestamp_msec);
|
|
||||||
|
|
||||||
// we guess timepoint is recent if it newer than code compile date
|
// we guess timepoint is recent if it is newer than code compile date
|
||||||
if (timeIsValid(myClock::to_time_t(time_sync_rx[k]))) {
|
if (timeIsValid(myClock::to_time_t(time_sync_rx[k]))) {
|
||||||
ESP_LOGD(TAG, "[%0.3f] Timesync request #%d of %d rcvd at %d.%03d",
|
ESP_LOGD(TAG, "[%0.3f] Timesync request #%d of %d rcvd at %d.%03d",
|
||||||
millis() / 1000.0, k + 1, TIME_SYNC_SAMPLES, timestamp_sec,
|
millis() / 1000.0, k + 1, TIME_SYNC_SAMPLES, timestamp_sec,
|
||||||
|
Loading…
Reference in New Issue
Block a user