Skip to content

IOB-wait: a manual fingerprick shouldn't count as a live loop - #74

Open
Sjoerd-Bo3 wants to merge 1 commit into
Build-Experimentfrom
fix/bolus-iob-wait-manual-glucose
Open

IOB-wait: a manual fingerprick shouldn't count as a live loop#74
Sjoerd-Bo3 wants to merge 1 commit into
Build-Experimentfrom
fix/bolus-iob-wait-manual-glucose

Conversation

@Sjoerd-Bo3

Copy link
Copy Markdown
Owner

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

  • Compiles via CI. On-device: fingerprick + bolus with no CGM → overlay releases in ~5 s (not 20 s). Normal closed-loop bolus on CGM unchanged.

🤖 Generated with Claude Code


Generated by Claude Code

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.
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