Skip to content

Conversation

marionbarker
Copy link
Collaborator

Purpose:

Fix the corner case where a pod fault is treated as an unacknowledged command during an interrupted bolus and the undelivered insulin is subtracted twice from the original bolus amount.

This was reported for both Trio and Loop (the two apps use a common set of OmniBLE and OmniKit modules):

Method

  • Recognize that getting a fault return from a pod, 0x202, should not be treated the same as not getting a podStatus return, 0x1d return. In other words, this is not an unacknowledged command.

  • Make sure the interrupted bolus is handled in only one place.

  • Ensure that the delivered insulin can never be negative.

Test

This was tested by @itsmojo who provided the code modification. Once the PR are in place, this will be tested again.

+ Clear unacknowledgedCommand on a fault return from non-status command
+ Rework to correctly handle previous unacknowledgedCommand on pod fault
+ Guard against negative bolus if dose cancel is called incorrectly
@marionbarker marionbarker requested review from itsmojo and ps2 June 29, 2025 20:15
Copy link

@itsmojo itsmojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a lot of testing of this for a # of corner cases involving interrupted boluses and unacknowledged commands that were previously incorrectly handled which are now all handled correctly in all cases with this changes.

@marionbarker
Copy link
Collaborator Author

Test

Do the testing on the OmniBLE repo and then approve the other OmniXXX repo by similarity.

Configuration:

  • iPhone SE 3rd gen running iOS 18.5
  • rPi DASH simulator

Reproduce the Issue reported in Loop and Trio

Build using LoopWorkspace dev (OmniBLE dev branch).

  • Issue a 3 U bolus
  • Use the front end to trigger an 0x18 fault during the bolus
  • Wait for reconciliation
  • The 3 U interrupted bolus was reported as -0.3 U of 1.35 U
  • Examine the 0x202 fault response from the pod:
pkg response 0x2; HEX, 17c2c44608180216020d0600210100b618000c03ff000c000018000000000000

Use the parser to report what that HEX means:

  pulses_not_delivered =   33
  insulin_not_delivered =   1.65

This show the "not delivered" amount was subtracted twice when the reconciliation took place:

  • 3.0 U - 1.65 -1.65 = -0.3 U

Demonstrate the new code fixes the issue

Build using LoopWorkspace with OmniBLE fix/unacknowledged-command-with-pod-fault branch:

  • Issue a 3 U bolus
  • Use the front end to trigger an 0x18 fault during the bolus
  • Wait for reconciliation
  • The 3 U interrupted bolus was reported as 1.2 U of 3 U
  • Examine the 0x202 fault response from the pod:
pkg response 0x2; HEX, 17c2c44514180216020d0500240200c2180c4403ff0c44000018000000000000

Use the parser to report what that HEX means:

  pulses_not_delivered =   36
  insulin_not_delivered =   1.8

This show the "not delivered" amount was reported correctly:

  • 3.0 U - 1.8 = 1.2 U

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.

2 participants