Omnipod Looping

@Eric, here is another screenshot taken a short while after the previous one. Notice, the prediction has gone down and will hopefully go down further as carbs are absorbed, until it reaches target. But you can see how Loop does the temp basals. I actually had activated my Post-Run Override (which gives ZB for BG < 110) for about 30 minutes to stop Loop from giving me those high temps shown in the Insulin Delivery around 7 PM.

2 Likes

I am very surprised to learn Loop is not writing to Health in open mode, not sure why. Let me look into that a bit first (later tonight). Insulin data should also be available in Tidepool and via Nightscout.

Apple watch is the only choice that would allow you to bolus from it. But, you’d really need to try to see if it would work for you during running. I think it would, but no way to tell without you trying. Maybe we could take a video of how bolus from watch works.

2 Likes

I think it would be easier or I should say fewer actions to just stay in Closed Loop, rather than switching back and forth. If @dm61 could add support for the temp basal, I think I would try that. I would certainly like to see that as an option myself.:slight_smile: This may help with bolusing on the watch, too, if you are in Closed Loop using an Override. Of course, I’d also like to see a simple, Temp Basal (ZB or other) Override, which does not include ISF, and IC, too :slight_smile:

1 Like

I have seen some videos on it. But the people are always standing there or sitting down. ::grinning:

I really need to try it myself. The PDM allows me to do it with one hand, and the watch requires two. It’s kind of an awkward motion to reach across your body while you are running. So I really need to try it and see how easy it is.

The other thing is how easy it would be to see the numbers. Sometimes it’s kind of hard to do that while running.

1 Like

I think Apple has a return policy of 15 days even if you use the watch. I was tempted to return my watch initially but after installing the app I was hooked. It is very basic, but so much more convenient than pulling out the iPhone, especially if it is packed away in a zip locked baggy!

1 Like

Definitely. I would love a ZB without exceptions! Not 10% or any carb numbers or targets!!

1 Like

Yep, that would be a huge advantage, not having to take the PDM out of the running pouch like I do now!

1 Like

There are two somewhat different solutions to what I think you and @Eric are looking for:

  1. A version of temp override that would only adjust basal but would not alter ISF or CR, otherwise Loop would continue to do its closed-loop as usual, or

  2. PDM-style command to the pod to do a certain temp basal for a certain amount of time, during which Loop would not make any further alterations.

Approach 1 would likely be easier to code, and I think I might be able to give it a try - will let you know if I make any progress. Approach 2 is more complicated because it would require going down to the pod driver code (which I would not be able to do, since it is more complicated, and I do not even use pods, so could not do any testing). But, there is an open Loop issue that has lots of interested users, so maybe Pete or someone else will have it included to Loop at some point.

4 Likes

This would be awesome if you could take a look. Just looking at the high interest in solution 2 means that many would be interested in solution 1, too, which might be more readily coded??

Thank you for looking into this.

2 Likes

@Eric, please go to Health app, tap on Sources and check if Loop has permissions to write Insulin Delivery. The screen should look like this:

1 Like

Yes it does have permission.

I should be more specific about the problem. When in Open mode, Health does show bolus, but it does NOT show basal.

Logically that makes sense. When Open, the pod is just doing its pre-programmed basal routine. So loop is out of the picture. All of that basal program is stored on the pod.

So yes I see bolus, but not basal. Does all that make sense?

Here is a good picture of it in Health. You can see I was in Closed all night, and Open all day, and the picture shows it just like that. You can still see bolus in the day, but not basal during the day.

2 Likes

Yes, makes sense, and yes, I can see why Loop is not writing basals in open-loop mode (as it should). Thanks for clarifying the nature of the problem. I think this should be fixed - Loop knows what programmed basal is, and should be able to write this to Health irrespective of open or closed mode. I may post this on Zulip and see what people say.

3 Likes

@Trying,
I just ordered these. They are thicker than the normal kitchen type ziplock bags, and I think these would be the perfect size to put the RileyLink in. It would help protect it a little bit if it was dropped, and would keep it dry for running. The 2x3 seems like the perfect size.

I’ll let you know what I think. Should be arriving in a few days.

1 Like

I think I have found how to fix the division by zero if a 0% override is selected. First, as you have already found, change from 10 to from 0 in LoopKit/LoopKitUI/Views/InsulinSensitivityScalingTableViewCell.swift

Then, change this line to this:

return insulinNeedsScaleFactor.map { 1.0 / ($0 == 0 ? 1.0 : $0) }

and this line to this:

return insulinNeedsScaleFactor.map { 1.0 / ($0 == 0 ? 1.0 : $0) }

There are two problems, however. First, this is really a quick-and-dirty fix. Second, and worse, the changes required are in LoopKit, not Loop. So, you can’t just change the code in checkouts and recompile. You’d need to make a private copy of Loop and LoopKit from Katie to your own repository and then make changes in a number of places so that Loop code knows that you are using a different LoopKit. Are you familiar with github and git by any chance?

2 Likes

Good find! That extra thickness should be helpful. I’ll try them, too.

1 Like

Thanks! Yes, I already use git/github for Loop so I can track the changes, but not for any of the checkout frameworks. Would the carthage file need to be changed to access the local Loopkit repo?

I guess this fix still includes the ISF, and IC in the Override effect, right? You mentioned that they could be decoupled from the basal, but that it would be more complicated. I think if we just want ZB, then they aren’t important but would be for non ZB, right? Except if we bolus?

You would need to create your own repositories of essentially all checked out frameworks, make changes in LoopKit, and then make sure that cartfiles for all frameworks point to your own frameworks. It’s a bit tedious, but not too difficult. Start by cloning jojo Loop or whatever branch you are using. Then look through the cartfile and clone all dependent frameworks that are different from standard Loop. Then make appropriate edits in your LoopKit and cartfile’s of Loop, as well as carfiles of all other relevant dependencies. For such small changes, you can do all that on github from a browser, no need to use Xcode at all. In the end, you download and install your Loop as usual. The best guide is the jojo branch itself - just do whatever Katie had to do to create a branch that points to her private version of LoopKit.

The fix only changes the override for 0%, to avoid division by zero. The part of the code: 1.0 / ($0 == 0 ? 1.0 : $0) means: divide by 1.0 if the percent-override is 0, otherwise divide by the percent-override. So, you’ll have a very special zero % override that produces ZB, but keeps ISF and CR untouched. If you wish to have some other ISF or CR scale factor for 0 override, just change 1.0 to whatever number you like, e.g. 1.0 / ($0 == 0 ? 0.5 : $0) would bump ISF by a factor of 2. Makes sense?

1 Like

Ok, thanks for the details. That was what I thought would be needed! I did check Katie’s Jojo cartfile and noticed it was pointing to her repo! :slight_smile:

Yes, makes sense.

Another question re: code both @Eric and I had re: BOLUS increments on the watch. Do you know how we can make a change so that the BOLUS increment is 0.1U? If I tap the ‘+’ or ‘-’ on the watch Bolus screen, it currently defaults to 0.25U, much too large. Thank you!

You may just use the crown for 0.025U increments. I think the crown is much more convenient than +/- taps anyway.

1 Like

Is there a way to set it for 0.05, since pods can’t deliver 0.025?

I wasn’t sure if I could modify the let rotationsPerValue: Double = 1/12 line to be other values. I assume it has to be an increment of 12. Or would increments of 6 work? Maybe 18 gets me closer?

1 Like