1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-18 22:57:48 +01:00

Amazgit GTR/GTR Lite: Try to fix broken activity data

Query versions as described in #1907
Also see #1924
This commit is contained in:
Andreas Shimokawa 2020-07-23 22:05:28 +02:00
parent ef09e24482
commit 932b0f7f94
2 changed files with 24 additions and 0 deletions

View File

@ -25,6 +25,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRLiteFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRLiteFWHelper;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder; import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport;
import nodomain.freeyourgadget.gadgetbridge.util.Version;
public class AmazfitGTRLiteSupport extends AmazfitGTSSupport { public class AmazfitGTRLiteSupport extends AmazfitGTSSupport {
@ -39,4 +40,15 @@ public class AmazfitGTRLiteSupport extends AmazfitGTSSupport {
super.phase2Initialize(builder); super.phase2Initialize(builder);
setLanguage(builder); setLanguage(builder);
} }
@Override
protected void handleDeviceInfo(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.deviceinfo.DeviceInfo info) {
super.handleDeviceInfo(info);
if (gbDevice.getFirmwareVersion() != null) {
Version version = new Version(gbDevice.getFirmwareVersion());
if (version.compareTo(new Version("1.0.0.33")) >= 0) {
mActivitySampleSize = 8;
}
}
}
} }

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRFWHelper;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport;
import nodomain.freeyourgadget.gadgetbridge.util.Version;
public class AmazfitGTRSupport extends AmazfitGTSSupport { public class AmazfitGTRSupport extends AmazfitGTSSupport {
@ -32,4 +33,15 @@ public class AmazfitGTRSupport extends AmazfitGTSSupport {
return new AmazfitGTRFWHelper(uri, context); return new AmazfitGTRFWHelper(uri, context);
} }
@Override
protected void handleDeviceInfo(nodomain.freeyourgadget.gadgetbridge.service.btle.profiles.deviceinfo.DeviceInfo info) {
super.handleDeviceInfo(info);
if (gbDevice.getFirmwareVersion() != null) {
Version version = new Version(gbDevice.getFirmwareVersion());
if (version.compareTo(new Version("1.3.5.79")) >= 0 || // For GTR 47mm
(version.compareTo(new Version("1.0.0.00")) < 0 && version.compareTo(new Version("0.1.1.15")) >= 0)) { // for GTR 32mm with a different version scheme
mActivitySampleSize = 8;
}
}
}
} }