still leaking in the BT stack but better

This commit is contained in:
geeksville
2020-02-23 13:54:40 -08:00
parent f9ce6a53e1
commit a45d7be922
4 changed files with 29 additions and 6 deletions

View File

@@ -236,6 +236,8 @@ void bluetoothNotifyFromNum(uint32_t newValue)
}
}
BLEService *meshService;
/*
MeshBluetoothService UUID 6ba1b218-15a8-461f-9fa8-5dcae273eafd
@@ -317,9 +319,13 @@ BLEService *createMeshBluetoothService(BLEServer *server)
DEBUG_MSG("*** Mesh service:\n");
service->dump();
meshService = service;
return service;
}
void destroyMeshBluetoothService() {
assert(meshService);
delete meshService;
meshFromNumCharacteristic = NULL;
}

View File

@@ -284,6 +284,7 @@ void setBluetoothEnable(bool on)
bluetoothOn = on;
if (on)
{
Serial.printf("Pre BT: %u heap size", ESP.getFreeHeap());
initBluetooth();
}
else
@@ -291,6 +292,7 @@ void setBluetoothEnable(bool on)
// We have to totally teardown our bluetooth objects to prevent leaks
destroyMeshBluetoothService();
deinitBLE();
Serial.printf("Shutdown BT: %u heap size", ESP.getFreeHeap());
}
}
}