Merge branch 'dev' of https://github.com/nightscout/AndroidAPS into dev
This commit is contained in:
commit
59a331fbf0
|
@ -41,7 +41,7 @@ buildscript {
|
||||||
maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2
|
maven { url "https://plugins.gradle.org/m2/" } // jacoco 0.2
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.2'
|
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,9 @@ import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
|
import org.joda.time.Days;
|
||||||
import org.joda.time.Duration;
|
import org.joda.time.Duration;
|
||||||
|
import org.joda.time.Instant;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
// variables for handling statuses and history
|
// variables for handling statuses and history
|
||||||
private boolean firstRun = true;
|
private boolean firstRun = true;
|
||||||
private boolean hasTimeDateOrTimeZoneChanged = false;
|
private boolean hasTimeDateOrTimeZoneChanged = false;
|
||||||
|
private Instant lastTimeDateOrTimeZoneUpdate = Instant.ofEpochSecond(0L);
|
||||||
private final boolean displayConnectionMessages = false;
|
private final boolean displayConnectionMessages = false;
|
||||||
private RileyLinkOmnipodService rileyLinkOmnipodService;
|
private RileyLinkOmnipodService rileyLinkOmnipodService;
|
||||||
private boolean busy = false;
|
private boolean busy = false;
|
||||||
|
@ -958,15 +961,18 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements Pump, Riley
|
||||||
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
||||||
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodErosManager.isTimeChangeEventEnabled() + "]");
|
aapsLogger.info(LTag.PUMP, "Time, Date and/or TimeZone changed. [changeType=" + timeChangeType.name() + ", eventHandlingEnabled=" + aapsOmnipodErosManager.isTimeChangeEventEnabled() + "]");
|
||||||
|
|
||||||
if (timeChangeType == TimeChangeType.TimeChanged) {
|
Instant now = Instant.now();
|
||||||
aapsLogger.info(LTag.PUMP, "Ignoring time change because it is not a DST or TZ change");
|
if (timeChangeType == TimeChangeType.TimeChanged && now.isBefore(lastTimeDateOrTimeZoneUpdate.plus(Duration.standardDays(1L)))){
|
||||||
|
aapsLogger.info(LTag.PUMP, "Ignoring time change because not a TZ or DST time change and the last one happened less than 24 hours ago.");
|
||||||
return;
|
return;
|
||||||
} else if (!podStateManager.isPodRunning()) {
|
}
|
||||||
|
if (!podStateManager.isPodRunning()) {
|
||||||
aapsLogger.info(LTag.PUMP, "Ignoring time change because no Pod is active");
|
aapsLogger.info(LTag.PUMP, "Ignoring time change because no Pod is active");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
aapsLogger.info(LTag.PUMP, "DST and/or TimeZone changed event will be consumed by driver");
|
aapsLogger.info(LTag.PUMP, "DST and/or TimeZone changed event will be consumed by driver");
|
||||||
|
lastTimeDateOrTimeZoneUpdate = now;
|
||||||
hasTimeDateOrTimeZoneChanged = true;
|
hasTimeDateOrTimeZoneChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue