最近学习Mesh组网,基于SDK15.3。
在跑通例程后,想在server上多添加一个 Generic OnOff Model,于是添加以下代码。
#define ONOFF_SERVER_1_LED (BSP_LED_1)
static void app_onoff_server_set_cb1(const app_onoff_server_t * p_server, bool onoff);
static void app_onoff_server_get_cb1(const app_onoff_server_t * p_server, bool * p_present_onoff);
APP_ONOFF_SERVER_DEF(m_onoff_server_1,
APP_CONFIG_FORCE_SEGMENTATION,
APP_CONFIG_MIC_SIZE,
app_onoff_server_set_cb1,
app_onoff_server_get_cb1)
static void app_onoff_server_set_cb1(const app_onoff_server_t * p_server, bool onoff)
{
/* Resolve the server instance here if required, this example uses only 1 instance. */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Setting GPIO value: %d\n", onoff)
hal_led_pin_set(ONOFF_SERVER_1_LED, onoff);
}
/* Callback for reading the hardware state */
static void app_onoff_server_get_cb1(const app_onoff_server_t * p_server, bool * p_present_onoff)
{
/* Resolve the server instance here if required, this example uses only 1 instance. */
*p_present_onoff = hal_led_pin_get(ONOFF_SERVER_1_LED);
}
static void app_model_init(void)
{
/* Instantiate onoff server on element index APP_ONOFF_ELEMENT_INDEX */
ERROR_CHECK(app_onoff_init(&m_onoff_server_0, APP_ONOFF_ELEMENT_INDEX));
ERROR_CHECK(app_onoff_init(&m_onoff_server_1, APP_ONOFF_ELEMENT_INDEX));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "App OnOff Model Handle: %d\n", m_onoff_server_0.server.model_handle);
}
创建model后绑定在第一个element上,在nrf_mesh_config_app.h
里修改宏
#define ACCESS_MODEL_COUNT (4)
编译下载后出现错误
请问这样增加model有什么错误吗?