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.
你可以在节点入网,写一参数到NV里面,自己定义一个NV的item。
在重新启动以后,可以去这个NV里面都数据,如果是已经加过网的,那么就自动启动了。
在下面的函数
void ZDApp_Init( uint8 task_id )
/ Start the device?
if ( devState != DEV_HOLD )
{
ZDOInitDevice( 0 );
}
else
{
ZDOInitDevice( ZDO_INIT_HOLD_NWK_START );
// Blink LED to indicate HOLD_START
HalLedBlink ( HAL_LED_4, 0, 50, 500 );
}
在上面的代码的前面加上
uint8 *restoreInitState = osal_mem_alloc(1);
osal_nv_read(NV_STORE_ZDO_INIT, 0, 1, restoreInitState);
if(*restoreInitState == TRUE)
{
devState = DEV_INIT;
}
osal_mem_free(restoreInitState);
NV_STORE_ZDO_INIT你可以自己去定义,在入网以后写进去就可以了。