Now setting some BLE connection parameters to try improving the watch's power consumption, shaved two mA off :(

This commit is contained in:
Th3maz1ng 2023-12-02 22:31:01 +01:00
parent 65d41833fe
commit 0521ea37a9

View File

@ -302,7 +302,7 @@ static void setBLEEnabledCb(bool *enabled, SettingMode_e mode)
else
{
watch_settings_connectivity_set_ble_enabled(*enabled);
//Let's turn the BLE on or OFF here
// Let's turn the BLE on or off here
if(*enabled)
{
if(!ble_modem_on(true, true))
@ -524,7 +524,7 @@ static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length)
gadget_bridge_parser_feed((const char *)data, length);
while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING);
}
static uint32_t bt_ctrl_sleep_ms = 0;
static void ble_service_state_change_cb(ble_service_state_e ble_service_state)
{
switch(ble_service_state)
@ -533,6 +533,17 @@ static void ble_service_state_change_cb(ble_service_state_e ble_service_state)
watch_face_set_bluetooth_indicator(&watchFace, BLUETOOTH_STATE_CONNECTED);
find_my_phone_screen_notify_BLE_connection_state(&findMyPhoneScreen, true);
music_player_screen_notify_BLE_connection_state(&musicPlayerScreen, true);
// Let's request a BLE connection parameters update
ble_service_update_connection_parameters(
84, // itvl_min 105 ms
120, // itvl_max 150 ms
5, // latency 5
1000, // supervision timeout 10 s
0x0010, // min connection event length 10 ms
0x0300 // max connection event length 480 ms
);
// Let's request a MTU update
ble_service_request_mtu_exchange();
break;
case BLE_SERVICE_MODE_ADVERTISING:
watch_face_set_bluetooth_indicator(&watchFace, BLUETOOTH_STATE_ON);