From 620470d5dc2e23fa5f0ef4fa0fd5b5d9f116f92e Mon Sep 17 00:00:00 2001 From: hathach Date: Sun, 8 Apr 2018 13:43:26 +0700 Subject: [PATCH] fix #142 add destructor for SoftwareTimer --- cores/nRF5/utility/SoftwareTimer.h | 3 ++- libraries/Bluefruit52Lib/src/BLECentral.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cores/nRF5/utility/SoftwareTimer.h b/cores/nRF5/utility/SoftwareTimer.h index 5d535526..0651ab06 100644 --- a/cores/nRF5/utility/SoftwareTimer.h +++ b/cores/nRF5/utility/SoftwareTimer.h @@ -44,7 +44,8 @@ class SoftwareTimer TimerHandle_t _handle; public: - SoftwareTimer() { _handle = NULL; } + SoftwareTimer() { _handle = NULL; } + virtual ~SoftwareTimer() { if(_handle != NULL) xTimerDelete(_handle, 0); } void begin(uint32_t ms, TimerCallbackFunction_t callback) { diff --git a/libraries/Bluefruit52Lib/src/BLECentral.cpp b/libraries/Bluefruit52Lib/src/BLECentral.cpp index b71a86d5..2f25c65c 100644 --- a/libraries/Bluefruit52Lib/src/BLECentral.cpp +++ b/libraries/Bluefruit52Lib/src/BLECentral.cpp @@ -165,7 +165,7 @@ void BLECentral::_event_handler(ble_evt_t* evt) case BLE_GAP_EVT_DISCONNECTED: if ( Bluefruit.Gap.getRole(evt_conn_hdl) == BLE_GAP_ROLE_CENTRAL) { - // Invoke callback + // Invoke callback reason is BLE_HCI_STATUS code if ( _disconnect_cb) ada_callback(NULL, _disconnect_cb, evt_conn_hdl, evt->evt.gap_evt.params.disconnected.reason); } break;