Skip to content
Snippets Groups Projects
Commit 74a02a10 authored by Stephen D's avatar Stephen D
Browse files

some fixes

parent a737c75c
No related branches found
No related tags found
1 merge request!1Bug fixes
......@@ -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);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment