8000 Fixed incorrect usage of xEventGroupWaitBits (#3446) · cipherz/arduino-esp32@bc3d113 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc3d113

Browse files
wolphme-no-dev
authored andcommitted
Fixed incorrect usage of xEventGroupWaitBits (espressif#3446)
* Fixed incorrect usage of xEventGroupWaitBits * Added parentheses and `!= 0`
1 parent f41beb9 commit bc3d113

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static uint8_t _spp_tx_buffer[SPP_TX_MAX];
154154
static uint16_t _spp_tx_buffer_len = 0;
155155

156156
static bool _spp_send_buffer(){
157-
if((xEventGroupWaitBits(_spp_event_group, SPP_CONGESTED, pdFALSE, pdTRUE, portMAX_DELAY) & SPP_CONGESTED)){
157+
if((xEventGroupWaitBits(_spp_event_group, SPP_CONGESTED, pdFALSE, pdTRUE, portMAX_DELAY) & SPP_CONGESTED) != 0){
158158
esp_err_t err = esp_spp_write(_spp_client, _spp_tx_buffer_len, _spp_tx_buffer);
159159
if(err != ESP_OK){
160160
log_e("SPP Write Failed! [0x%X]", err);
@@ -365,11 +365,11 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
365365
break;
366366

367367
case ESP_BT_GAP_DEV_PROP_COD:
368-
//log_i("ESP_BT_GAP_DEV_PROP_COD");
368+
log_d("ESP_BT_GAP_DEV_PROP_COD");
369369
break;
370370

371371
case ESP_BT_GAP_DEV_PROP_RSSI:
372-
//log_i("ESP_BT_GAP_DEV_PROP_RSSI");
372+
log_d("ESP_BT_GAP_DEV_PROP_RSSI");
373373
break;
374374

375375
default:
@@ -578,7 +578,7 @@ static bool _stop_bt()
578578

579579
static bool waitForConnect(int timeout) {
580580
TickType_t xTicksToWait = timeout / portTICK_PERIOD_MS;
581-
return (xEventGroupWaitBits(_spp_event_group, SPP_CONNECTED, pdFALSE, pdTRUE, xTicksToWait) != 0);
581+
return (xEventGroupWaitBits(_spp_event_group, SPP_CONNECTED, pdFALSE, pdTRUE, xTicksToWait) & SPP_CONNECTED) != 0;
582582
}
583583

584584
/*
@@ -761,7 +761,7 @@ bool BluetoothSerial::disconnect() {
761761
log_i("disconnecting");
762762
if (esp_spp_disconnect(_spp_client) == ESP_OK) {
763763
TickType_t xTicksToWait = READY_TIMEOUT / portTICK_PERIOD_MS;
764-
return (xEventGroupWaitBits(_spp_event_group, SPP_DISCONNECTED, pdFALSE, pdTRUE, xTicksToWait) != 0);
764+
return (xEventGroupWaitBits(_spp_event_group, SPP_DISCONNECTED, pdFALSE, pdTRUE, xTicksToWait) & SPP_DISCONNECTED) != 0;
765765
}
766766
}
767767
return false;
@@ -789,6 +789,6 @@ bool BluetoothSerial::isReady(bool checkMaster, int timeout) {
789789
return false;
790790
}
791791
TickType_t xTicksToWait = timeout / portTICK_PERIOD_MS;
792-
return (xEventGroupWaitBits(_spp_event_group, SPP_RUNNING, pdFALSE, pdTRUE, xTicksToWait) != 0);
792+
return (xEventGroupWaitBits(_spp_event_group, SPP_RUNNING, pdFALSE, pdTRUE, xTicksToWait) & SPP_RUNNING) != 0;
793793
}
794794
#endif

0 commit comments

Comments
 (0)
0