8000 1. Fix ADV data error when disable the debug trace. · sgbihu/corelibs-arduino101@6888c52 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6888c52

Browse files
committed
1. Fix ADV data error when disable the debug trace.
2. Modify some debug trace. 3. Change the pr_debug with Serial in sketch example.
1 parent f48c8aa commit 6888c52

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

libraries/CurieBLE/examples/IMUBleCentral/IMUBleCentral.ino

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ bool adv_found(uint8_t type,
7777
bt_addr_le_t *addr = (bt_addr_le_t *)user_data;
7878
int i;
7979

80-
pr_debug(LOG_MODULE_APP, "[AD]: %u data_len %u\n", type, data_len);
80+
Serial.print("[AD]:");
81+
Serial.print(type);
82+
Serial.print(" data_len ");
83+
Serial.println(data_len);
8184

8285
switch (type)
8386
{
@@ -86,7 +89,7 @@ bool adv_found(uint8_t type,
8689
{
8790
if (data_len % MAX_UUID_SIZE != 0)
8891
{
89-
pr_debug(LOG_MODULE_APP, "AD malformed\n");
92+
Serial.println("AD malformed");
9093
return true;
9194
}
9295
struct bt_uuid * serviceuuid = bleImuService.uuid();
@@ -100,10 +103,10 @@ bool adv_found(uint8_t type,
100103
// Accept the advertisement
101104
if (!bleCentral.stopScan())
102105
{
103-
pr_debug(LOG_MODULE_APP, "Stop LE scan failed\n");
106+
Serial.println("Stop LE scan failed");
104107
continue;
105108
}
106-
pr_debug(LOG_MODULE_APP, "Connecting\n");
109+
Serial.println("Connecting");
107110
// Connect to peripheral
108111
bleCentral.connect(addr, &conn_param);
109112
return false;

libraries/CurieBLE/examples/LEDCentral/LEDCentral.ino

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ bool adv_found(uint8_t type,
7575
bt_addr_le_t *addr = (bt_addr_le_t *)user_data;
7676
int i;
7777

78-
pr_debug(LOG_MODULE_APP, "[AD]: %u data_len %u\n", type, data_len);
78+
Serial.print("[AD]:");
79+
Serial.print(type);
80+
Serial.print(" data_len ");
81+
Serial.println(data_len);
7982

8083
switch (type)
8184
{
@@ -84,7 +87,7 @@ bool adv_found(uint8_t type,
8487
{
8588
if (data_len % MAX_UUID_SIZE != 0)
8689
{
87-
pr_debug(LOG_MODULE_APP, "AD malformed\n");
90+
Serial.println("AD malformed");
8891
return true;
8992
}
9093
struct bt_uuid * serviceuuid = ledService.uuid();
@@ -98,10 +101,10 @@ bool adv_found(uint8_t type,
98101
// Accept the advertisement
99102
if (!bleCentral.stopScan())
100103
{
101-
pr_debug(LOG_MODULE_APP, "Stop LE scan failed\n");
104+
Serial.println("Stop LE scan failed");
102105
continue;
103106
}
104-
pr_debug(LOG_MODULE_APP, "Connecting\n");
107+
Serial.println("Connecting");
105108
// Connect to peripheral
106109
bleCentral.connect(addr, &conn_param);
107110
return false;

libraries/CurieBLE/src/BLEPeripheralRole.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ bool BLEPeripheralRole::begin()
6464

6565
// Register profile
6666
_peripheral.registerProfile();
67+
delay(2); // Temp solution for send data fast will makes ADV data set failed
6768
return true;
6869
}
6970

@@ -221,7 +222,7 @@ void BLEPeripheralRole::handleDisconnectEvent(struct bt_conn *conn, uint8_t reas
221222
struct bt_conn *central_conn = bt_conn_lookup_addr_le(_central.bt_le_address());
222223
if (conn == central_conn)
223224
{
224-
pr_info(LOG_MODULE_BLE, "Disconnect reason: %d", reason);
225+
pr_info(LOG_MODULE_BLE, "Peripheral Disconnect reason: %d", reason);
225226
if (_event_handlers[BLEDisconnected])
226227
_event_handlers[BLEDisconnected](_central);
227228
}

0 commit comments

Comments
 (0)
0