IOB-wait: a manual fingerprick shouldn't count as a live loop - #74
Open
Sjoerd-Bo3 wants to merge 1 commit into
Open
IOB-wait: a manual fingerprick shouldn't count as a live loop#74Sjoerd-Bo3 wants to merge 1 commit into
Sjoerd-Bo3 wants to merge 1 commit into
Conversation
The overlay's timeout picks 20s only when a determination is expected. That check used the latest glucose reading, but a manual fingerprick counts as 'fresh' even with no CGM — so a fingerprick-only bolus wrongly held the full 20s. Base the check on the latest non-manual (CGM) reading instead, so only a real CGM keeps the loop 'live'; otherwise it releases in 5s.
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.
Problem
Follow-up to the "Updating IOB" overlay fix. With a recent manual fingerprick (but no CGM), the overlay still held the full 20 s.
Cause
The watchdog picks the 20 s hold only when a determination is expected (
closedLoop && fresh glucose). But that freshness check used the latest glucose reading — and a manual fingerprick counts as "fresh". So a fingerprick with no CGM was misclassified as "looping", taking the long timeout.Fix
Base the "is the loop live?" check on the latest non-manual (CGM) reading (
GlucoseStored.isManual == false). A manual fingerprick no longer keeps it in the 20 s path — with no live CGM it releases in 5 s. A real CGM reading still gives the 20 s safety net for the normal loop.Verification
🤖 Generated with Claude Code
Generated by Claude Code