aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-09-26 21:47:13 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-09-26 22:27:25 -0400
commit3982b5030e253f68c36a4851ffba5981a471e1bb (patch)
tree0f57181976886f4ba3e8a5874fcc3858e5f6885d
parentd9fe4b6944a31d490f12760b26001ba212fd76b5 (diff)
downloadkutter-3982b5030e253f68c36a4851ffba5981a471e1bb.tar.gz
kutter-3982b5030e253f68c36a4851ffba5981a471e1bb.tar.xz
kutter-3982b5030e253f68c36a4851ffba5981a471e1bb.zip
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 <kevin@koconnor.net>
-rw-r--r--klippy/serialqueue.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c
index 7247022a..ceb90672 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);
}