Skip to content

Commit f419cd5

Browse files
committed
Removed unnecessary test in discover()
1 parent be66f01 commit f419cd5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

libraries/BluetoothSerial/src/BluetoothSerial.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ bool BluetoothSerial::connect(String remoteName)
10061006
}
10071007
disconnect();
10081008
_doConnect = true;
1009-
_isRemoteAddressSet = false;
1009+
_isRemoteAddressSet = true;
10101010
_sec_mask = ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE;
10111011
_role = ESP_SPP_ROLE_MASTER;
10121012
strncpy(_remote_name, remoteName.c_str(), ESP_BT_GAP_MAX_BDNAME_LEN);
@@ -1169,8 +1169,10 @@ bool BluetoothSerial::isReady(bool checkMaster, int timeout) {
11691169
*/
11701170
BTScanResults* BluetoothSerial::discover(int timeoutMs) {
11711171
scanResults.clear();
1172-
if (timeoutMs < MIN_INQ_TIME || timeoutMs > MAX_INQ_TIME || strlen(_remote_name) || _isRemoteAddressSet)
1172+
if (timeoutMs < MIN_INQ_TIME || timeoutMs > MAX_INQ_TIME){
1173+
log_e("Timeout out of bounds: MIN=%d; MAX=%d; requested=%d", MIN_INQ_TIME, MAX_INQ_TIME, timeoutMs);
11731174
return nullptr;
1175+
}
11741176
int timeout = timeoutMs / INQ_TIME;
11751177
log_i("discover::disconnect");
11761178
disconnect();

0 commit comments

Comments
 (0)