mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-12-16 05:09:56 +01:00
serialqueue: Make 31-bit clock overflow check a little more robust
Allow reqclock to be slightly less than the transmitted messages's deadline. That is, delay messages with a reqclock far in the future to slightly past (1<<31) ticks from its deadline. Use (3<<29) instead, which gives an additional (1<<29) grace period to avoid clock overflows. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -886,9 +886,10 @@ serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
|
||||
int len = 0;
|
||||
struct queue_message *qm;
|
||||
list_for_each_entry(qm, msgs, node) {
|
||||
if (qm->min_clock + (1LL<<31) < qm->req_clock
|
||||
if (qm->min_clock + (3LL<<29) < qm->req_clock
|
||||
&& qm->req_clock != BACKGROUND_PRIORITY_CLOCK)
|
||||
qm->min_clock = qm->req_clock - (1LL<<31);
|
||||
// Avoid mcu clock comparison 31-bit overflow issues
|
||||
qm->min_clock = qm->req_clock - (3LL<<29);
|
||||
len += qm->len;
|
||||
}
|
||||
if (! len)
|
||||
|
||||
Reference in New Issue
Block a user