Skip to content

Commit 784e388

Browse files
author
Victor Tchistiak
committed
20190916 - remove extra lines,misc
1 parent c6efba2 commit 784e388

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,7 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
371371
} else {
372372
log_i("Input pin code: 1234");
373373
esp_bt_pin_code_t pin_code;
374-
pin_code[0] = '1';
375-
pin_code[1] = '2';
376-
pin_code[2] = '3';
377-
pin_code[3] = '4';
374+
memcpy(pin_code, "1234", 4);
378375
esp_bt_gap_pin_reply(param->pin_req.bda, true, 4, pin_code);
379376
}
380377
break;
@@ -687,10 +684,9 @@ bool BluetoothSerial::connect()
687684
log_i("master : remoteName");
688685
// will resolve name to address first - it may take a while
689686
return (esp_bt_gap_start_discovery(ESP_BT_INQ_MODE_GENERAL_INQUIRY, INQ_LEN, INQ_NUM_RSPS) == ESP_OK);
690-
} else {
691-
log_e("Neither Remote name nor address was provided");
692687
}
693-
return false;
688+
log_e("Neither Remote name nor address was provided");
689+
return false;
694690
}
695691

696692
bool BluetoothSerial::disconnect() {
@@ -706,11 +702,9 @@ bool BluetoothSerial::connected(int timeout) {
706702
TickType_t xTicksToWait = timeout / portTICK_PERIOD_MS;
707703
if((xEventGroupWaitBits(_spp_event_group, SPP_CONNECTED, pdFALSE, pdTRUE, xTicksToWait) & SPP_CONNECTED)) {
708704
return true;
709-
} else {
710-
log_e("Timeout waiting for connected state");
711-
return false;
712705
}
713-
return _spp_client != 0;
706+
log_e("Timeout waiting for connected state");
707+
return false;
714708
}
715709

716710
bool BluetoothSerial::isReady(bool checkMaster, int timeout) {
@@ -725,10 +719,9 @@ bool BluetoothSerial::isReady(bool checkMaster, int timeout) {
725719
TickType_t xTicksToWait = timeout / portTICK_PERIOD_MS;
726720
if((xEventGroupWaitBits(_spp_event_group, SPP_RUNNING, pdFALSE, pdTRUE, xTicksToWait) & SPP_RUNNING)) {
727721
return true;
728-
} else {
729-
log_e("Timeout waiting for bt initialization to complete");
730-
return false;
731722
}
723+
log_e("Timeout waiting for bt initialization to complete");
724+
return false;
732725

733726
}
734727
#endif

0 commit comments

Comments
 (0)