Skip to content

Commit 1182aca

Browse files
committed
enhance example, relate to #150
1 parent 71efec2 commit 1182aca

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

libraries/Bluefruit52Lib/examples/Central/central_bleuart/central_bleuart.ino

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ void connect_callback(uint16_t conn_handle)
118118
}
119119

120120
Serial.println();
121+
}else
122+
{
123+
Serial.println("Found NONE");
121124
}
122125

123126
Serial.print("Dicovering Battery ... ");
@@ -127,8 +130,10 @@ void connect_callback(uint16_t conn_handle)
127130
Serial.print("Battery level: ");
128131
Serial.print(clientBas.read());
129132
Serial.println("%");
133+
}else
134+
{
135+
Serial.println("Found NONE");
130136
}
131-
132137

133138
Serial.print("Discovering BLE Uart Service ... ");
134139
if ( clientUart.discover(conn_handle) )

libraries/Bluefruit52Lib/examples/Peripheral/throughput/throughput.ino

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ void loop(void)
132132
Serial.println(" bytes ...");
133133

134134
start = millis();
135-
while (remaining > 0)
135+
while ( (remaining > 0) && Bluefruit.connected() && bleuart.notifyEnabled() )
136136
{
137-
bleuart.print(TEST_STRING);
137+
if ( !bleuart.print(TEST_STRING) ) break;
138138

139139
sent += TEST_STRLEN;
140140
remaining -= TEST_STRLEN;

libraries/Bluefruit52Lib/src/BLEDiscovery.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,11 @@ bool BLEDiscovery::_discoverService(uint16_t conn_handle, BLEClientService& svc,
8282
int32_t bytecount = _adamsg.waitUntilComplete(BLE_DISCOVERY_TIMEOUT);
8383

8484
// timeout or has no data (due to GATT Error)
85-
if ( bytecount <= 0 ) return false;
85+
if ( bytecount <= 0 )
86+
{
87+
LOG_LV1("DISC", "[SVC] timeout or error", start_handle);
88+
return false;
89+
}
8690

8791
// Check the discovered UUID with input one
8892
if ( (disc_svc.count) && (svc.uuid == disc_svc.services[0].uuid) )

0 commit comments

Comments
 (0)