Added the option to only set the rf modem in bluetooth mode when starting it, this makes the power consumption drop significantly
This commit is contained in:
parent
6d26186bd0
commit
f2b17bffd3
@ -10,14 +10,15 @@
|
||||
//Is needed for the BT off workaround
|
||||
#include "wm_wifi.h"
|
||||
|
||||
bool ble_modem_on(bool startService)
|
||||
bool ble_modem_on(bool bluetoothOnly, bool startService)
|
||||
{
|
||||
int status = BLE_HS_ENOERR;
|
||||
bool serviceStartSuccess = true;
|
||||
uint8_t uart_no = 0xFF;
|
||||
tls_appl_trace_level = TLS_BT_LOG_VERBOSE; //Should be set with a config define
|
||||
|
||||
if(bt_adapter_state == WM_BT_STATE_ON) {
|
||||
if(bt_adapter_state == WM_BT_STATE_ON)
|
||||
{
|
||||
TLS_BT_APPL_TRACE_VERBOSE("ble modem already on"NEW_LINE);
|
||||
return true;
|
||||
}
|
||||
@ -26,9 +27,14 @@ bool ble_modem_on(bool startService)
|
||||
tls_appl_trace_level);
|
||||
status = tls_bt_init(uart_no);
|
||||
|
||||
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY)) {
|
||||
if((status != BLE_HS_ENOERR) && (status != BLE_HS_EALREADY))
|
||||
{
|
||||
TLS_BT_APPL_TRACE_ERROR("%s, tls_bt_init ret:%s"NEW_LINE, __FUNCTION__, tls_bt_rc_2_str(status));
|
||||
}
|
||||
else if(bluetoothOnly) // If we successfully started the modem, we can set it's working mode.
|
||||
{
|
||||
tls_rf_bt_mode(true);
|
||||
}
|
||||
|
||||
// Start the ble service if it was asked and if it is not yet started
|
||||
if(startService && !ble_service_is_started())
|
||||
|
@ -10,7 +10,7 @@
|
||||
* @return true on success
|
||||
* @return false on failure
|
||||
*/
|
||||
bool ble_modem_on(bool startService);
|
||||
bool ble_modem_on(bool bluetoothOnly, bool startService);
|
||||
|
||||
/**
|
||||
* @brief Turns the BLE modem off
|
||||
|
Loading…
Reference in New Issue
Block a user