diff --git a/firmware/rust1/src/rs485.rs b/firmware/rust1/src/rs485.rs index e13565fb08b9869fc7951f189e3abcac751afd51..8a22f998e12001e467a03cbd32df93150fd477c3 100644 --- a/firmware/rust1/src/rs485.rs +++ b/firmware/rust1/src/rs485.rs @@ -246,7 +246,7 @@ impl RS485 { sm1.set_enable(true); let mut tx_data = [0, 'H' as u32, 'e' as u32, 'l' as u32, 'l' as u32, 'o' as u32, '\r' as u32, '\n' as u32]; - tx_data[0] = (tx_data.len() - 1) as u32; + tx_data[0] = (tx_data.len() - 2) as u32; for i in 1..tx_data.len() { let x = tx_data[i] & 0xff; let mut parity = 0; @@ -271,7 +271,11 @@ impl RS485 { sm.rx().dma_pull(dma_in_ref.reborrow(), &mut din), //debug_print_pio_addr(embassy_rp::pac::PIO0.sm(0)), tx_future.continue_wait(), - rx_future.continue_wait(), + select( + rx_future.continue_wait(), + //debug_print_pio_addr(embassy_rp::pac::PIO0.sm(1)), + core::future::pending::<()>(), + ), ).await; match x { Either4::First(_) => { @@ -360,7 +364,7 @@ impl RS485 { drop(tx_future); tx_future = DontAbort::new(sm1.tx().dma_push(dma_tx_ref.reborrow(), &tx_data)); }, - Either4::Fourth(x) => { + Either4::Fourth(Either::First(x)) => { drop(rx_future); match x { Result::Ok(()) => {