Skip to content

Commit

Permalink
[ASR] fix double init in BLEManager and OTA (project-chip#31579)
Browse files Browse the repository at this point in the history
* fix BLE pairing issue

because the initialization time of ble is earlier the callback registration time

* fix ota fail issue

* Restyled by clang-format

* Update ASR582X SDK to v1.9.1
  • Loading branch information
tx2rx authored Feb 27, 2024
1 parent a2d98f8 commit 8428564
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/platform/ASR/ASROTAImageProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
#include <app/clusters/ota-requestor/OTADownloader.h>
#include <app/clusters/ota-requestor/OTARequestorInterface.h>

/// No error, operation OK
#define LEGA_OTA_OK 0L

namespace chip {

CHIP_ERROR ASROTAImageProcessor::PrepareDownload()
Expand Down Expand Up @@ -121,7 +118,8 @@ void ASROTAImageProcessor::HandlePrepareDownload(intptr_t context)

imageProcessor->mHeaderParser.Init();

imageProcessor->mDownloader->OnPreparedForDownload(err == LEGA_OTA_OK ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL);
imageProcessor->mDownloader->OnPreparedForDownload(
((err == LEGA_OTA_OK) || (err == LEGA_OTA_INIT_ALREADY)) ? CHIP_NO_ERROR : CHIP_ERROR_INTERNAL);
}

void ASROTAImageProcessor::HandleFinalize(intptr_t context)
Expand Down
3 changes: 3 additions & 0 deletions src/platform/ASR/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ CHIP_ERROR BLEManagerImpl::_Init()
}
else
{
matter_ble_stack_open();
matter_ble_add_service();
BLEMgrImpl().SetStackInit();
mFlags.Set(Flags::kFlag_StackInitialized, true);
log_i("ble is alread open!\n");
}
Expand Down

0 comments on commit 8428564

Please sign in to comment.