From 76cf6672021c46c3f76a0a723494dff35b67567a Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sat, 20 Jan 2018 01:34:40 +0100 Subject: [PATCH] Amazfit Bip, do not set menu items during initializaton (This could prevent menus from vanishing when updating to FW 0.1.0.51) --- .../devices/amazfitbip/AmazfitBipSupport.java | 16 ++++++++++++++++ .../service/devices/miband2/MiBand2Support.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java index 428226f20..c10728ae6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java @@ -53,6 +53,8 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.miband2.MiBand2Suppo import nodomain.freeyourgadget.gadgetbridge.util.StringUtils; import nodomain.freeyourgadget.gadgetbridge.util.Version; +import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBand2Service.ENDPOINT_DISPLAY_ITEMS; + public class AmazfitBipSupport extends MiBand2Support { private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSupport.class); @@ -122,6 +124,19 @@ public class AmazfitBipSupport extends MiBand2Support { // ignore } + @Override + protected AmazfitBipSupport setDisplayItems(TransactionBuilder builder) { + /* + LOG.info("Enabling all display items"); + + // This will brick the watch, don't enable it! + byte[] data = new byte[]{ENDPOINT_DISPLAY_ITEMS, (byte) 0xff, 0x01, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08}; + + builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), data); + */ + return this; + } + @Override public void onSendWeather(WeatherSpec weatherSpec) { if (gbDevice.getFirmwareVersion() == null) { @@ -320,6 +335,7 @@ public class AmazfitBipSupport extends MiBand2Support { return this; } + @Override public void phase2Initialize(TransactionBuilder builder) { super.phase2Initialize(builder); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java index 85972ce69..6f1ed3ed6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java @@ -1428,7 +1428,7 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { return this; } - private MiBand2Support setDisplayItems(TransactionBuilder builder) { + protected MiBand2Support setDisplayItems(TransactionBuilder builder) { Set pages = HuamiCoordinator.getDisplayItems(); LOG.info("Setting display items to " + (pages == null ? "none" : pages));