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

fix race condition that could cause crashes and reboots

parent 8f758663
No related branches found
No related tags found
No related merge requests found
Pipeline #4333 passed
......@@ -12,10 +12,14 @@ mod shell;
mod status;
mod voltage;
use systick_monotonic::fugit::Instant;
pub const MAX_PACKET_LEN: usize = 8191;
pub const SYS_TICK_FREQ: u32 = 1000;
#[rtic::app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [USART6])]
pub type MyInstant = Instant<u64, 1, { SYS_TICK_FREQ }>;
#[rtic::app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [USART1, USART6])]
mod app {
use cortex_m::singleton;
use hal::{
......@@ -260,7 +264,7 @@ mod app {
)
}
#[task(priority = 2, local = [], shared = [red, radio, config, status])]
#[task(priority = 3, local = [], shared = [red, radio, config, status])]
fn radio_tick(mut ctx: radio_tick::Context) {
(ctx.shared.radio, ctx.shared.config).lock(|r, c| {
r.as_mut()
......@@ -404,7 +408,9 @@ mod app {
ctx.local.gps_enable.set_high();
ctx.local.green.set_low();
ctx.shared.red.lock(|red| red.set_low());
ctx.shared.radio.lock(|r| r.as_mut().map(|x| x.sleep()));
ctx.shared
.radio
.lock(|r| r.as_mut().map(|x| x.sleep().unwrap()));
}
}
......
use ham_cats::{buffer::Buffer, identity::Identity, packet::Packet};
use rand::{rngs::SmallRng, Rng, SeedableRng};
use rf4463::{config::RADIO_CONFIG_CATS, error::TransferError, Rf4463};
use rf4463::{
config::RADIO_CONFIG_CATS,
error::{RfError, TransferError},
Rf4463,
};
use rtic::Mutex;
use stm32f4xx_hal::{
gpio,
......@@ -51,8 +55,8 @@ impl<'a> RadioManager<'a> {
})
}
pub fn sleep(&mut self) {
//self.radio.sleep()
pub fn sleep(&mut self) -> Result<(), RfError<spi::Error>> {
self.radio.sleep()
}
pub fn get_temp(&mut self) -> Option<i8> {
......
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