diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2016-07-11 11:41:49 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2016-07-16 21:33:35 -0400 |
commit | 777a0b817bc01425d562e42354bf09463a1d7852 (patch) | |
tree | b6d147d3a00de547e9e64ec32e8154da41e7db0c /klippy/serialqueue.c | |
parent | 4988ba9a715870f5424460bb0354d003fe8a5bb8 (diff) | |
download | kutter-777a0b817bc01425d562e42354bf09463a1d7852.tar.gz kutter-777a0b817bc01425d562e42354bf09463a1d7852.tar.xz kutter-777a0b817bc01425d562e42354bf09463a1d7852.zip |
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>
Diffstat (limited to 'klippy/serialqueue.c')
-rw-r--r-- | klippy/serialqueue.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/klippy/serialqueue.c b/klippy/serialqueue.c index 60ceeb4b..b3451ad6 100644 --- a/klippy/serialqueue.c +++ b/klippy/serialqueue.c @@ -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 |