Rv2: prevent carbs x insulin
This commit is contained in:
parent
357b947c1d
commit
97d9f7866c
1 changed files with 3 additions and 1 deletions
|
@ -33,6 +33,7 @@ import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
|||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.T;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
|
@ -195,6 +196,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
double carbs = detailedBolusInfo.carbs;
|
||||
detailedBolusInfo.carbs = 0;
|
||||
int carbTime = detailedBolusInfo.carbTime;
|
||||
if (carbTime == 0) carbTime--; // better set 1 man back to prevent clash with insulin
|
||||
detailedBolusInfo.carbTime = 0;
|
||||
|
||||
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
||||
|
@ -203,7 +205,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
t.isSMB = detailedBolusInfo.isSMB;
|
||||
boolean connectionOK = false;
|
||||
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
||||
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + carbTime * 60 * 1000, t);
|
||||
connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + T.mins(carbTime).msecs(), t);
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep;
|
||||
result.bolusDelivered = t.insulin;
|
||||
|
|
Loading…
Reference in a new issue