diff --git a/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java b/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java index cd5df466f0..bd924d35b5 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java +++ b/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java @@ -16,6 +16,10 @@ public class IobTotal { public double netbasalinsulin; public double hightempinsulin; + // oref1 + public double microBolusInsulin; + public double microBolusIOB; + public double netInsulin = 0d; // for calculations from temp basals only public double netRatio = 0d; // net ratio at start of temp basal @@ -30,6 +34,8 @@ public class IobTotal { this.basaliob = 0d; this.netbasalinsulin = 0d; this.hightempinsulin = 0d; + this.microBolusInsulin = 0d; + this.microBolusIOB = 0d; this.time = time; } @@ -42,6 +48,8 @@ public class IobTotal { hightempinsulin += other.hightempinsulin; netInsulin += other.netInsulin; extendedBolusInsulin += other.extendedBolusInsulin; + microBolusInsulin += other.microBolusInsulin; + microBolusIOB += other.microBolusIOB; return this; } @@ -53,6 +61,8 @@ public class IobTotal { result.basaliob = basalIob.basaliob; result.netbasalinsulin = basalIob.netbasalinsulin; result.hightempinsulin = basalIob.hightempinsulin; + result.microBolusInsulin = bolusIOB.microBolusInsulin + basalIob.microBolusInsulin; + result.microBolusIOB = bolusIOB.microBolusIOB + basalIob.microBolusIOB; return result; } @@ -63,6 +73,8 @@ public class IobTotal { this.basaliob = Round.roundTo(this.basaliob, 0.001); this.netbasalinsulin = Round.roundTo(this.netbasalinsulin, 0.001); this.hightempinsulin = Round.roundTo(this.hightempinsulin, 0.001); + this.microBolusInsulin = Round.roundTo(this.microBolusInsulin, 0.001); + this.microBolusIOB = Round.roundTo(this.microBolusIOB, 0.001); return this; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 8a999cbcd6..34fca17d27 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -183,8 +183,13 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface { Iob tIOB = t.iobCalc(time, dia); total.iob += tIOB.iobContrib; total.activity += tIOB.activityContrib; - Iob bIOB = t.iobCalc(time, dia / SP.getDouble("openapsama_bolussnooze_dia_divisor", 2.0)); - total.bolussnooze += bIOB.iobContrib; + if (!t.isSMB) { + Iob bIOB = t.iobCalc(time, dia / SP.getDouble("openapsama_bolussnooze_dia_divisor", 2.0)); + total.bolussnooze += bIOB.iobContrib; + } else { + total.basaliob += t.insulin; + total.microBolusIOB += tIOB.iobContrib; + } } if (!MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())