Hi,
I want to add FDS basedon dimming_serve example ,However,after fds_init(); it not jump to fds_evt_handler but stop wait .
The below is my code:
static void initialize(void)
{
__LOG_INIT(LOG_SRC_APP | LOG_SRC_ACCESS | LOG_SRC_BEARER, LOG_LEVEL_INFO, LOG_CALLBACK_DEFAULT);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "----- BLE Mesh Dimming Server Demo -----\n");
ERROR_CHECK(app_timer_init());
hal_leds_init();
ble_stack_init();
#if MESH_FEATURE_GATT_ENABLED
gap_params_init();
conn_params_init();
#endif
//mesh_init();
uint32_t status = app_pwm_init(&PWM0, &m_pwm0_config, NULL);
APP_ERROR_CHECK(status);
m_pwm0_max = app_pwm_cycle_ticks_get(&PWM0);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "PWM max ticks: %d\n", m_pwm0_max);
#if 1
//FDS
/* Register first to receive an event when initialization is complete. */
status=fds_register(fds_evt_handler);//(void) fds_register(fds_evt_handler);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Status fds register is : %d\n",status);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Initializing fds...\n");
status=fds_init();
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Status fds init is : %d\n",status);
APP_ERROR_CHECK(status);
/* Wait for fds to initialize. */
wait_for_fds_ready();
#if 0
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Available commands:\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- print all\t\tprint records\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- print config\tprint configuration\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- update\t\tupdate configuration\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- stat\t\tshow statistics\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- write\t\twrite a new record\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- delete\t\tdelete a record\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- delete_all\tdelete all records\n");
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "- gc\t\trun garbage collection\n");
#endif
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Reading flash usage statistics...\n");
fds_stat_t stat = {0};
status = fds_stat(&stat);
APP_ERROR_CHECK(status);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Found %d valid records.\n", stat.valid_records);
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Found %d dirty records (ready to be garbage collected).\n", stat.dirty_records);
fds_record_desc_t desc = {0};
fds_find_token_t tok = {0};
status = fds_record_find(CONFIG_FILE, CONFIG_REC_KEY, &desc, &tok);
if (status == FDS_SUCCESS)
{
/* A config file is in flash. Let's update it. */
fds_flash_record_t config = {0};
/* Open the record and read its contents. */
status = fds_record_open(&desc, &config);
APP_ERROR_CHECK(status);
/* Copy the configuration from flash into m_dummy_cfg. */
memcpy(&m_dummy_cfg, config.p_data, sizeof(configuration_t));
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Config file found, updating boot count to %d\n", m_dummy_cfg.boot_count);
/* Update boot count. */
m_dummy_cfg.boot_count++;
/* Close the record when done reading. */
status = fds_record_close(&desc);
APP_ERROR_CHECK(status);
/* Write the updated record to flash. */
status = fds_record_update(&desc, &m_dummy_record);
APP_ERROR_CHECK(status);
}
else
{
/* System config not found; write a new one. */
__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, "Writing config file...\n");
status = fds_record_write(&desc, &m_dummy_record);
APP_ERROR_CHECK(status);
}
#endif
}
And The Bellow is Log:
<t: 0>, main.c, 558, ----- BLE Mesh Dimming Server Demo -----
<t: 17925>, ble_softdevice_support.c, 124, RAM Start is 0x20002DA0
<t: 17945>, main.c, 575, PWM max ticks: 1600
<t: 17948>, main.c, 581, Status fds register is : 0
<t: 17950>, main.c, 583, Initializing fds...
How To solve this ? TKS in anvance.
Best Regards
Panda