From 76c2a18af51c2efb9c9868ad5cd0f3d83cc956c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sun, 8 Oct 2023 13:49:16 +0100 Subject: [PATCH] Mi Band 8: Add realtime stats failsafe --- .../devices/xiaomi/services/XiaomiHealthService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiHealthService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiHealthService.java index 6735cffe6..70f2cd1fd 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiHealthService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/xiaomi/services/XiaomiHealthService.java @@ -425,6 +425,12 @@ public class XiaomiHealthService extends AbstractXiaomiService { private void handleRealtimeStats(final XiaomiProto.RealTimeStats realTimeStats) { LOG.debug("Got realtime stats"); + if (!realtimeOneShot && !realtimeStarted) { + // Failsafe in case it gets out of sync, stop it + enableRealtimeStats(false); + return; + } + if (realtimeOneShot) { if (realTimeStats.getHeartRate() <= 10) { return;