NRF52832 Mesh SDK 調試記錄

1.Mesh SDK模型,Node節點在重啓以後,心跳不能正常保持,即沒法在次啓動心跳的解決辦法:post

緣由:主要是由於相關模型沒有從Flash裏面讀取所致,所以只須要回復保存配置便可。學習

關鍵代碼以下:ui

#if ACCESS_MODEL_PUBLISH_PERIOD_RESTORE
static inline void restore_publication_period(access_common_t * p_model)
{
    if (p_model->model_info.publication_period.step_num != 0)
    {
        access_publish_period_set(&p_model->publication_state,
                                  (access_publish_resolution_t) p_model->model_info.publication_period.step_res,
                                  p_model->model_info.publication_period.step_num);
    }
}
#endif

static inline bool restore_models(void)
{
    bool success;
    uint32_t restore_count = restore_flash_data(FLASH_GROUP_MODEL, restore_acquired_model, &success);
    if (success && restore_count > 0)
    {
        for (access_model_handle_t i = 0; i < ACCESS_MODEL_COUNT; ++i)
        {
            if (m_model_pool[i].model_info.element_index != ACCESS_ELEMENT_INDEX_INVALID)
            {
                    restore_addresses_for_model(&m_model_pool[i]);

    #if ACCESS_MODEL_PUBLISH_PERIOD_RESTORE
                    restore_publication_period(&m_model_pool[i]);
    #endif
            }
        }
    }
    return success;
}

  要想使能恢復心跳等模型,只須要使能  ACCESS_MODEL_PUBLISH_PERIOD_RESTORE 宏便可。宏位於文件: nrf_mesh_config_core.hrest

 

 

本文章將會對遇到的Mesh SDK遇到的問題,進行長期更新,也歡迎你們有什麼問題,留言。blog

歡迎你們進羣交流分享:QQ羣:773082801element

 
 
相關文章
相關標籤/搜索