From 1f8cfa5a682138203758f25ade39b537496c5a49 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Tue, 20 Sep 2016 21:49:27 +0200 Subject: [PATCH] Vibratissimo: clear queue when setting vibration --- .../gadgetbridge/activities/VibrationActivity.java | 4 +++- .../service/devices/vibratissimo/VibratissimoSupport.java | 1 + app/src/main/res/layout/activity_vibration.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/VibrationActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/VibrationActivity.java index e8b85102..888fabae 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/VibrationActivity.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/VibrationActivity.java @@ -44,7 +44,9 @@ public class VibrationActivity extends GBActivity { seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { - LOG.info("changed to:" + progress); + if (progress > 0) { // 1-16 + progress = progress * 16 - 1; // max 255 + } GBApplication.deviceService().onSetConstantVibration(progress); } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java index ebe1d5e1..d72c144e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/vibratissimo/VibratissimoSupport.java @@ -215,6 +215,7 @@ public class VibratissimoSupport extends AbstractBTLEDeviceSupport { @Override public void onSetConstantVibration(int intensity) { + getQueue().clear(); BluetoothGattCharacteristic characteristic2 = getCharacteristic(UUID.fromString("00001526-1212-efde-1523-785feabcd123")); BluetoothGattCharacteristic characteristic1 = getCharacteristic(UUID.fromString("00001524-1212-efde-1523-785feabcd123")); diff --git a/app/src/main/res/layout/activity_vibration.xml b/app/src/main/res/layout/activity_vibration.xml index c8e3ee04..4a2a5ac6 100644 --- a/app/src/main/res/layout/activity_vibration.xml +++ b/app/src/main/res/layout/activity_vibration.xml @@ -10,7 +10,7 @@ \ No newline at end of file