3838#include " utility/bonding.h"
3939
4040#ifndef CFG_BLE_TX_POWER_LEVEL
41- #define CFG_BLE_TX_POWER_LEVEL 0
41+ #define CFG_BLE_TX_POWER_LEVEL 0
4242#endif
4343
4444#ifndef CFG_DEFAULT_NAME
45- #define CFG_DEFAULT_NAME " Bluefruit52"
45+ #define CFG_DEFAULT_NAME " Bluefruit52"
4646#endif
4747
48-
4948#ifndef CFG_BLE_TASK_STACKSIZE
50- #define CFG_BLE_TASK_STACKSIZE ( 512 * 3 )
49+ #define CFG_BLE_TASK_STACKSIZE ( 256 * 5 )
5150#endif
5251
5352#ifndef CFG_SOC_TASK_STACKSIZE
54- #define CFG_SOC_TASK_STACKSIZE (200 )
53+ #define CFG_SOC_TASK_STACKSIZE (200 )
5554#endif
5655
5756#ifdef USE_TINYUSB
@@ -103,7 +102,6 @@ static void bluefruit_blinky_cb( TimerHandle_t xTimer )
103102 digitalToggle (LED_BLUE);
104103}
105104
106-
107105static void nrf_error_cb (uint32_t id, uint32_t pc, uint32_t info)
108106{
109107#if CFG_DEBUG
@@ -743,13 +741,14 @@ void adafruit_ble_task(void* arg)
743741{
744742 (void ) arg;
745743
744+ // malloc buffered is algined by 4
746745 uint8_t * ev_buf = (uint8_t *) rtos_malloc (BLE_EVT_LEN_MAX (BLE_GATT_ATT_MTU_MAX));
747746
748747 while (1 )
749748 {
750749 if ( xSemaphoreTake (Bluefruit._ble_event_sem , portMAX_DELAY) )
751750 {
752- uint32_t err = ERROR_NONE ;
751+ uint32_t err = NRF_SUCCESS ;
753752
754753 // Until no pending events
755754 while ( NRF_ERROR_NOT_FOUND != err )
@@ -759,10 +758,13 @@ void adafruit_ble_task(void* arg)
759758 // Get BLE Event
760759 err = sd_ble_evt_get (ev_buf, &ev_len);
761760
762- // Handle valid event, ignore error
763- if ( ERROR_NONE == err)
761+ // Handle valid event
762+ if ( NRF_SUCCESS == err)
764763 {
765764 Bluefruit._ble_handler ( (ble_evt_t *) ev_buf );
765+ }else if ( NRF_ERROR_NOT_FOUND != err )
766+ {
767+ LOG_LV1 (" BLE" , " SD event error %s" , dbg_err_str (err));
766768 }
767769 }
768770 }
0 commit comments