diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index afca125092..8dd425b12c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -507,7 +507,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con nextValue = profile.getBasalValues()[i + 1]; if (profileBlock.getDuration() * 60 != (nextValue != null ? nextValue.timeAsSeconds : 24 * 60 * 60) - basalValue.timeAsSeconds) return false; - if (Math.abs(profileBlock.getBasalAmount() - basalValue.value) > (basalValue.value > 5 ? 0.05 : 0.005)) + if (Math.abs(profileBlock.getBasalAmount() - basalValue.value) > (basalValue.value > 5 ? 0.051 : 0.0051)) return false; } return true; @@ -571,6 +571,15 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con detailedBolusInfo.date = insightBolusID.timestamp; detailedBolusInfo.source = Source.PUMP; detailedBolusInfo.pumpId = insightBolusID.id; + if (detailedBolusInfo.carbs > 0 && detailedBolusInfo.carbTime != 0) { + DetailedBolusInfo carbInfo = new DetailedBolusInfo(); + carbInfo.carbs = detailedBolusInfo.carbs; + carbInfo.date = detailedBolusInfo.date + detailedBolusInfo.carbTime * 60L * 1000L; + carbInfo.source = Source.USER; + TreatmentsPlugin.getPlugin().addToHistoryTreatment(carbInfo, false); + detailedBolusInfo.carbTime = 0; + detailedBolusInfo.carbs = 0; + } TreatmentsPlugin.getPlugin().addToHistoryTreatment(detailedBolusInfo, true); while (true) { synchronized ($bolusLock) {