mirror of
https://github.com/meshtastic/firmware.git
synced 2026-11-07 23:04:49 -05:00
LoRa: ask for the frame bound before reading back the CR it timed
test_preambleHold_isSizedForTheWorstCaseFrame read phy.lastCodingRate straight after the first preamble sighting, where nothing has yet asked the chip to time anything: preambleHoldActive() short-circuits on the unset stamp, so the sighting that starts a hold never reaches calculateTimeOnAir() and the fake still reports a coding rate of 0. Ask maxRxFrameMsec() for the bound first, then assert the CR and CRC it was asked for. The case pins the same thing it always meant to - that the hold is timed at CR 4/8 with CRC rather than at our own CR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CStem6K6MQRBNR8YCFgtCE
This commit is contained in:
1 parent
d272496f76
commit
ff7233cb92
1 file changed
+3
-1
@@ -789,9 +789,11 @@ static void test_preambleHold_isSizedForTheWorstCaseFrame()
|
||||
|
||||
Time::setTestMillis(1000);
|
||||
TEST_ASSERT_TRUE(radioIf->receiveDetectedPublic(TestableRadioLibInterface::kFakePreambleDetected));
|
||||
// The first sighting short-circuits on the unset stamp, so the bound has to be asked for before the chip has been
|
||||
// asked anything at all.
|
||||
TEST_ASSERT_EQUAL_UINT32_MESSAGE(159, radioIf->maxRxFrameMsecPublic(), "part milliseconds round up");
|
||||
TEST_ASSERT_EQUAL_UINT8_MESSAGE(8, phy.lastCodingRate, "the hold must be timed at the worst case CR, not ours");
|
||||
TEST_ASSERT_TRUE_MESSAGE(phy.lastCrcEnabled, "a received frame may carry a CRC, which lengthens it");
|
||||
TEST_ASSERT_EQUAL_UINT32_MESSAGE(159, radioIf->maxRxFrameMsecPublic(), "part milliseconds round up");
|
||||
|
||||
Time::setTestMillis(1100); // the old sizing released here, with the frame still arriving
|
||||
TEST_ASSERT_TRUE(radioIf->preambleHoldActivePublic());
|
||||
|
||||
Reference in new issue
Block a user