restore blocking FPWR in async loop - branch tip deployable (bridge/async both work; verified bSync=True 4kHz)

This commit is contained in:
Tony Cao 2026-10-26 18:59:54 +08:00
parent ac99194b4e
commit 5b0bebe93f

View File

@ -2550,26 +2550,16 @@ async fn rfm_async_loop(
while (rt::now_ns() as i64) < target { core::hint::spin_loop(); } while (rt::now_ns() as i64) < target { core::hint::spin_loop(); }
wphase_st.push(((rt::now_ns() % 1_000_000) / 1000) as i64); wphase_st.push(((rt::now_ns() % 1_000_000) / 1000) as i64);
} }
// PIPELINE v2: mirror the fprd's working pattern - a short let tx_ok = ethercrab::Command::fpwr(station, SM_TX_ADDR)
// yield-kick lets the executor run the TX task (frame goes on .send(maindevice, &slot[..PAYLOAD_LEN])
// the wire), then store for poll-based completion at reap. .await
let mut f: FpwrFut<'_> = Box::pin( .is_ok();
ethercrab::Command::fpwr(station, SM_TX_ADDR).send(maindevice, &slot[..PAYLOAD_LEN]), n_fpwr += 1;
); if tx_ok {
let t_kick = Instant::now(); j2cx_st.push(t_detect.elapsed().as_nanos() as i64);
let _ = futures_lite::future::or( } else {
async { f.as_mut().await.is_ok() }, n_fpwr_err += 1;
async { }
while t_kick.elapsed().as_micros() < 20 {
futures_lite::future::yield_now().await;
}
false
},
)
.await;
pending_fpwr = Some(f);
j2cx_pending = Some(t_detect);
n_fpwr += 1; // issued; result counted at reap
} else { } else {
n_ovf += 1; // wire busy; newer tx_latest will go out after reap n_ovf += 1; // wire busy; newer tx_latest will go out after reap
} }