From d1b7b6c5c547eb27a70bf30aa38ee771c978b13e Mon Sep 17 00:00:00 2001 From: geeksville Date: Wed, 4 Mar 2020 15:56:37 -0800 Subject: [PATCH] oops - I was previously stopping bluetooth before stopping the mesh bluetooth service which was bad bad --- src/MeshBluetoothService.cpp | 9 ++++++++- src/MeshBluetoothService.h | 4 ---- src/main.cpp | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/MeshBluetoothService.cpp b/src/MeshBluetoothService.cpp index 0b8cb753..9de5d8bb 100644 --- a/src/MeshBluetoothService.cpp +++ b/src/MeshBluetoothService.cpp @@ -329,10 +329,17 @@ BLEService *createMeshBluetoothService(BLEServer *server) return service; } -void destroyMeshBluetoothService() +void stopMeshBluetoothService() { assert(meshService); meshService->stop(); +} + + + +void destroyMeshBluetoothService() +{ + assert(meshService); delete meshService; meshFromNumCharacteristic = NULL; diff --git a/src/MeshBluetoothService.h b/src/MeshBluetoothService.h index 2231a5fe..426c2cf0 100644 --- a/src/MeshBluetoothService.h +++ b/src/MeshBluetoothService.h @@ -12,8 +12,4 @@ void destroyMeshBluetoothService(); */ void bluetoothNotifyFromNum(uint32_t newValue); -/** - * Super skanky FIXME - when we start a software update we force the mesh service to shutdown. - * If the sw update fails, the user will have to manually reset the board to get things running again. - */ void stopMeshBluetoothService(); \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index f016eb74..c45a01fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -288,6 +288,7 @@ void setBluetoothEnable(bool on) else { // We have to totally teardown our bluetooth objects to prevent leaks + stopMeshBluetoothService(); // Must do before shutting down bluetooth deinitBLE(); destroyMeshBluetoothService(); // must do after deinit, because it frees our service Serial.printf("Shutdown BT: %u heap size\n", ESP.getFreeHeap());