Skip to content

Commit

Permalink
move dfu init outside of init sequence. dfu within init sequence caus…
Browse files Browse the repository at this point in the history
…es the ble not advertising
  • Loading branch information
hnhoan committed Jan 11, 2017
1 parent 2478d7b commit 702aec4
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ARM/Nordic/src/ble_periph_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ static void fds_evt_handler(fds_evt_t const * const p_fds_evt)
case FDS_EVT_WRITE:
if (p_fds_evt->result == FDS_SUCCESS)
{
//printf("\r\nWrite\r\n");
}
break;
default:
break;
}
}

void flash_callback(fs_evt_t const * const evt, fs_ret_t result)
void BlePeriphAppDfuCallback(fs_evt_t const * const evt, fs_ret_t result)
{
if (result == FS_SUCCESS)
{
Expand All @@ -158,11 +159,15 @@ void flash_callback(fs_evt_t const * const evt, fs_ret_t result)

void BlePeriphAppEnterDfu()
{
uint32_t err_code = nrf_dfu_flash_init(true);

nrf_dfu_settings_init();

s_dfu_settings.enter_buttonless_dfu = true;

uint32_t res = nrf_dfu_settings_write(flash_callback);
err_code = nrf_dfu_settings_write(BlePeriphAppDfuCallback);

if (res != NRF_SUCCESS)
if (err_code != NRF_SUCCESS)
{
}
}
Expand Down Expand Up @@ -797,7 +802,8 @@ void BlePeriphAppInit(const BLEAPP_CFG *pBleAppCfg, bool bEraseBond)

BlePeriphAppInitUserStorage();

BlePeriphAppPeerMngrInit(pBleAppCfg->SecType, pBleAppCfg->SecExchg, bEraseBond);

BlePeriphAppPeerMngrInit(pBleAppCfg->SecType, pBleAppCfg->SecExchg, bEraseBond);

gap_params_init(pBleAppCfg);

Expand Down Expand Up @@ -826,9 +832,7 @@ void BlePeriphAppInit(const BLEAPP_CFG *pBleAppCfg, bool bEraseBond)

conn_params_init();

err_code = nrf_dfu_flash_init(true);

nrf_dfu_settings_init();

}

Expand Down

0 comments on commit 702aec4

Please sign in to comment.