From 74a02a10812445302d37cc883a507ea354b68cdb Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Sun, 26 Nov 2023 15:14:55 -0400 Subject: [PATCH] some fixes --- src/radio.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/radio.rs b/src/radio.rs index 0fc9d2b..f1a6a7f 100644 --- a/src/radio.rs +++ b/src/radio.rs @@ -21,7 +21,7 @@ type MyDelay = Delay<TIM5, 1000000>; type Radio = Rf4463<Spi<SPI1>, SdnPin, CsPin, MyDelay>; pub struct RadioManager<'a> { - pub radio: Radio, + radio: Radio, buf: &'a mut [u8; MAX_PACKET_LEN], enable_digipeating: bool, } @@ -64,14 +64,17 @@ impl<'a> RadioManager<'a> { .map_err(TransferError::SpiError)?; } - self.radio.interrupt(Some(self.buf), None).unwrap(); + self.radio.interrupt(Some(self.buf), None)?; - if let Some(data) = self.radio.finish_rx(self.buf).unwrap() { + if let Some(data) = self + .radio + .finish_rx(self.buf) + .map_err(TransferError::SpiError)? + { if self.enable_digipeating { if let Some((callsign, ssid)) = ident { let mut buf = [0; MAX_PACKET_LEN]; - let p = Packet::fully_decode(data.data(), &mut buf); - if let Ok(packet) = p { + if let Ok(packet) = Packet::fully_decode(data.data(), &mut buf) { self.handle_packet_rx(led, packet, callsign, ssid); } } -- GitLab