From d8da3c3ae9f127bd6ebb5e2d744266f65d15b249 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Sun, 19 Apr 2026 14:43:34 -0700 Subject: [PATCH] [nexus] set RSSI in simulated ACK frames (#12929) Set the RSSI field in simulated MAC ACK frames in nexus_core.cpp. Previously, the simulator did not populate the mRssi field in the mInfo.mRxInfo structure of simulated ACK frames passed to otPlatRadioTxDone. This caused OpenThread to ignore the RSSI of ACKs, preventing the parentRss average from updating on successful data polls from Sleepy End Devices (SEDs). Now, the RSSI from the parent to the child is calculated using the radio model and clamped to int8_t before being assigned to the ACK frame. --- tests/nexus/platform/nexus_core.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tests/nexus/platform/nexus_core.cpp b/tests/nexus/platform/nexus_core.cpp index f8b1a7e04..f1f0ad8b3 100644 --- a/tests/nexus/platform/nexus_core.cpp +++ b/tests/nexus/platform/nexus_core.cpp @@ -889,9 +889,25 @@ void Core::ProcessRadio(Node &aNode) } ackFrame.UpdateFcs(); - mPcap.WriteFrame(ackFrame, mNow); - otPlatRadioTxDone(&aNode.GetInstance(), &aNode.mRadio.mTxFrame, &ackFrame, kErrorNone); + { + int16_t ackRssi = RadioModel::CalculateRssi(*ackNode, aNode); + + ackFrame.mInfo.mRxInfo.mRssi = ClampToInt8(ackRssi); + ackFrame.mInfo.mRxInfo.mLqi = kDefaultRxLqi; + ackFrame.mInfo.mRxInfo.mTimestamp = mNow; + + mPcap.WriteFrame(ackFrame, mNow); + + if (RadioModel::ShouldDropPacket(ackRssi)) + { + otPlatRadioTxDone(&aNode.GetInstance(), &aNode.mRadio.mTxFrame, nullptr, kErrorNoAck); + } + else + { + otPlatRadioTxDone(&aNode.GetInstance(), &aNode.mRadio.mTxFrame, &ackFrame, kErrorNone); + } + } } else {