diff --git a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java index 61dbb1d71d..a0b039ce4b 100644 --- a/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java +++ b/combo/src/main/java/info/nightscout/androidaps/plugins/pump/combo/ComboPlugin.java @@ -69,6 +69,25 @@ import info.nightscout.androidaps.utils.resources.ResourceHelper; import info.nightscout.androidaps.utils.sharedPreferences.SP; /** + * Driver for the Roche Accu-Chek Combo pump, using the ruffy app for BT communication. + * + * For boluses, the logic is to request a bolus and then read it back from the history to see what was + * actually delivered. + * + * TBR-handling doesn't read the pump history. On the pump, TBR records are only created after a TBR has finished. + * So when a TBR is started on the pump, it can't be known when it started until the TBR ends or is cancelled. + * Cancelling would assume a user works against the loop, and creating a temporary TBR (AAPS-side) and updating it + * once a record exists on the pump has other problems, since there's no ID for TBRs, only timestamps. + * For the regular uses where the user doesn't set TBR (or rather infrequently for some special cases), TBRs are + * only changed on the pump for error conditions where the pump is stopped, those need to be synced. + * The approach taken is to create a TBR record in AAPS when AAPS requests a TBR and forego the TBR history on + * the pump entirely. The pump state is refreshed often enough to tolerate not seeing the full length of a TBR + * on the pump if it was changed. Thus, during a pump refresh a new TBR starting now is created in AAPS if a + * mismatch between expected state and actual pump state is detected see {@link #checkAndResolveTbrMismatch(PumpState)}. + * This approach skipped implementing edge-cases that pose no real risk, in part due to limited resources to + * implement every edge-case scenario. Insulin amount given via boluses are significantly higher, so the + * priority was there to make that as safe as possible. + * * Created by mike on 05.08.2016. */ @Singleton