RS: prevent carbs x insulin
This commit is contained in:
parent
8f641f994f
commit
357b947c1d
1 changed files with 3 additions and 1 deletions
|
@ -57,6 +57,7 @@ import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
import info.nightscout.utils.T;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.09.2017.
|
* Created by mike on 03.09.2017.
|
||||||
|
@ -411,6 +412,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
double carbs = detailedBolusInfo.carbs;
|
double carbs = detailedBolusInfo.carbs;
|
||||||
detailedBolusInfo.carbs = 0;
|
detailedBolusInfo.carbs = 0;
|
||||||
int carbTime = detailedBolusInfo.carbTime;
|
int carbTime = detailedBolusInfo.carbTime;
|
||||||
|
if (carbTime == 0) carbTime--; // better set 1 min back to prevents clash with insulin
|
||||||
detailedBolusInfo.carbTime = 0;
|
detailedBolusInfo.carbTime = 0;
|
||||||
|
|
||||||
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
DetailedBolusInfoStorage.add(detailedBolusInfo); // will be picked up on reading history
|
||||||
|
@ -419,7 +421,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
||||||
t.isSMB = detailedBolusInfo.isSMB;
|
t.isSMB = detailedBolusInfo.isSMB;
|
||||||
boolean connectionOK = false;
|
boolean connectionOK = false;
|
||||||
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
if (detailedBolusInfo.insulin > 0 || carbs > 0)
|
||||||
connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + carbTime * 60 * 1000, t);
|
connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + T.mins(carbTime).msecs(), t);
|
||||||
PumpEnactResult result = new PumpEnactResult();
|
PumpEnactResult result = new PumpEnactResult();
|
||||||
result.success = connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep;
|
result.success = connectionOK && Math.abs(detailedBolusInfo.insulin - t.insulin) < pumpDescription.bolusStep;
|
||||||
result.bolusDelivered = t.insulin;
|
result.bolusDelivered = t.insulin;
|
||||||
|
|
Loading…
Reference in a new issue