1
0
mirror of https://github.com/oliexdev/openScale.git synced 2025-08-21 07:51:46 +02:00

Improve bluetooth connection sequence

By adding a sleep after the service discovery I can now connect every
time to the scale, something that didn't work before.
This commit is contained in:
Erik Johansson
2018-04-12 19:34:07 +02:00
parent cd766701ff
commit 8ff4e1e945

View File

@@ -491,6 +491,15 @@ public abstract class BluetoothCommunication {
descriptorRequestQueue = new LinkedList<>();
openRequest = false;
try {
// Sleeping a while after discovering services fixes connection problems.
// See https://github.com/NordicSemiconductor/Android-DFU-Library/issues/10
// for some technical background.
Thread.sleep(1000);
}
catch (Exception e) {
// Empty
}
btMachineState = BT_MACHINE_STATE.BT_INIT_STATE;
nextMachineStateStep();