Revamped Pod Keep Alive OmnipodKit implementation - #125
Open
itsmojo wants to merge 1 commit into
Open
Conversation
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.
Background
The original Pod Keep Alive implementation was an adaptation of code from the
LoopFollowapp intended as a temporary bandaid measure for the Atlas pods when used with iPhone 16s and 17e'e that can have significant BLE reconnect delay times resulting in long periods of pod communication losses. Unforunately no iOS/iPhone or Insulet solutions for this reconnect problems between these devices has happened and no better software workarounds have been found in over a year. Now that that PKA is part of the unified OmnipodKit pump manager, it is due for some long overdue updates and a more viable long term implementation.Some issues of the original PKA implmementation include:
OmnipodKit.Pump Manager Detailsor Loop Reports (since it's not part of the state being held inOmniPumpManagerState).Switch pump typeis used to switch to a different pump type,OmnipodKitwill still be held in memory.Switch pump typeis used to switch to a different pump type after the DASH pod type has been selected,RileyLinkBLEKitwill also still be held in memory.RileyLinkPKA type is selected and a RileyLink is connected, then no RileyLinks will be available when switching the pump manager fromAll Omnipod Types(OmnipodKit) toMinimed(MinimedKit). This will also occur if the PKA type has been changed back toDisabledbefore switching pump types.LoopFollowbased PKA implementation.OmnipodKitfor both BLE Omnipod pod types.New Implementation
This new PKA implementation is completely revamped and fixes all of the above listed issues. The uses of Storage()/StrorageValue() classes for remembering persistent state have been eliminated and replaced by a single
PodKeepAlivevalue kept inOmniPumpManageStatewhich is managed just like any other pump manager state. The various logical pieces have been split into multiple source files that make more sense. While this new PKA implementation doesn't (currently at least) support a RileyLink option to do BLE based wakeups for PKA, it does provide a framework for doing this in a way that would integrate better withOmnipodKitwhich already has its own RileyLink mechanisms included for use with older Eros pods.Other highlights of the new PKA implementation include:
OmnipodKitorRileyLinkBLEKit.All Omnipod Types(OmnipodKit) toMinimed(MinimedKit).Testing Notes
To verify that
OmnipodKitandRileyLinkBLEKitare no longer being held in memory, it is necessary to run Loop under Xcode. After switching out from theOmnipodKitpump manager to the main page showingAdd Pump, tap on the XcodeDebug Memory Graphicon (3 connected dots pointing to the right) in the diagnostic visual debugger section of the debug bar. In the older PKA implemenation, there will be several held references forOmnipodKit. If anOmnipod DASHpod type was selected before switching out, there will be even more held references toOmnipodKitand there will be at least one held reference toRileyLinkBLEKit. With this updated PKA implementation, there should be no held references to eitherOmnipodKitorRileyLinkBLEKitafter switching out from theOmnipodKit(All Omnipod Types) pump manager no matter which pod type or PKA option is selected as should be expected.The Silent Tune option now plays the
silent.wavfile found in the OmnipodKit/Resources directory which is a copy of the still includedblank.wavfile in the same directory. For testing purposes, thesilent.wavfile can be easily overwritten by the contents of theheartbeat.wavfile for a heartbeat sound that can be heard with Silent Tune PKA option is selected and the app is not in the foreground. The app can be easily restored to its default non-test configuration by coping theblank.wavfile back tosilent.wav.Other issues cited for the poor code layout and incorrect descriptions can be verified by examination of the old vs new implementations in the source code and by examination of the screen views.
Possible Future Work
With the unified Omnipod pump manager that includes all supported Omnipod pod types,
RileyLinkBLEKitis always linked withOmnipodKit. If a RileyLink PKA option is eventually re-implemented forOmnipodKit, it should use the existingRileyLinkBLEKitcode that is already included for the Eros pod type instead of using any code from the orignal PKA implementation which has a conflicting and overly messy standalone BLE and RileyLink implementation that was originally adapted fromLoopFollow.