Bugfix: a BLE sensor disconnect should only replace the aggregator.

Fixes #1799.
This commit is contained in:
Dennis Guse
2024-01-03 21:56:00 +01:00
parent d038f5c33a
commit 80d7f8d92e
4 changed files with 21 additions and 11 deletions
@@ -52,7 +52,11 @@ public class GainManager implements SensorConnector {
String address = PreferencesUtils.getBarometerSensorAddress();
switch (PreferencesUtils.getSensorType(address)) {
case NONE -> driver = null;
case NONE -> {
driver = null;
listener.onRemove(new AggregatorBarometer(null, null));
return;
}
case INTERNAL -> driver = new BarometerInternal(listener);
case REMOTE -> driver =
new BluetoothConnectionManager(
@@ -63,9 +67,7 @@ public class GainManager implements SensorConnector {
default -> throw new RuntimeException("Not implemented");
}
if (driver != null) {
driver.connect(context, handler, address);
}
driver.connect(context, handler, address);
}
private void onDisconnect() {