Skip to content

Restore Loop forecast after a refresh clears it#706

Open
bjorkert wants to merge 1 commit into
devfrom
fix/loop-forecast-restore-on-refresh
Open

Restore Loop forecast after a refresh clears it#706
bjorkert wants to merge 1 commit into
devfrom
fix/loop-forecast-restore-on-refresh

Conversation

@bjorkert

Copy link
Copy Markdown
Member

On Loop data sources, the glucose forecast is drawn on first load but disappears after a refresh and does not reappear until the next loop cycle.

refresh() clears predictionData and redraws an empty forecast. It runs on pull-to-refresh, on data-source reconfiguration, and on every WebSocket disconnect (which posts the refresh notification). The Loop forecast is only rebuilt in DeviceStatusLoop, and only when a newer loop cycle arrives (previousLastLoopTime < lastLoopTime). Because the current cycle has already been seen at that point, the forecast stays blank until the pump clock advances — up to five minutes, and longer when the WebSocket disconnects repeatedly.

Rebuild the forecast when predictionData is empty as well, so the next device-status poll restores it regardless of cycle timing. Same-cycle polls that already have forecast points continue to skip the rebuild. This mirrors the OpenAPS/Trio path, which already repopulates its prediction unconditionally and is unaffected.

refresh() clears predictionData and redraws an empty forecast, but the
Loop forecast is only rebuilt when a newer loop cycle arrives
(previousLastLoopTime < lastLoopTime). Since the current cycle has
already been seen at that point, the forecast stays blank until the pump
clock advances.

Also rebuild when predictionData is empty so the next device-status poll
restores the forecast regardless of cycle timing.
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