From 381323011ef9b98bbef3da4e104fd4b0efed3629 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Thu, 24 Nov 2016 18:52:58 +0100 Subject: [PATCH] Pebble 2: work around FW installation problems Wait a 0.5s after each complete Pebble packet and do not longer wait at all after a completed GATT package chunk (was 0.1s) Big outgoing messages will be now much faster such as firmware installations but smaller take more time than before. (This is not the proper fix but I could update the firmware this way, failed 10 times before after a few percent) --- .../service/devices/pebble/ble/PebbleGATTServer.java | 5 ----- .../service/devices/pebble/ble/PebbleLESupport.java | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTServer.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTServer.java index c6c245b4..b762f87f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTServer.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleGATTServer.java @@ -57,12 +57,7 @@ class PebbleGATTServer extends BluetoothGattServerCallback { LOG.info("send data to pebble " + GB.hexdump(data, 0, -1)); writeCharacteristics.setValue(data.clone()); - mBluetoothGattServer.notifyCharacteristicChanged(mBtDevice, writeCharacteristics, false); - try { - Thread.sleep(100); // FIXME: bad bad, I mean BAAAD - } catch (InterruptedException ignore) { - } } synchronized private void sendAckToPebble(int serial) { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java index 449b76d9..2346dab3 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/ble/PebbleLESupport.java @@ -126,6 +126,11 @@ public class PebbleLESupport { payloadToSend -= chunkSize; } + try { + Thread.sleep(500); // FIXME ugly wait 0.5s after each pebble package send to the pebble (we do not wait for the GATT chunks) + } catch (InterruptedException ignore) { + } + } catch (IOException e) { LOG.warn("IO exception"); mQuit = true;