discovery needs to be stopped before connecting is possible

This commit is contained in:
Morgan 'ARR\!' Allen 2021-09-10 14:46:45 -07:00
parent 0720a31280
commit f2a128bf53

View file

@ -341,8 +341,11 @@ static int ble_gap_event(struct ble_gap_event *event, void *arg) {
if(strstr(name, "BARBACK") != NULL) { if(strstr(name, "BARBACK") != NULL) {
ESP_LOGI(TAG, "Let's Party!"); ESP_LOGI(TAG, "Let's Party!");
uint8_t addr_type = *(uint8_t*)arg; uint8_t addr_type;
(ble_gap_connect(addr_type, &(event->disc).addr, 30000, NULL, ble_gap_event, NULL)); ble_gap_disc_cancel();
ESP_ERROR_CHECK(ble_hs_id_infer_auto(0, &addr_type));
ESP_ERROR_CHECK(ble_gap_connect(addr_type, &event->disc.addr, 30000, NULL, ble_gap_event, NULL));
} }
} }