fixed BT LED state when using multiple mouses

This commit is contained in:
demik 2021-09-21 00:09:09 +02:00
parent 231e1dfb4a
commit 5345ba5476
2 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- update to ESP-IDF v4.2.2:
- https://github.com/espressif/esp-idf/releases/tag/v4.2.2
- fixed controller not reporting disconnect event
- fixed BT LED state when using multiple mouses
## v1.4.0
- Initial firmare release

View File

@ -57,6 +57,7 @@ TaskHandle_t t_adb2hid;
extern TaskHandle_t t_click;
static esp_hidd_dev_t *hid_dev = NULL;
extern QueueHandle_t q_qx, q_qy;
uint8_t blue_pointers; // mouse count
/* private functions */
static void blue_d_connect(void);
@ -270,6 +271,8 @@ void blue_h_close(esp_hidh_event_data_t *p) {
ESP_LOGI(TAG, "closed connection with device " ESP_BD_ADDR_STR, ESP_BD_ADDR_HEX(bda));
esp_hidh_dev_free(p->close.dev);
blue_pointers--;
if (! blue_pointers)
xTaskNotify(t_blue, LED_SLOW, eSetValueWithOverwrite);
}
@ -309,6 +312,7 @@ static void blue_h_init(void) {
ESP_ERROR_CHECK(esp_hidh_init(&config));
blue_pointers = 0;
xTaskCreatePinnedToCore(blue_scan, "blue_scan", 6 * 1024, NULL, 2, NULL, 0);
}
@ -441,6 +445,7 @@ void blue_h_open(esp_hidh_event_data_t *p) {
ESP_LOGE(TAG, "Mouse does not support boot protocol !");
}
blue_pointers++;
xTaskNotify(t_blue, LED_ON, eSetValueWithOverwrite);
gpio_output_enable();
}