From 105d3123f4b63a61609a3bf42acf0f9d53bffd0f Mon Sep 17 00:00:00 2001 From: Jannik Beyerstedt Date: Mon, 3 Aug 2026 11:45:28 +0200 Subject: [PATCH] FIXUP: use user LED --- src/main.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index d9d77f8..154082a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,7 @@ esp_bootloader_esp_idf::esp_app_desc!(); #[cfg(feature = "_gnss")] static GNSS_UPDATE: Mutex>> = Mutex::new(RefCell::new(None)); static WIFI_RX_QUEUE: Mutex>>>> = Mutex::new(RefCell::new(None)); +static mut USER_LED: Option> = None; #[cfg(feature = "_uart")] static UART_RX_BUF: Mutex>>> = Mutex::new(RefCell::new(None)); #[cfg(feature = "_uart")] @@ -176,6 +177,13 @@ async fn main(spawner: Spawner) -> ! { error!("Failed to set WiFi TX power: {err}"); } + unsafe { + USER_LED = Some(esp_hal::gpio::Output::new( + peripherals.GPIO27, + esp_hal::gpio::Level::Low, + esp_hal::gpio::OutputConfig::default(), + )); + } critical_section::with(|cs| { WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2))); }); @@ -531,8 +539,6 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) { .naive_utc() }; - esp_println::print!("."); // TODO: debug only! - match esp32_cits_core::rx::is_broadcast_frame(&frame) { Err(err) => { warn!("{err}"); @@ -548,6 +554,13 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) { } // info!("Received frame with {} bytes", frame.len); + esp_println::print!("."); // TODO: debug only! + unsafe { + #[allow(static_mut_refs)] + if let Some(ref mut led) = USER_LED.as_mut() { + led.toggle(); + } + } // parse GN headers match c_its_parser::pcap::remove_wlan_headers(frame.data)