From 66272f87d1c89b11182ca8356bcff4b6d9e062f4 Mon Sep 17 00:00:00 2001 From: Stephen D <webmaster@scd31.com> Date: Sun, 23 Jul 2023 10:42:40 -0300 Subject: [PATCH] fix a giant bug. No idea why it worked before and is only now causing issues --- Cargo.lock | 2 +- memory.x | 2 +- src/main.rs | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56521ba..7feaa33 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -324,7 +324,7 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rf4463" version = "0.1.0" -source = "git+https://gitlab.scd31.com/stephen/rf4463-lib#b8c2156522cd9a1a5899ae1d8dd5e885db73afff" +source = "git+https://gitlab.scd31.com/stephen/rf4463-lib#bb99c6bed20f795939e8e1f8b28ba4cbfe4ddfbf" dependencies = [ "embedded-hal 0.2.7", ] diff --git a/memory.x b/memory.x index 05ff02d..8c45f57 100644 --- a/memory.x +++ b/memory.x @@ -1,7 +1,7 @@ MEMORY { /* NOTE K = KiBi = 1024 bytes */ - FLASH : ORIGIN = 0x08000000, LENGTH = 512K + FLASH : ORIGIN = 0x08000000, LENGTH = 512K RAM : ORIGIN = 0x20000000, LENGTH = 128K } diff --git a/src/main.rs b/src/main.rs index d87ee61..e3ecd75 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,7 +109,7 @@ mod app { } #[monotonic(binds = SysTick, default = true)] - type Tonic = Systick<1000>; + type Tonic = Systick<10000>; #[init] fn init(mut ctx: init::Context) -> (Shared, Local, init::Monotonics) { @@ -216,6 +216,11 @@ mod app { // start our radio temp loop get_radio_temp::spawn_after(1u64.secs()).unwrap(); + // start our radio interrupt loop + // TODO I kind of hate this. We need this because sometimes we miss the real interrupt + // I don't know why + run_radio_interrupt::spawn_after(500u64.micros()).unwrap(); + ( Shared { radio, @@ -305,6 +310,13 @@ mod app { get_radio_temp::spawn_after(1u64.secs()).unwrap(); } + #[task(shared = [radio])] + fn run_radio_interrupt(mut ctx: run_radio_interrupt::Context) { + ctx.shared.radio.lock(|r| r.interrupt().unwrap()); + + run_radio_interrupt::spawn_after(500u64.micros()).unwrap(); + } + #[task(binds = DMA1_STREAM3, priority = 2, local = [state, pi_rx, other_rx_buf], shared = [tx_buf, pi_tx, other_tx_buf, spi_data])] fn pi_spi_recv(mut ctx: pi_spi_recv::Context) { let rx = ctx.local.pi_rx; -- GitLab