NRF52832 Mesh SDK 调试记录

1.Mesh SDK模型,Node节点在重启之后,心跳不能正常保持,即无法在次启动心跳的解决办法:

原因:主要是因为相关模型没有从Flash里面读取所致,因此只需要回复保存配置即可。

关键代码如下:

#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.h

 

 

本文章将会对遇到的Mesh SDK遇到的问题,进行长期更新,也欢迎大家有什么问题,留言。

欢迎大家进群交流分享:QQ群:773082801

 
 
posted @ 2019-05-30 10:40  badwell  阅读(2208)  评论(0编辑  收藏  举报