From 4ffd8d1c91ce7c985e673182c142d5f191b0d3ee Mon Sep 17 00:00:00 2001 From: JF Date: Fri, 6 Mar 2020 21:50:29 +0100 Subject: [PATCH] Call ble_manager_init_peer_manager() _after_ the scheduler has been started. This fixes an issue that would prevent the firmware from running correctly after a full reset or after the flashing of the firmware. Before this fix, ble_manager_init_peer_manager() was called before the scheduler, which trigged an assert in an IRQ routine. --- src/BLE/BleManager.c | 1 - src/BLE/BleManager.h | 1 + src/SystemTask/SystemTask.cpp | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BLE/BleManager.c b/src/BLE/BleManager.c index 22bf5b68..cf56dd48 100644 --- a/src/BLE/BleManager.c +++ b/src/BLE/BleManager.c @@ -93,7 +93,6 @@ void ble_manager_init() { ble_manager_init_gatt(); ble_manager_init_db_discovery(); ble_manager_init_advertising(); - ble_manager_init_peer_manager(); ble_manager_init_services(); ble_manager_init_connection_params(); } diff --git a/src/BLE/BleManager.h b/src/BLE/BleManager.h index 68fdff9a..4424d665 100644 --- a/src/BLE/BleManager.h +++ b/src/BLE/BleManager.h @@ -34,6 +34,7 @@ extern "C" { void ble_manager_init(); void ble_manager_start_advertising(void *p_erase_bonds); +void ble_manager_init_peer_manager(); // TODO use signals from RTOS to notify new time void ble_manager_set_new_time_callback(void (*OnNewTime)(current_time_char_t* currentTime)); diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index e15846da..ca0c71e1 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -34,6 +34,7 @@ void SystemTask::Work() { NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); APP_GPIOTE_INIT(2); bool erase_bonds=false; + ble_manager_init_peer_manager(); nrf_sdh_freertos_init(ble_manager_start_advertising, &erase_bonds); spi.Init();