FIXUP: use user LED
This commit is contained in:
parent
640fbcd77b
commit
5735f18ee2
1 changed files with 15 additions and 2 deletions
17
src/main.rs
17
src/main.rs
|
|
@ -101,6 +101,7 @@ fn panic_handler(info: &core::panic::PanicInfo) -> ! {
|
|||
#[cfg(feature = "_gnss")]
|
||||
static GNSS_UPDATE: Mutex<RefCell<Option<applogic::GnssFix>>> = Mutex::new(RefCell::new(None));
|
||||
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
|
||||
static mut USER_LED: Option<esp_hal::gpio::Output<'static>> = None;
|
||||
#[cfg(feature = "_uart")]
|
||||
static UART_RX_BUF: Mutex<RefCell<Option<Vec<u8>>>> = Mutex::new(RefCell::new(None));
|
||||
#[cfg(feature = "_uart")]
|
||||
|
|
@ -203,6 +204,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)));
|
||||
});
|
||||
|
|
@ -592,8 +600,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}");
|
||||
|
|
@ -609,6 +615,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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue