Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_idfgh_10092' into 'master'
Browse files Browse the repository at this point in the history
Esp_hid: fixed ble hid battery level setting

See merge request espressif/esp-idf!23789
  • Loading branch information
wmy-espressif committed Jun 14, 2023
2 parents 126b98d + 9c8958d commit 2e9669a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/esp_hid/src/ble_hidd.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,14 @@ static esp_err_t esp_ble_hidd_dev_battery_set(void *devp, uint8_t level)
return ESP_OK;
}

ret = esp_ble_gatts_send_indicate(dev->bat_svc.gatt_if, dev->conn_id, dev->bat_level_handle, 1, &dev->bat_level, dev->bat_ccc.indicate_enable);
if (ret) {
ESP_LOGE(TAG, "esp_ble_gatts_send_indicate failed: %d", ret);
return ESP_FAIL;
if (dev->bat_ccc.notify_enable) {
ret = esp_ble_gatts_send_indicate(dev->bat_svc.gatt_if, dev->conn_id, dev->bat_level_handle, 1, &dev->bat_level, false);
if (ret) {
ESP_LOGE(TAG, "esp_ble_gatts_send_notify failed: %d", ret);
return ESP_FAIL;
}
}
WAIT_CB(dev);

return ESP_OK;
}

Expand Down

0 comments on commit 2e9669a

Please sign in to comment.