bugfix: avoid confirm frame reception missing

This commit is contained in:
bit-cyber-fh
2024-04-07 16:57:29 +08:00
parent da1659a582
commit cfc538bd4d
@@ -237,7 +237,6 @@ static int32_t Scan_InitScanHandler(L2_INST *instPtr)
}
/*****************************************************************************/
/**
* @brief Member node scan net BmAdvt stage handler.
*
@@ -252,6 +251,7 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
ASSERT(instPtr != NULL);
L2_SCAN_FSM *scanFsmPtr = instPtr->scanFSM;
PHY_INST *phyRef = instPtr->config.phyInstPtr;
TMC_INST *tmcRef = instPtr->config.tmcInstPtr;
DBG_INFO("** Net-Setup - Advertisement Procedure (Timeout: %" PRIu8 ") **\n", scanFsmPtr->advTimeout);
// if received a valid bm frame.
@@ -264,7 +264,20 @@ static int32_t Scan_AdvHandler(L2_INST *instPtr)
// Update scan stage
StageUpdate(scanFsmPtr, L2_SCAN_CFM_STAGE);
DBG_INFO("Received Adv frame, skipping 10ms for turn around...\n");
// start a confirm frame reception if in the target slot
if ((TimeCtrl_GetIntCnt(tmcRef) + 1) % CFM_FRAME_SLOTS == 0)
{
// using pull mode to receive confirm frame
// since first time sync procedure is accomplished in ADV stage.
Phy_SetBeamWidth(phyRef, PHY_ANT_BEAM_16);
Phy_SetBeamNo(phyRef, scanFsmPtr->beamNo, PHY_ANT_BEAM_16);
Phy_SetMode(phyRef, PHY_MODE_PULL);
L2_SetupNextSlot(instPtr, L2_TOR_RX, L2_CFM_FRAME);
scanFsmPtr->cfmTimeout++; // increase counter.
instPtr->log.lastBeamWidth = PHY_ANT_BEAM_16;
}
// otherwise skip...
return SUCCESS;
}
// no valid bm frame was received.