From 3984c869027f511329e33a95e17c26d68ea86951 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 5 Oct 2020 19:48:10 +0700 Subject: [PATCH] fix some warnings remove beacon blocking wait for Serial connection --- cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c | 3 +-- .../Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino | 4 +++- libraries/Bluefruit52Lib/src/BLEPeriph.cpp | 2 +- libraries/Bluefruit52Lib/src/BLESecurity.cpp | 2 ++ libraries/Bluefruit52Lib/src/utility/bonding.cpp | 1 - 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c b/cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c index 44ab0155..ad5c5c58 100644 --- a/cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c +++ b/cores/nRF5/freertos/portable/CMSIS/nrf52/port_cmsis_systick.c @@ -194,8 +194,7 @@ void vPortSuppressTicksAndSleep( TickType_t xExpectedIdleTime ) (void) sd_softdevice_is_enabled(&sd_en); if (sd_en) // (softdevice_handler_is_enabled()) { - uint32_t err_code = sd_app_evt_wait(); - //APP_ERROR_CHECK(err_code); + (void) sd_app_evt_wait(); } else #endif diff --git a/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino b/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino index b645ba52..f7af8c78 100644 --- a/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino +++ b/libraries/Bluefruit52Lib/examples/Peripheral/beacon/beacon.ino @@ -34,7 +34,9 @@ BLEBeacon beacon(beaconUuid, 0x0000, 0x0000, -54); void setup() { Serial.begin(115200); - while ( !Serial ) delay(10); // for nrf52840 with native usb + + // Uncomment to blocking wait for Serial connection + // while ( !Serial ) delay(10); Serial.println("Bluefruit52 Beacon Example"); Serial.println("--------------------------\n"); diff --git a/libraries/Bluefruit52Lib/src/BLEPeriph.cpp b/libraries/Bluefruit52Lib/src/BLEPeriph.cpp index bda4f9cb..78a76391 100644 --- a/libraries/Bluefruit52Lib/src/BLEPeriph.cpp +++ b/libraries/Bluefruit52Lib/src/BLEPeriph.cpp @@ -126,7 +126,7 @@ void BLEPeriph::setDisconnectCallback( ble_disconnect_callback_t fp ) void BLEPeriph::_eventHandler(ble_evt_t* evt) { uint16_t const conn_hdl = evt->evt.common_evt.conn_handle; - BLEConnection* conn = Bluefruit.Connection(conn_hdl); + // BLEConnection* conn = Bluefruit.Connection(conn_hdl); switch ( evt->header.evt_id ) { diff --git a/libraries/Bluefruit52Lib/src/BLESecurity.cpp b/libraries/Bluefruit52Lib/src/BLESecurity.cpp index f0f58cf9..e7893b5b 100644 --- a/libraries/Bluefruit52Lib/src/BLESecurity.cpp +++ b/libraries/Bluefruit52Lib/src/BLESecurity.cpp @@ -374,6 +374,7 @@ void BLESecurity::_eventHandler(ble_evt_t* evt) // - load key and return if bonded previously. // - Else return NULL --> Initiate key exchange ble_gap_evt_sec_info_request_t* sec_info = (ble_gap_evt_sec_info_request_t*) &evt->evt.gap_evt.params.sec_info_request; + (void) sec_info; LOG_LV2("PAIR", "Address: ID = %d, Type = 0x%02X, %02X:%02X:%02X:%02X:%02X:%02X", sec_info->peer_addr.addr_id_peer, sec_info->peer_addr.addr_type, @@ -395,6 +396,7 @@ void BLESecurity::_eventHandler(ble_evt_t* evt) case BLE_GAP_EVT_CONN_SEC_UPDATE: { const ble_gap_conn_sec_t* conn_sec = &evt->evt.gap_evt.params.conn_sec_update.conn_sec; + (void) conn_sec; LOG_LV2("PAIR", "Security Mode = %d, Level = %d", conn_sec->sec_mode.sm, conn_sec->sec_mode.lv); if ( _secured_cb ) diff --git a/libraries/Bluefruit52Lib/src/utility/bonding.cpp b/libraries/Bluefruit52Lib/src/utility/bonding.cpp index 5bef0bec..3023ed97 100644 --- a/libraries/Bluefruit52Lib/src/utility/bonding.cpp +++ b/libraries/Bluefruit52Lib/src/utility/bonding.cpp @@ -97,7 +97,6 @@ void bond_init(void) *------------------------------------------------------------------*/ static void bond_save_keys_dfr (uint8_t role, uint16_t conn_hdl, bond_keys_t const * bkeys) { - uint16_t const ediv = (role == BLE_GAP_ROLE_PERIPH) ? bkeys->own_enc.master_id.ediv : bkeys->peer_enc.master_id.ediv; uint8_t const * mac = bkeys->peer_id.id_addr_info.addr; // Bond store keys using peer mac address e.g 1a2b3c4d5e6f