Compare commits
No commits in common. "tmp/debug" and "main" have entirely different histories.
1 changed files with 4 additions and 34 deletions
38
src/main.rs
38
src/main.rs
|
|
@ -76,7 +76,6 @@ esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
#[cfg(feature = "_gnss")]
|
#[cfg(feature = "_gnss")]
|
||||||
static GNSS_UPDATE: Mutex<RefCell<Option<applogic::GnssFix>>> = Mutex::new(RefCell::new(None));
|
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 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")]
|
#[cfg(feature = "_uart")]
|
||||||
static UART_RX_BUF: Mutex<RefCell<Option<Vec<u8>>>> = Mutex::new(RefCell::new(None));
|
static UART_RX_BUF: Mutex<RefCell<Option<Vec<u8>>>> = Mutex::new(RefCell::new(None));
|
||||||
#[cfg(feature = "_uart")]
|
#[cfg(feature = "_uart")]
|
||||||
|
|
@ -177,13 +176,6 @@ async fn main(spawner: Spawner) -> ! {
|
||||||
error!("Failed to set WiFi TX power: {err}");
|
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| {
|
critical_section::with(|cs| {
|
||||||
WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2)));
|
WIFI_RX_QUEUE.borrow(cs).replace(Some(ArrayQueue::new(2)));
|
||||||
});
|
});
|
||||||
|
|
@ -554,12 +546,6 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// info!("Received frame with {} bytes", frame.len);
|
// info!("Received frame with {} bytes", frame.len);
|
||||||
unsafe {
|
|
||||||
#[allow(static_mut_refs)]
|
|
||||||
if let Some(ref mut led) = USER_LED.as_mut() {
|
|
||||||
led.toggle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse GN headers
|
// parse GN headers
|
||||||
match c_its_parser::pcap::remove_wlan_headers(frame.data)
|
match c_its_parser::pcap::remove_wlan_headers(frame.data)
|
||||||
|
|
@ -574,7 +560,6 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) {
|
||||||
Ok(packet) => {
|
Ok(packet) => {
|
||||||
// drop hopped (for now)
|
// drop hopped (for now)
|
||||||
if packet.decoded.is_hopped() {
|
if packet.decoded.is_hopped() {
|
||||||
esp_println::print!("."); // TODO: debug only!
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -583,15 +568,9 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) {
|
||||||
// drop all unsupported message IDs and rate-limit SPATEMs
|
// drop all unsupported message IDs and rate-limit SPATEMs
|
||||||
if match message_id {
|
if match message_id {
|
||||||
#[cfg(feature = "denm")]
|
#[cfg(feature = "denm")]
|
||||||
c_its_parser::standards::extensions::ItsMessageId::Denm => {
|
c_its_parser::standards::extensions::ItsMessageId::Denm => false,
|
||||||
esp_println::print!("D"); // TODO: debug only!
|
|
||||||
false
|
|
||||||
}
|
|
||||||
#[cfg(feature = "cam")]
|
#[cfg(feature = "cam")]
|
||||||
c_its_parser::standards::extensions::ItsMessageId::Cam => {
|
c_its_parser::standards::extensions::ItsMessageId::Cam => false,
|
||||||
esp_println::print!("C"); // TODO: debug only!
|
|
||||||
false
|
|
||||||
}
|
|
||||||
#[cfg(feature = "spat")]
|
#[cfg(feature = "spat")]
|
||||||
c_its_parser::standards::extensions::ItsMessageId::Spatem => {
|
c_its_parser::standards::extensions::ItsMessageId::Spatem => {
|
||||||
// reduce SPAT rate per station ID
|
// reduce SPAT rate per station ID
|
||||||
|
|
@ -607,10 +586,7 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) {
|
||||||
i.msg_count = i.msg_count.wrapping_add(1);
|
i.msg_count = i.msg_count.wrapping_add(1);
|
||||||
|
|
||||||
if (i.msg_count % SPAT_RATE_LIMIT) > 0 {
|
if (i.msg_count % SPAT_RATE_LIMIT) > 0 {
|
||||||
esp_println::print!("s"); // TODO: debug only!
|
|
||||||
drop_msg = true;
|
drop_msg = true;
|
||||||
} else {
|
|
||||||
esp_println::print!("S"); // TODO: debug only!
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -618,14 +594,8 @@ fn handle_frame(frame: esp_radio::wifi::sniffer::PromiscuousPkt<'_>) {
|
||||||
drop_msg
|
drop_msg
|
||||||
}
|
}
|
||||||
#[cfg(feature = "spat")]
|
#[cfg(feature = "spat")]
|
||||||
c_its_parser::standards::extensions::ItsMessageId::Mapem => {
|
c_its_parser::standards::extensions::ItsMessageId::Mapem => false,
|
||||||
esp_println::print!("M"); // TODO: debug only!
|
_ => true,
|
||||||
false
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
esp_println::print!("?"); // TODO: debug only!
|
|
||||||
true
|
|
||||||
}
|
|
||||||
} {
|
} {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue