diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-03-24 19:16:33 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-03-24 19:16:33 -0400 |
commit | 6de85d02ae796c02d63016b3e45da0df396f2adc (patch) | |
tree | 605679f8e9967091545a9218cb9bd3eae0a06ce0 /klippy | |
parent | f28eb902df59472c50af95bde64296b9ba861735 (diff) | |
download | kutter-6de85d02ae796c02d63016b3e45da0df396f2adc.tar.gz kutter-6de85d02ae796c02d63016b3e45da0df396f2adc.tar.xz kutter-6de85d02ae796c02d63016b3e45da0df396f2adc.zip |
serialqueue: Message receive_time must be taken after read()
The est_clock calculation code requires timestamps on status messages
to never be prior to the reception of the message. The eventtime of
handle_message() is taken before the read() and there is a small
possibility that it could be inaccurate enough to corrupt the
est_clock calculation. Take a new timestamp when storing receive_time
to prevent this. This fix prevents some firmware "Move queue empty"
shutdowns.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/serialqueue.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c index 4c18c971..cb24d523 100644 --- a/klippy/serialqueue.c +++ b/klippy/serialqueue.c @@ -496,7 +496,7 @@ handle_message(struct serialqueue *sq, double eventtime, int len) // Add message to receive queue struct queue_message *qm = message_fill(sq->input_buf, len); qm->sent_time = sq->last_receive_sent_time; - qm->receive_time = eventtime; + qm->receive_time = get_monotonic(); // must be time post read() list_add_tail(&qm->node, &sq->receive_queue); check_wake_receive(sq); } |