From 929677b85340bafead37e5dcc104ac9e1ec446f7 Mon Sep 17 00:00:00 2001 From: Benjamin Koch <bbbsnowball@gmail.com> Date: Wed, 28 Jun 2023 02:49:58 +0200 Subject: [PATCH] bugfix: 1.5 char timeout was off by a factor of 1000 --- firmware/rust1/src/rs485.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/rust1/src/rs485.rs b/firmware/rust1/src/rs485.rs index 3aa39a2..cbb7b4f 100644 --- a/firmware/rust1/src/rs485.rs +++ b/firmware/rust1/src/rs485.rs @@ -242,10 +242,10 @@ impl<H: RS485Handler> RS485<H> { // We need two clocks for each loop. //let timeout_start_value = (SM_FREQ as f32 * 0.86e-3 / 2.) as u32; let symbols_per_byte = if self.uart_parity == Parity::ParityNone { 10 } else { 11 }; - let timeout_seconds = 1.5 * symbols_per_byte as f32 * 1000. / self.uart_baud_rate as f32; + let timeout_seconds = 1.5 * symbols_per_byte as f32 / self.uart_baud_rate as f32; let timeout_start_value = (SM_FREQ as f32 * timeout_seconds / 2.) as u32; sm.tx().push(timeout_start_value); - info!("timeout_start_value: {} = 0x{:08x}", timeout_start_value, timeout_start_value); + info!("timeout_start_value: {} = 0x{:08x}, {} sec, clkdiv 0x{:08x}", timeout_start_value, timeout_start_value, timeout_seconds, cfg.clock_divider.to_bits()); // switch to the real program and join FIFOs unsafe { common.free_instr(loaded_program.used_memory); }; -- GitLab