Repository navigation
Stop a bolus at a fault and keep reporting what it left undelivered - #30
Merged
Merged
Conversation
A faulted pod's bolus remaining was counted down to the time the status was read, so a fault read after the bolus's scheduled end reported nothing undelivered, and one read earlier reported less than was left at the fault. A real pod stops delivering at the fault. SetFault now saves the bolus remaining at the fault, takes it back off the delivered total, and ends the bolus. A faulted pod reports the saved amount; clearing the fault forgets it.
# Conflicts: # README.md
# Conflicts: # README.md
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A faulted pod's bolus remaining was counted down to the time the status was read, not the time of the fault. So:
A real pod stops delivering at the fault and reports the same remainder however late it is read. That is what loopandlearn/OmnipodKit#211 handles, and why it couldn't be tested here.
SetFaultnow saves the bolus remaining at the fault, takes it back off the delivered total (and returns it to the reservoir), and ends the bolus. A faulted pod reports the saved amount from then on. A second fault code doesn't take it again, and clearing the fault (0) forgets it.The 80-hour
0x1Cfault, raised when a status is read, still sets only the fault code.New tests in
pkg/pod/state_test.go: a fault 20 s into an 80-pulse bolus reports 70 pulses remaining and reduces delivered by 70; a fault with no bolus running reports none.go test ./...passes.