diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-07-25 20:50:19 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-07-29 11:40:54 -0400 |
commit | db6346e7e55d34763904488deff4a67338b1acbd (patch) | |
tree | 9590bd463623a68b7deb8c4bde642d6e072f9573 /klippy/serialhdl.py | |
parent | 2293e1506ffd54a5bb1e0bda90f1c497a7bdc20d (diff) | |
download | kutter-db6346e7e55d34763904488deff4a67338b1acbd.tar.gz kutter-db6346e7e55d34763904488deff4a67338b1acbd.tar.xz kutter-db6346e7e55d34763904488deff4a67338b1acbd.zip |
serialqueue: Improve canbus timing
Adjust timing based on the minimum transmission time of canbus
messages.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/serialhdl.py')
-rw-r--r-- | klippy/serialhdl.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index b916ab20..15d1cc21 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -12,7 +12,6 @@ class error(Exception): pass class SerialReader: - BITS_PER_BYTE = 10. def __init__(self, reactor, warn_prefix=""): self.reactor = reactor self.warn_prefix = warn_prefix @@ -97,11 +96,13 @@ class SerialReader: self.msgparser = msgparser self.register_response(self.handle_unknown, '#unknown') # Setup baud adjust - mcu_baud = msgparser.get_constant_float('SERIAL_BAUD', None) - if mcu_baud is not None: - baud_adjust = self.BITS_PER_BYTE / mcu_baud - self.ffi_lib.serialqueue_set_baud_adjust( - self.serialqueue, baud_adjust) + if serial_fd_type == b'c': + wire_freq = msgparser.get_constant_float('CANBUS_FREQUENCY', None) + else: + wire_freq = msgparser.get_constant_float('SERIAL_BAUD', None) + if wire_freq is not None: + self.ffi_lib.serialqueue_set_wire_frequency(self.serialqueue, + wire_freq) receive_window = msgparser.get_constant_int('RECEIVE_WINDOW', None) if receive_window is not None: self.ffi_lib.serialqueue_set_receive_window( |