mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-07 14:04:17 -06:00
serialhdl: Calculate baudadjust from MCU's baud instead of host baud
Store the baud rate the MCU is configured for in the "identify" data and use that rate when calculating the baudadjust parameter. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
4988ba9a71
commit
777a0b817b
5 changed files with 22 additions and 15 deletions
|
@ -770,11 +770,10 @@ background_thread(void *data)
|
|||
|
||||
// Create a new 'struct serialqueue' object
|
||||
struct serialqueue *
|
||||
serialqueue_alloc(int serial_fd, double baud_adjust, int write_only)
|
||||
serialqueue_alloc(int serial_fd, int write_only)
|
||||
{
|
||||
struct serialqueue *sq = malloc(sizeof(*sq));
|
||||
memset(sq, 0, sizeof(*sq));
|
||||
sq->baud_adjust = baud_adjust;
|
||||
|
||||
// Reactor setup
|
||||
sq->serial_fd = serial_fd;
|
||||
|
@ -961,6 +960,14 @@ exit:
|
|||
pthread_mutex_unlock(&sq->lock);
|
||||
}
|
||||
|
||||
void
|
||||
serialqueue_set_baud_adjust(struct serialqueue *sq, double baud_adjust)
|
||||
{
|
||||
pthread_mutex_lock(&sq->lock);
|
||||
sq->baud_adjust = baud_adjust;
|
||||
pthread_mutex_unlock(&sq->lock);
|
||||
}
|
||||
|
||||
// Set the estimated clock rate of the mcu on the other end of the
|
||||
// serial port
|
||||
void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue