From fa070579be502d525ffca5b1c7385d299fc3aa4b Mon Sep 17 00:00:00 2001 From: Arjan Schrijver Date: Mon, 2 Sep 2024 22:34:32 +0200 Subject: [PATCH] Moyoung: Fix HR history packet parsing and activity sample provider --- .../moyoung/samples/MoyoungActivitySampleProvider.java | 7 ++++++- .../service/devices/moyoung/MoyoungDeviceSupport.java | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/samples/MoyoungActivitySampleProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/samples/MoyoungActivitySampleProvider.java index 4864b730a..d6903a12f 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/samples/MoyoungActivitySampleProvider.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/moyoung/samples/MoyoungActivitySampleProvider.java @@ -165,7 +165,12 @@ public class MoyoungActivitySampleProvider extends AbstractSampleProvider samples = super.getGBActivitySamples(timestamp_from, timestamp_to); + final List samples = fillGaps( + super.getGBActivitySamples(timestamp_from, timestamp_to), + timestamp_from, + timestamp_to + ); + final Map sampleByTs = new HashMap<>(); for (final MoyoungActivitySample sample : samples) { sampleByTs.put(sample.getTimestamp(), sample); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java index 1a4f78d24..20a67c901 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/moyoung/MoyoungDeviceSupport.java @@ -701,13 +701,14 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport { final Calendar cal = Calendar.getInstance(); cal.add(Calendar.DAY_OF_MONTH, -daysAgo); cal.set(Calendar.SECOND, 0); + LOG.info("Received HR history packet: index={}, daysAgo={}, startHour={}", packetIndex, daysAgo, startHour); int index = 1; for (int hour=startHour; hour