Skip to content
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

Fix for perpetual Insert Cannula "Pod Already Paired" errors #38

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

itsmojo
Copy link
Contributor

@itsmojo itsmojo commented Aug 15, 2024

This rare event happened with Trio but could potentially happen with Loop or iAPS as the code involved is virtually identical in all cases. The straightforward logic modification will prevent being forever stuck in the Insert Cannula screen with a Pod Already Paired error in the future. See nightscout/Trio#380 for additional info.

  • Add optional mock error Preview handling code
  • Minor updates to match OmniBLE versions

+ Add optional mock error Preview handling code for testing
+ Minor updates to match OmniBLE versions
@marionbarker
Copy link
Collaborator

Status

Success. LGTM.

Code Review

Code review looks good. This will return success in the rare case that the Insert Cannula screen is displayed after podAlreadyPaired is set. This will prevent the infinite loop in the UI that was reported in Trio Issue 380.

Tests

Test with Preview

I tested this using the Preview in Trio. (For some reason, the Preview in Loop never opens for me.)

Use the Preview without this patch.

  • Insert cannula works fine

Use the Preview as provided by this PR, the insert cannula behaves as expected.

  • Insert cannula works fine

Use the Preview with the modification of setting both mockError and mockPodAlreadyPairedError to true
and get the expected message in the Xcode debug log:

### insertCannula treating podAlreadyPaired as success

Remove the modification in OmniKitUI/ViewModels/InsertCannulaViewModel.swift from this patch and repeat the Preview test with the true setting. The debug log reports

### insertCannula encountered error Pod already paired, retrying after 3.0 seconds

followed by this Preview screenshot. This matches the error seen by the user who reported this.

omnikit-preview-pod-already-paired-message

Test with Phone

I did not test with a real pod on a phone.
I relied on the similarity between OmniKit and OmniBLE and used the OmniBLE testing with an rPi DASH simulator.

@marionbarker marionbarker requested a review from ps2 August 17, 2024 14:18
Copy link
Contributor

@ps2 ps2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

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.

3 participants