Omnipod Looping

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