only run DST helper on certain pumps

This commit is contained in:
Adrian AndroidAPS 2019-03-28 17:25:57 +01:00
parent 1fe529db85
commit cdd3c25929
8 changed files with 44 additions and 1 deletions

View file

@ -65,6 +65,7 @@ public interface PumpInterface {
PumpEnactResult loadTDDs();
public boolean canHandleDST();
List<CustomAction> getCustomActions();

View file

@ -12,8 +12,10 @@ import info.nightscout.androidaps.interfaces.ConstraintsInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PluginDescription;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.general.overview.notifications.Notification;
import info.nightscout.androidaps.utils.T;
@ -92,12 +94,19 @@ public class DstHelperPlugin extends PluginBase implements ConstraintsInterface
//Return false if time to DST change is less than 91 and positive
@Override
public Constraint<Boolean> isLoopInvocationAllowed(Constraint<Boolean> value) {
PumpInterface pump = ConfigBuilderPlugin.getPlugin().getActivePump();
if (pump == null || pump.canHandleDST()) {
log.debug("Pump can handle DST");
return value;
}
try {
this.dstTest(Calendar.getInstance());
} catch (Exception e) {
e.printStackTrace();
}
if (this.minutesToChange <= 90 && minutesToChange > 0 && value.value()) {
if (this.minutesToChange <= 180 && minutesToChange > 0 && value.value()) {
try {
LoopPlugin loopPlugin = LoopPlugin.getPlugin();
if (loopPlugin.suspendedTo() == 0L) {

View file

@ -1391,4 +1391,9 @@ public class ComboPlugin extends PluginBase implements PumpInterface, Constraint
}
@Override
public boolean canHandleDST() {
return false;
}
}

View file

@ -488,4 +488,12 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
}
@Override
public boolean canHandleDST() {
return false;
}
}

View file

@ -827,4 +827,9 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
}
@Override
public boolean canHandleDST() {
return false;
}
}

View file

@ -1569,4 +1569,9 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
Notification notification = new Notification(Notification.INSIGHT_TIMEOUT_DURING_HANDSHAKE, MainApp.gs(R.string.timeout_during_handshake), Notification.URGENT);
new Handler(Looper.getMainLooper()).post(() -> MainApp.bus().post(new EventNewNotification(notification)));
}
@Override
public boolean canHandleDST() {
return true;
}
}

View file

@ -260,4 +260,9 @@ public class MDIPlugin extends PluginBase implements PumpInterface {
}
@Override
public boolean canHandleDST() {
return true;
}
}

View file

@ -455,6 +455,11 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
return pumpType;
}
@Override
public boolean canHandleDST() {
return true;
}
public void refreshConfiguration() {
String pumptype = SP.getString(R.string.key_virtualpump_type, "Generic AAPS");