mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-23 10:17:37 +00:00
still leaking in the BT stack but better
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user