fix TB & EB is not set

This commit is contained in:
Milos Kozak 2017-09-25 19:38:27 +02:00
parent 73687442c8
commit 8bbee37b70

View file

@ -573,7 +573,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
}
if (percent > getPumpDescription().maxTempPercent)
percent = getPumpDescription().maxTempPercent;
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
if (runningTB != null && runningTB.percentRate == percent) {
result.enacted = false;
result.success = true;
result.isTempCancel = false;
@ -639,7 +640,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
int durationInHalfHours = Math.max(durationInMinutes / 30, 1);
insulin = Round.roundTo(insulin, getPumpDescription().extendedBolusStep * (1 + durationInHalfHours % 1));
PumpEnactResult result = new PumpEnactResult();
if (pump.isExtendedInProgress && Math.abs(pump.extendedBolusAmount - insulin) < getPumpDescription().extendedBolusStep) {
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) {
result.enacted = false;
result.success = true;
result.comment = MainApp.instance().getString(R.string.virtualpump_resultok);
@ -676,7 +678,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
@Override
public PumpEnactResult cancelTempBasal(boolean force) {
PumpEnactResult result = new PumpEnactResult();
if (pump.isTempBasalInProgress) {
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
if (runningTB != null) {
connectIfNotConnected("tempBasalStop");
danaRSService.tempBasalStop();
result.enacted = true;
@ -701,7 +704,8 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
@Override
public PumpEnactResult cancelExtendedBolus() {
PumpEnactResult result = new PumpEnactResult();
if (pump.isExtendedInProgress) {
ExtendedBolus runningEB = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
if (runningEB != null) {
connectIfNotConnected("extendedBolusStop");
danaRSService.extendedBolusStop();
result.enacted = true;