mirror of
git://soft.sys114.com/klipper
synced 2026-02-09 20:34:23 +09: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user