Skip to content

Store updated doses immediately before a pod fault is reported - #119

Open
itsmojo wants to merge 1 commit into
loopandlearn:next-devfrom
itsmojo:immediate-fault-dosing
Open

Store updated doses immediately before a pod fault is reported#119
itsmojo wants to merge 1 commit into
loopandlearn:next-devfrom
itsmojo:immediate-fault-dosing

Conversation

@itsmojo

@itsmojo itsmojo commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Background

This PR is a follow up to OmnipodKit #99 as suggested in the Possible later change section. With this PR, all updated dose information will be stored immediately before the pod fault is reported to the controlling app. This means that the OS AID app will be able to have all the correct insulin delivery info for its IOB calculation immediately after the the pod fault is first seen by OmnipodKit regardless of which pod command the pod fault information is returned.

Previously in the various flavors of Omni PumpManagers (OmniKit/OmniBLE/OmnipodKit), the updated dosing information was only be stored after a get status was performed returning a pod fault which could potentially be a few minutes after a pod fault was first returned for some other pod command. A case of this was originally reported in Trio Issue 1236 for a cancel bolus command. OmnipodKit #99 made OmnipodKit work as well as OmniBLE for reporting the dosing information after a pod fault is seen during a cancel bolus command, but didn't fix the delayed dosing update in some cases. While the resulting behavior of potentially having to wait for the next get status call or the pod deactivation to have the updated IOB information displayed in the OS AID app is not a fatal flaw, it can cause user distress/confusion. This PR will alleviate this remaining misbehavior.

Description

The needed changes were not that large and are pretty isolated and so by inspection it is pretty clear this code will not change anything before the pod fault occurs and it only comes into effect the one time on the initial transition to a faulted state. There is only on place that handles the initial pod fault to update the dosing and sets the podState's fault member (PodCommsSession.handlePodFault()) and one place that handles updating the podState in the OmniPumpManagerState and notifying the delegate (the OS AID app) of this change (OmniPumpManager.setStateWithResult()) that needed changes so that the store() of the updated but still not finalized doses could be done at the needed time with the various locking and variable constraints.

Testing

The base for testing this code could be the post OmnipodKit #99 for the Bolus, inject Fault, Cancel Bolus case where the dosing info is not updated until the next update cycle. After applying this code from this PR, the dosing and IOB information should be updated immediately when the OS AID app displays the fault instead of having to wait for the next update or pod deactivation.

@itsmojo
itsmojo requested review from marionbarker and ps2 as code owners July 30, 2026 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant