From f6ef72e9fb7c19f824ad423bf8896bbe28ce7c26 Mon Sep 17 00:00:00 2001 From: Andreas Shimokawa Date: Sun, 20 Sep 2015 18:27:41 +0200 Subject: [PATCH] Pebble: fix some hardware revision strings to match strings in firmware json file This should enable firmware upgrade on Pebble Time and might fix pbw installation on Pebble Time Steel --- .../service/devices/pebble/PebbleIoThread.java | 2 +- .../service/devices/pebble/PebbleProtocol.java | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java index f8628ba4f..9714143d6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleIoThread.java @@ -541,7 +541,7 @@ public class PebbleIoThread extends GBDeviceIoThread { return; } - mPBWReader = new PBWReader(uri, getContext(), gbDevice.getHardwareVersion().equals("dvt") ? "basalt" : "aplite"); + mPBWReader = new PBWReader(uri, getContext(), gbDevice.getHardwareVersion().startsWith("snowy") ? "basalt" : "aplite"); mPebbleInstallables = mPBWReader.getPebbleInstallables(); mCurrentInstallableIndex = 0; diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java index d5d48c5d0..6a4446ae9 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleProtocol.java @@ -214,7 +214,8 @@ public class PebbleProtocol extends GBDeviceProtocol { static final byte LENGTH_UUID = 16; - private static final String[] hwRevisions = {"unknown", "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", "evt2", "dvt"}; + // base is -4 + private static final String[] hwRevisions = {"snowy_bb2", "snowy_bb", "bb2", "bb", "unknown", "ev1", "ev2", "ev2_3", "ev2_4", "v1_5", "v2_0", "snowy_evt2", "snowy_dvt", "unknown", "snowy_s3"}; private static Random mRandom = new Random(); boolean isFw3x = false; @@ -1578,10 +1579,8 @@ public class PebbleProtocol extends GBDeviceProtocol { buf.get(tmp, 0, 9); Byte hwRev = buf.get(); - if (hwRev > 0 && hwRev < hwRevisions.length) { - versionCmd.hwVersion = hwRevisions[hwRev]; - } else if (hwRev == -3) { // basalt emulator - versionCmd.hwVersion = "dvt"; + if (hwRev >= -4 && hwRev < hwRevisions.length - 4) { + versionCmd.hwVersion = hwRevisions[hwRev+4]; } devEvts = new GBDeviceEvent[]{versionCmd}; break;