1、快速进入低功耗的方法
开启POWER_SAVING后,在需要进入低功耗的地方运行
ZDApp_StopJoiningCycle();
NLME_SetPollRate(0);
NLME_SetQueuedPollRate(0);
NLME_SetResponseRate(0);
osal_pwrmgr_device(PWRMGR_BATTERY);
osal_pwrmgr_task_state(appSample_TaskID,0);
在使用外部中断或者内部定时器唤醒后,运行
osal_pwrmgr_task_state(appSample_TaskID,1);
ZDApp_StartJoiningCycle();
NLME_SetPollRate(1200);
NLME_SetQueuedPollRate(100);
NLME_SetResponseRate(100);
/*********************************************************************
* @fn osal_pwrmgr_task_state
*
* @brief This function is called by each task to state whether or
* not this task wants to conserve power.
*
* @param task_id - calling task ID.
* state - whether the calling task wants to
* conserve power or not.
*
* @return SUCCESS if task complete
*/
uint8 osal_pwrmgr_task_state( uint8 task_id, uint8 state )
执行该函数将直接控制系统是否进入低功耗
state==1 ,则系统永远不会进入低功耗
state==0,则系统会最快进入低功耗,会对无线发送接受以及串口发送接受产生影响,出现乱码的情况。
2、解决开启NV_RESTORE,在网络环境较差的情况下,出现设备永久离线的情况
else if ( prevDevState == DEV_NWK_SEC_REJOIN_ALL_CHANNEL)
{
// Set the flag that will ask the device to do trust center network layer rejoin.
// 网络密钥无需擦除,避免强干扰状态下,
// 长时间没有收到新的网络密钥,进而复位到未入网状态
// 造成无法重新入网情况
// _NIB.nwkKeyLoaded = FALSE;
// ZDApp_ResetNwkKey(); // Clear up the old network key.
runtimeChannel = (uint32) (1L << _NIB.nwkLogicalChannel);
prevDevState = DEV_NWK_TC_REJOIN_CURR_CHANNEL ;
}


Comments | NOTHING