Fix 802.15.4 (#4056)

This commit is contained in:
Dániel Buga 2025-09-05 11:29:43 +02:00 committed by GitHub
parent 2a06d38141
commit 68a16055fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -321,20 +321,20 @@ fn ieee802154_sec_update() {
// ieee802154_sec_clr_transmit_security();
}
fn next_operation() {
let previous_operation = STATE.with(|state| {
let prev_state = state.state;
state.state = if ieee802154_pib_get_rx_when_idle() {
enable_rx();
Ieee802154State::Receive
} else {
Ieee802154State::Idle
};
fn next_operation_inner(state: &mut IeeeState) -> Ieee802154State {
let prev_state = state.state;
state.state = if ieee802154_pib_get_rx_when_idle() {
enable_rx();
Ieee802154State::Receive
} else {
Ieee802154State::Idle
};
prev_state
});
prev_state
}
match previous_operation {
fn notify_state(state: Ieee802154State) {
match state {
Ieee802154State::Receive => super::rx_available(),
Ieee802154State::Transmit => super::tx_done(),
Ieee802154State::TxAck => super::tx_done(),
@ -342,6 +342,12 @@ fn next_operation() {
}
}
fn next_operation() {
let previous_operation = STATE.with(next_operation_inner);
notify_state(previous_operation)
}
#[handler(priority = Priority::Priority1)]
fn zb_mac_handler() {
trace!("ZB_MAC interrupt");
@ -375,6 +381,7 @@ fn zb_mac_handler() {
"Received raw {:?}",
crate::fmt::Bytes(&*core::ptr::addr_of!(RX_BUFFER))
);
let mut state_for_notify = Ieee802154State::Idle;
STATE.with(|state| {
if state.rx_queue.len() <= RX_QUEUE_SIZE {
let item = RawReceived {
@ -397,10 +404,12 @@ fn zb_mac_handler() {
} else if should_send_enhanced_ack(frm) {
// TODO
} else {
state_for_notify = next_operation_inner(state)
// esp_ieee802154_coex_pti_set(IEEE802154_IDLE_RX);
next_operation();
}
});
notify_state(state_for_notify)
}
}