From c5528c8d5d03f378448c3880d7594cbf6f121f1e Mon Sep 17 00:00:00 2001
From: Johannes Mockenhaupt <git@jotomo.de>
Date: Tue, 27 Jun 2017 16:17:41 +0200
Subject: [PATCH] Bugfix: use SGV timestamp in calculation for next poll.

Previously the PumpStatus' event date was used to calculate the next poll.
Up untill change 045bebb3a2021b523631deec76e8b8d47f7112dc, this date was
set from the SGV date we got from the pump, see
https://github.com/jotomo/600SeriesAndroidUploader/commit/045bebb3a2021b523631deec76e8b8d47f7112dc#diff-20721b0d1f2575ca0cce44c52a932d36L193
After that change, the event date property is the time the record was created.
Hence, now the sgvDate property must be used to acquire the timestamp
of the SGV to calculate the next poll time properly.
---
 .../android/medtronic/service/MedtronicCnlIntentService.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/src/main/java/info/nightscout/android/medtronic/service/MedtronicCnlIntentService.java b/app/src/main/java/info/nightscout/android/medtronic/service/MedtronicCnlIntentService.java
index 2a332a9..943c22e 100644
--- a/app/src/main/java/info/nightscout/android/medtronic/service/MedtronicCnlIntentService.java
+++ b/app/src/main/java/info/nightscout/android/medtronic/service/MedtronicCnlIntentService.java
@@ -108,7 +108,7 @@ public class MedtronicCnlIntentService extends IntentService {
 
             long timePollStarted = System.currentTimeMillis(),
                     timePollExpected = timePollStarted,
-                    timeLastGoodSGV = dataStore.getLastPumpStatus().getEventDate().getTime();
+                    timeLastGoodSGV = dataStore.getLastPumpStatus().getSgvDate().getTime();
 
             short pumpBatteryLevel = dataStore.getLastPumpStatus().getBatteryPercentage();
 
-- 
GitLab