-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
In LoopDataManager.swift
Afaict from the code, lastBolus is set if a Bolus has been successfully enacted. In insulinEffect, didSet the lastBolus var is cleared if it is older than 5 minutes.
There seems to be no mechanism which makes sure the Bolus has actually been read from the pump event history (or reservoir data). Hence if this doesn't happen and the user Bolus again there is a potential for going low.
Second issue I see is that if a user bolus' again within the 5 minute window, the last one is silently overwritten. So if let's say the first one is 3 Units, the second one 1 Unit, and the user enters another Carb-Meal, it will only substract the 1 Unit, not 4 Units from the calculated amount.
I'd think there are at least two different ways of fixing this:
- don't allow Bolus until the full eventHistory (or reservoir state) has been read back again, and a full loop has been completed (most safe probably)
- record bolus directly in doseStore and replace later, when the pump history has been synced beyond this point.
In any case, this should probably be addressed rather soon if someone can confirm this is actually a problem.