-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
G7 End of session detection bugfix #34
base: main
Are you sure you want to change the base?
Conversation
TestsInitial test on "working" phone looks good. Test on phone with no issuesI built this onto my personal Looping phone
Configuration
Test Results
|
Hopefully this works - although if it does, it makes me think that in the scan-fix the backup handling for connecting of the sensor could have just relied on the |
@ps2 Could you please share some insights on the issue you have identified (for the two linked Loop issues) and how the proposed fix here is attempting to fix it. Just from the description alone, it is highlighting possible limitations of the proposed solution while not really going into detail what the identified, underlying problem seems to be or what the proposed solution aims to solve; the code change itself just shows that a guard is being extended by a time-based guarding component and more recently added logging. |
@dnzxy The code checking for a connect/disconnect with no glucose reading was attempting to detect end-of-session, as that's what we see after a session end: the sensor continues to connect and disconnect, but no data is sent (probably because the g7 app is not asking for any). It seems that recently, perhaps due to iOS changes, sometimes we don't get the data during a connection period, and so this code was triggering prematurely. So I've changed it to not trigger prematurely, but this means that we're left without a way to detect early end of session. The recent commits to this PR are attempts at adding back automatic detection of early end of session due to manual ends or sensor errors, so we can start scanning for the new sensor proactively. |
Attempt at fixing LoopKit/Loop#2286 (and maybe LoopKit/Loop#2278).
If a G7 sensor connects and disconnects without sending glucose data, Loop was interpreting this as an end of session trigger, and forgetting the old sensor id and starting to scan for a new one. It seems in recent iOS updates, sometimes Loop doesn't get the glucose reading during a connection session, which was triggering the end of session detection prematurely.
This PR changes how end of session is detected, using new algorithm state decoding, and still keeping the original check intact once the sensor lifetime + grace period has ended.
This PR still needs testing to ensure it's reliably detecting end of session for failed sensors, and early ended sensors, and auto scanning for the new sensor.