Skip to content

Commit

Permalink
Merge pull request #73 from iranl/c6-fix
Browse files Browse the repository at this point in the history
C6 Fix
  • Loading branch information
technyon authored Jul 29, 2024
2 parents 8990978 + 0590470 commit 8326bcf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/NukiBle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void NukiBle::setPower(esp_power_level_t powerLevel) {
if (!NimBLEDevice::getInitialized()) {
NimBLEDevice::init(deviceName);
}

NimBLEDevice::setPower(powerLevel);
}

Expand All @@ -102,7 +102,7 @@ PairingResult NukiBle::pairNuki(AuthorizationIdType idType) {
#else
if (pairingLastSeen < (esp_timer_get_time() / 1000) - 2000) pairingServiceAvailable = false;
#endif

if (pairingServiceAvailable && bleAddress != BLEAddress("")) {
pairingServiceAvailable = false;
#ifdef DEBUG_NUKI_CONNECT
Expand Down Expand Up @@ -246,15 +246,16 @@ bool NukiBle::connectBle(const BLEAddress bleAddress, bool pairing) {
#ifdef CONFIG_IDF_TARGET_ESP32C6
if(connected || pClient->isConnected()) {
pClient->disconnect();
connected = false;
}

int loop = 0;

while((connected || pClient->isConnected()) && loop <=100) {
loop++;
delay(20);
}

if(loop>=100)
{
#ifdef DEBUG_NUKI_CONNECT
Expand All @@ -268,7 +269,7 @@ bool NukiBle::connectBle(const BLEAddress bleAddress, bool pairing) {
continue;
}
#endif

if(!connected || !pClient->isConnected()) {
if(!pClient->connect(bleAddress, true)) {
#ifdef DEBUG_NUKI_CONNECT
Expand Down

0 comments on commit 8326bcf

Please sign in to comment.