Skip to content

Carb Entry/Delete and Watch not in Sync with Phone #14

Closed

Description

@marionbarker

EDITED March 12, 2022
Fix now in freeaps_dev, will close this issue with the next release of FreeAPS

This behavior was fixed by bringing over selected updates found in Loop-dev.
See Update watch code (from dev)

EDITED Dec 2, 2021
Partial solution for Issue 14 only

This fixed only one part of the problem - Carbs reported on watch immediately are not doubled until a loop cycle completes like they were before.
More work is needed. At least one report of carbs reappearing was posted on telegram chat.

I tested COB, IOB and suggested bolus on watch vs phone over time after a real meal and they did not agree.
The COB and IOB decay reported on watch lagged phone and the suggested bolus was greater on watch than phone.
Tapping on override triggered a sync so they matched again.

Please test - in your existing download, inside Xcode, navigate to this file:

LoopWorkspace/Loop/Loop/Managers/WatchDataManager.swift

For Loop Master (v2.2.6) and FreeAPS v2.2 (204) the line to be changed is 102.

  • change is to add , .carbs to the case.
    (As of Dec 2, 2021, this modification is incorporated in the freeaps_dev branch)

code before modifcation

        switch updateContext {
        case .glucose, .tempBasal:
            sendWatchContextIfNeeded()
        case .preferences:
            sendSettingsIfNeeded()
        default:
            break
        }

code after modification

        switch updateContext {
        case .glucose, .tempBasal, .carbs:
            sendWatchContextIfNeeded()
        case .preferences:
            sendSettingsIfNeeded()
        default:
            break
        }

Rebuild and test.

History

I examined the diff for successive commits that affected this file.
The last time what is now line 102 was modified was on Sat Oct 6, 2018 by Pete Schwamb.

git diff 8e1df7c 34c390a -- Loop/Managers/WatchDataManager.swift

ORIGINAL Bug report below

Describe the bug
Carbs added by watch and deleted on phone can reappear

WARNING - if this happens to you and you do not notice, you could wind up with more insulin than you need.

See also Issue #15 Watch Bolus Screen does not follow Carb Entry

To Reproduce
Steps to reproduce the behavior:

  1. Add Carbs using the watch but do not bolus
  2. On phone, delete the carbs just added with watch
  3. Wait 5 minutes (1 loop cycle)
  4. Observe if the carbs come back
  5. Delete the carbs again - they will stay gone this time

Expected behavior
The carbs should remain deleted once they have been deleted.

In my case - I am running FreeAPS v2.2 (204) with an iPhone 12 running iOS 15.1 with a Series 7 41-mm watch running watchOS 8.1.
I have Open bolus screen after carbs on watch enabled.
I built a new version on my phone to test some things and noticed the bolus screen did not open after carb entry on watch.
It was only after this started happening that I did the test listed above. I was able to reproduce it.

For one test, I entered and deleted the carbs 3 times, then next loop cycle, all 3 copies of the carbs reappeared.

Activity

  1. Nnk2 commented on Nov 23, 2021

    @Nnk2

    I can reproduce this on my setup too:

    • Loopnlearn/freeaps 2.2 (204)
    • iOS 15.1.1
    • WatchOS 8.1
    • 44mm series 4

    Carbs added by Watch, reappear after deleting on iPhone

  2. Trpl7ca commented on Nov 23, 2021

    @Trpl7ca

    Also see it on Crowding v2.2 (205)
    IOS 15.1.1
    Watch 8.1.1
    45mm series 7
    Including no bolus screen after carb entry even though selected in settings

  3. marionbarker commented on Nov 23, 2021

    @marionbarker
    CollaboratorAuthor

    I built from a fresh download of Loop v2.2.6

    • Same behavior is observed (intermittent - as it was on FreeAPS).
    • Happened 2 times out of 4 tests. Might not have waited long enough for third test (perhaps the 30 g indication on Watch).

    Note - For last test I looked at COB on watch.

    • Currently Loop shows 0 COB on phone
    • After doing a 15 g Carb save on watch
      • Observe watch COB - says 30 g
    • Delete the carbs on phone
      • Observe watch COB - says 30 g
    • Close and restart Loop - the carbs have reappeared
    • There are 2 copies of 15 g, delete both
      • Observe watch COB - flashed 30 g then
      • Observe watch COB - says --
  4. Trpl7ca commented on Nov 23, 2021

    @Trpl7ca

    Not only did the carb entry on watch come back on the phone, but the bolus recommendation on watch did not change for the lower carb amount. So I just realized that if using the watch for carb and bolus entries you may give yourself more insulin than necessary because of the delay in sync. For example if you enter a carb amount and then bolus half the amount from the watch, using AB may add insulin also but the value does not show up on the watch until the next sync. So if you look at you watch recommendation before the sync you will not see the AB amount given, it will still show the remaining amount of initial insulin. You could be giving yourself more insulin that desired. There is no way to tell if the watch has synced unless you open the phone making the watch less useful IMO.

  5. marionbarker commented on Nov 26, 2021

    @marionbarker
    CollaboratorAuthor

    Please do some tests to confirm that tapping on or off of any override always makes phone and watch in sync. As a work-around, you can force sync the phone and watch with this trick.

    If anyone has suggestions for fixing this, please post it in this conversation.

  6. Trpl7ca commented on Nov 26, 2021

    @Trpl7ca

    Yes that did work for me 3 times. A auto bolus was given that did not show on watch and by selecting pre-meal it would sync immediately.

  7. bjornoleh commented on Dec 2, 2021

    @bjornoleh

    I am not seeing the respawned carbs (entered from watch and deleted on phone) with series 3, watchOS 7.6.2 and iOS 15.1, FreeAPS 2.2 204

    Edit, that was too quick, I am actually seeing this too!

  8. Trpl7ca commented on Dec 2, 2021

    @Trpl7ca

    For me it took 10 min to reappear two loop cycles

  9. bjornoleh commented on Dec 2, 2021

    @bjornoleh

    After updating to watchOS 8.1 with the same setup as above, I am also getting the reappearing deleted carbs. But this issue is not only for watchOS 8. Possibly it is only with iOS 15.x, as I have not noticed it before updating from 15.8 to 15.1 today. But I am unsure about this.

  10. changed the title [-]Carb Entry/Delete Problem[/-] [+]Carb Entry/Delete and Watch not in Sync with Phone[/+] on Mar 12, 2022
  11. marionbarker commented on May 11, 2023

    @marionbarker
    CollaboratorAuthor

    Fix was merged in Jan 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions