From 3982b5030e253f68c36a4851ffba5981a471e1bb Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 26 Sep 2017 21:47:13 -0400 Subject: [PATCH] serialqueue: Take baud_adjust into account when calculating receive_time Use baud_adjust when determining the receive_time of a message read from the serial port. This improves the accuracy of the clock synchronization code. Signed-off-by: Kevin O'Connor --- klippy/serialqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c index 7247022a3..ceb90672b 100644 --- a/klippy/serialqueue.c +++ b/klippy/serialqueue.c @@ -519,6 +519,7 @@ handle_message(struct serialqueue *sq, double eventtime, int len) struct queue_message *qm = message_fill(sq->input_buf, len); qm->sent_time = sq->last_receive_sent_time; qm->receive_time = get_monotonic(); // must be time post read() + qm->receive_time -= sq->baud_adjust * len; list_add_tail(&qm->node, &sq->receive_queue); check_wake_receive(sq); }