Fix Bluetooth setup_priorities (#2458)

Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
Jesse Hills 2021-10-18 09:56:31 +13:00
parent 0524f8c677
commit 63a9acaa19
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
6 changed files with 8 additions and 2 deletions

View file

@ -11,6 +11,8 @@ namespace ble_client {
static const char *const TAG = "ble_client";
float BLEClient::get_setup_priority() const { return setup_priority::AFTER_BLUETOOTH; }
void BLEClient::setup() {
auto ret = esp_ble_gattc_app_register(this->app_id);
if (ret) {

View file

@ -81,6 +81,7 @@ class BLEClient : public espbt::ESPBTClient, public Component {
void setup() override;
void dump_config() override;
void loop() override;
float get_setup_priority() const override;
void gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if,
esp_ble_gattc_cb_param_t *param) override;

View file

@ -57,7 +57,7 @@ void ESP32BLEBeacon::setup() {
);
}
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::DATA; }
float ESP32BLEBeacon::get_setup_priority() const { return setup_priority::BLUETOOTH; }
void ESP32BLEBeacon::ble_core_task(void *params) {
ble_setup();

View file

@ -154,7 +154,7 @@ void BLEServer::gatts_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t ga
}
}
float BLEServer::get_setup_priority() const { return setup_priority::BLUETOOTH - 10; }
float BLEServer::get_setup_priority() const { return setup_priority::AFTER_BLUETOOTH; }
void BLEServer::dump_config() { ESP_LOGCONFIG(TAG, "ESP32 BLE Server:"); }

View file

@ -40,6 +40,8 @@ uint64_t ble_addr_to_uint64(const esp_bd_addr_t address) {
return u;
}
float ESP32BLETracker::get_setup_priority() const { return setup_priority::BLUETOOTH; }
void ESP32BLETracker::setup() {
global_esp32_ble_tracker = this;
this->scan_result_lock_ = xSemaphoreCreateMutex();

View file

@ -171,6 +171,7 @@ class ESP32BLETracker : public Component {
/// Setup the FreeRTOS task and the Bluetooth stack.
void setup() override;
void dump_config() override;
float get_setup_priority() const override;
void loop() override;