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

Pump/CGM state reverts on phone restart #231

Closed
dnzxy opened this issue May 22, 2024 · 8 comments
Closed

Pump/CGM state reverts on phone restart #231

dnzxy opened this issue May 22, 2024 · 8 comments
Assignees

Comments

@dnzxy
Copy link
Contributor

dnzxy commented May 22, 2024

Describe the bug
Upon phone restart, the app seldom reverts to old device state for CGM or pump, thus losing device connection. For pods this inherently leads to loss of device and need for replacement. This looks a lot like an old Loop bug is still present in Trio, but that mustn’t be the case as changes were migrated to FreeAPS and Trio in the past.

Screenshots

Pod error  
IMG_0752 image0

screenshots by user @Sjoerd-Bo3 showing loss of pod connection and pairing info in bluetooth settings

Setup Information (please complete the following information):

  • all pump types
  • all CGMs
  • Trio version 0.1.0

Additional context
Loop had a very similar issue, if not this issue, and the fix to this issue was moving device state info from UserDefaults to binary file (plist). See LoopKit/Loop#1702

@dnzxy dnzxy added the bug label May 22, 2024
@dnzxy dnzxy added this to Trio May 22, 2024
@dnzxy dnzxy added this to the Trio 1.0 release milestone May 22, 2024
@dnzxy dnzxy changed the title Pump/CGM state reverts on phone restart (old Loop bug) Pump/CGM state reverts on phone restart May 23, 2024
@bjornoleh bjornoleh moved this to Ready in Trio Jun 3, 2024
@kskandis
Copy link
Contributor

kskandis commented Jun 4, 2024

This looks a lot like an old Loop bug is still present in Trio, but that mustn’t be the case as changes were migrated to FreeAPS and Trio in the past.

It looks like the LoopKit/Loop#1702 fix is not imported to Trio. Trio imports https://github.com/LoopKit/LoopKit but not https://github.com/LoopKit/Loop where the fix to this is implemented. Some of the Trio corresponding code to LoopKit/Loop lives under https://github.com/nightscout/Trio/tree/dev/FreeAPS/Sources/APS, so Loop's fix needs to be merged into Trio's code, such as Loopkit/Loop/Managers/DeviceDataManager.swift,

@dnzxy
Copy link
Contributor Author

dnzxy commented Jun 4, 2024

@avouspierre had hinted on Discord that these changes were already imported to FAX and in turn to iAPS, so also Trio. I only recorded the issue here. I also thought this was still present in iAPS/Trio.

Quoting, as of 23/05/2024

I quickly checked but trio (freeaps in fact) seems implemented the plist strategy for the persistent wrapper.. so the fix of loop is probably already here..

If you can take a deeper look at this @kskandis and really compare the plist configs for Trio, please do 🙏

@kskandis
Copy link
Contributor

kskandis commented Jun 4, 2024

If you can take a deeper look at this @kskandis and really compare the plist configs for Trio, please do 🙏

Yes, I would have thought, too, but when I looked at your link to the merged PR I saw that it was code in Loop! I will take a deeper look.

@kskandis
Copy link
Contributor

kskandis commented Jun 5, 2024

@avouspierre had hinted on Discord that these changes were already imported

Yes, actually his changes are indeed implemented in Trio with [this commit - see FetchGlucoseManager.swift](47fa017) on Mar 17th for CGM and PR #15!

However, pumpManager still uses UserDefaults in DeviceDataManager.swift. So the pumpManager code needs to be updated similar to how CGM was implemented to use PersistentProperty instead of UserDefaults. Also, for existing users, the "legacyPumpManagerRawValue UserDefaults" should be cleared similar to Loop#1702 UserDefaults+Loop and DeviceDataManager.

@dnzxy
Copy link
Contributor Author

dnzxy commented Jun 5, 2024

@kskandis I messaged you on Discord last night and sent you a patch file, please check your inbox 😊 I had started that port last night, wasn’t sure if I got through and @aug0211 briefly tested the patch today and it seemed to lose the pod after force quitting the app, so it’s not yet done.

@kskandis
Copy link
Contributor

kskandis commented Jun 5, 2024

I messaged you on Discord last night and sent you a patch file

Oh, sorry, I missed your DM. I've read it now. I also made a patch not realizing you did! I will DM you it. It is very similar to yours with some diffs ...

@aug0211
Copy link
Contributor

aug0211 commented Jun 6, 2024

https://github.com/dnzxy/Trio/tree/pump-loss-fix-migration

Work being done in the above branch

@dnzxy dnzxy moved this from Ready to In review in Trio Jun 8, 2024
@kskandis
Copy link
Contributor

kskandis commented Jun 9, 2024

Should this be closed? I believe it was fixed with #277

@dnzxy dnzxy closed this as completed Jun 9, 2024
@github-project-automation github-project-automation bot moved this from In review to Done in Trio Jun 9, 2024
mountrcg pushed a commit to mountrcg/Trio that referenced this issue Aug 1, 2024
Fix the healthKit sync when stopped before the end nightscout#231
Fix the 0U basal in healthKit nightscout#149
@Sjoerd-Bo3 Sjoerd-Bo3 removed the bug label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants