mirror of https://github.com/Desuuuu/klipper.git
serialqueue: Further retransmit timing fixes
The first message always has a sync byte with it, so its size should be one larger. Also, the idle_time should always be the minimum time that the message could be received, so it should always be reset to eventtime on a retransmit. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d469db84ee
commit
a619aacfc6
|
@ -573,7 +573,7 @@ retransmit_event(struct serialqueue *sq, double eventtime)
|
|||
memcpy(&buf[buflen], qm->msg, qm->len);
|
||||
buflen += qm->len;
|
||||
if (!first_buflen)
|
||||
first_buflen = qm->len;
|
||||
first_buflen = qm->len + 1;
|
||||
}
|
||||
ret = write(sq->serial_fd, buf, buflen);
|
||||
if (ret < 0)
|
||||
|
@ -596,10 +596,8 @@ retransmit_event(struct serialqueue *sq, double eventtime)
|
|||
}
|
||||
sq->retransmit_seq = sq->send_seq - 1;
|
||||
sq->rtt_sample_seq = 0;
|
||||
if (eventtime > sq->idle_time)
|
||||
sq->idle_time = eventtime;
|
||||
double waketime = sq->idle_time + first_buflen * sq->baud_adjust + sq->rto;
|
||||
sq->idle_time += buflen * sq->baud_adjust;
|
||||
sq->idle_time = eventtime + buflen * sq->baud_adjust;
|
||||
double waketime = eventtime + first_buflen * sq->baud_adjust + sq->rto;
|
||||
|
||||
pthread_mutex_unlock(&sq->lock);
|
||||
return waketime;
|
||||
|
|
Loading…
Reference in New Issue