Fixed the bug where BLUFI would output error logs even when the network connection was normal. (#1567)
Some checks are pending
Build Boards / Determine variants to build (push) Waiting to run
Build Boards / Build ${{ matrix.name }} (push) Blocked by required conditions

This commit is contained in:
Wang is proud 2025-12-17 06:18:41 +08:00 committed by GitHub
parent cccaf71c3e
commit 99c32d9331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 13 deletions

View File

@ -114,6 +114,7 @@ Blufi::~Blufi() {
esp_err_t Blufi::init() {
esp_err_t ret;
inited_ = true;
m_provisioned = false;
m_deinited = false;
@ -136,21 +137,24 @@ esp_err_t Blufi::init() {
}
esp_err_t Blufi::deinit() {
if (m_deinited) {
return ESP_OK;
}
m_deinited = true;
esp_err_t ret;
ret = _host_deinit();
if (ret) {
ESP_LOGE(BLUFI_TAG, "Host deinit failed: %s", esp_err_to_name(ret));
}
esp_err_t ret = ESP_OK;
if (inited_) {
if (m_deinited) {
return ESP_OK;
}
m_deinited = true;
ret = _host_deinit();
if (ret) {
ESP_LOGE(BLUFI_TAG, "Host deinit failed: %s", esp_err_to_name(ret));
}
#if CONFIG_BT_CONTROLLER_ENABLED || !CONFIG_BT_NIMBLE_ENABLED
ret = _controller_deinit();
if (ret) {
ESP_LOGE(BLUFI_TAG, "Controller deinit failed: %s", esp_err_to_name(ret));
}
ret = _controller_deinit();
if (ret) {
ESP_LOGE(BLUFI_TAG, "Controller deinit failed: %s", esp_err_to_name(ret));
}
#endif
}
return ret;
}

View File

@ -34,6 +34,8 @@ public:
Blufi &operator=(const Blufi &) = delete;
private:
bool inited_ = false;
Blufi();
~Blufi();