ble works again after sleep - but we are still leaking

This commit is contained in:
geeksville
2020-02-23 13:20:46 -08:00
parent 5f88174dbf
commit f9ce6a53e1
8 changed files with 61 additions and 2 deletions

View File

@@ -319,3 +319,7 @@ BLEService *createMeshBluetoothService(BLEServer *server)
return service;
}
void destroyMeshBluetoothService() {
meshFromNumCharacteristic = NULL;
}

View File

@@ -5,6 +5,7 @@
#include <Arduino.h>
BLEService *createMeshBluetoothService(BLEServer* server);
void destroyMeshBluetoothService();
/**
* Tell any bluetooth clients that the number of rx packets has changed

View File

@@ -264,6 +264,10 @@ void setup()
void initBluetooth()
{
DEBUG_MSG("Starting bluetooth\n");
// FIXME - we are leaking like crazy
// AllocatorScope scope(btPool);
BLEServer *serve = initBLE(getDeviceName(), HW_VENDOR, str(APP_VERSION)); // FIXME, use a real name based on the macaddr
createMeshBluetoothService(serve);
@@ -284,7 +288,8 @@ void setBluetoothEnable(bool on)
}
else
{
// FIXME - we are leaking like crazy
// We have to totally teardown our bluetooth objects to prevent leaks
destroyMeshBluetoothService();
deinitBLE();
}
}