mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-22 08:13:43 +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:
@@ -491,6 +491,15 @@ public abstract class BluetoothCommunication {
|
|||||||
descriptorRequestQueue = new LinkedList<>();
|
descriptorRequestQueue = new LinkedList<>();
|
||||||
openRequest = false;
|
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;
|
btMachineState = BT_MACHINE_STATE.BT_INIT_STATE;
|
||||||
nextMachineStateStep();
|
nextMachineStateStep();
|
||||||
|
Reference in New Issue
Block a user