I am build an application with features : When I not used nRF it imediately in sleep mode and be wake up by BLE events to send some text, and return to sleep mode ( the reson why I choose system On sleep mode).
1. So I think my nRF make sure
-> advertising continuosly in sleep mode (because my phone will connect to nRF anytime to wake nRF up and send text)
2. To make nRF advertisin continously I did
- set the flags // init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE => BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; to disable advertising timeout
- in BLE_ADV_EVT_IDLE I commented sleep_mode_enter();, and call ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST); to restart advertising
static void on_adv_evt(ble_adv_evt_t ble_adv_evt)
{
uint32_t err_code;
switch (ble_adv_evt)
{
case BLE_ADV_EVT_FAST:
err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
APP_ERROR_CHECK(err_code);
break;
case BLE_ADV_EVT_IDLE:
NRF_LOG_INFO("call idle");
//sleep_mode_enter();
ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
break;
default:
break;
}
}
3. To wake up nRF I debug the NRF_LOG_PROCESS() in debug terminal this is 'true' when I connect to device or send some data from mobile phone to nRF
-> so I think nRF was wake up in these BLE events
4. What is the different between ble_idle and ble_timeout ? In idle mode can nRF advertising and my phone can connect to it ?
5. Does such continuous advertising make nRF consume a lot of energy? Can you suggest me some another ways ?
my main loop()
// Enter main loop.
for (;;)
{
idle_state_handle();
NRF_LOG_INFO("%d", NRF_LOG_PROCESS());
nrf_delay_ms(200);
}
the rest of code is similar ble_app_uart ().
Please answer for me 5 above questions. Thank you !