This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to reduce the scan duration after orphan scan failed?



Hi all

         i have a ZED switch which power supplied by battery。

         when  it being orphan, i want to make it go into sleep as soon as possible。。。when i don't want  to changing  the zgDefaultRejoinScan 。

        so i  changing the ZDO_StartDevice() function as like  below:

        

    else if ( startMode == MODE_RESUME )
    {
      if ( logicalType == NODETYPE_ROUTER )
      {//路由设备
        ZMacScanCnf_t scanCnf;
        ZDApp_ChangeState( DEV_NWK_ORPHAN );

        /* if router and nvram is available, fake successful orphan scan */
        scanCnf.hdr.Status = ZSUCCESS;
        scanCnf.ScanType = ZMAC_ORPHAN_SCAN;
        scanCnf.UnscannedChannels = 0;
        scanCnf.ResultListSize = 0;
        nwk_ScanJoiningOrphan(&scanCnf);

        ret = ZSuccess;
      }
      else
      {//终端设备
        ZDApp_ChangeState( DEV_NWK_ORPHAN );
        //set timer for scan and rejoin
      #ifdef SWITCH_BAT
        //电池按键 orphan 1s 后立刻进入休眠态
        osal_start_timerEx( ZDAppTaskID, ZDO_REJOIN_BACKOFF, 1000);
      #else
        osal_start_timerEx( ZDAppTaskID, ZDO_REJOIN_BACKOFF, zgDefaultRejoinScan );
      #endif  
        ret = NLME_OrphanJoinRequest( runtimeChannel,
                                     zgDefaultStartingScanDuration);
      }

       when  i  found that sometimes, the ZED swicth could not rejoin ~~~ it  just  sending beacon  request, and  could not  rejoin !

       why ?

BR!