// Collapsable Mobile Menus

Code Customization

In a DIY community, there are always code customizations. Some of these have been captured for the convenience of those who want to make use of them.

Some customizations require a workspace build.  If you use the Build-Select page to download and build Loop Master, Loop AB, or the FreeAPS fork of Loop, you’ll have access to all the folders in the workspace. Plus, you’ll find it’s much easier to build – and faster.

    The line number(s) given for each customization might be in a different location – especially if you’re using someone else’s fork. If you get to the indicated line in the indicated file and don’t find code that looks exactly like that shown in a given customization instruction, use the Xcode / Find / (Find in Project OR  Find In Workspace) feature to search for the keyword and find the code. If you still don’t find it or are not sure – ask for help – do NOT guess.

    Some users prefer to search for the keyword instead of following the file tree in Xcode.

    These code customizations are found in LoopDocs, so head over there for details

    These code customizations are found on this site.

    Adjust Percent Bolus in AB Branch

    If you are mostly happy with the automatic-bolus branch but wish it delivered more insulin during every Loop interval, then this customization is for you.

    This customization changes the percent of the recommended bolus used for automatic delivery. The method for making that recommendation is not changed by this modification.  The default value is 40% (0.4).  It is recommended you take small upwards steps of 0.1 increase at a time.  Once you found the line and done the rebuild, it’s easy to go back in a week and creep up a little higher.

    • Keyword: bolusPartialApplicationFactor
    • Folder: Loop / LoopCore
    • File: LoopSettings.swift
    • Line: 80

    Original line:

        public let bolusPartialApplicationFactor = 0.4 // %

    Change just the number and double check that the value is less than 1.

    • Start with 0.5
      • 50% of the recommended dose immediately, then 50% of the remaining recommended dose (approximately 25%) is delivered 5 minutes later
    • Try it for a few days, then you can easily change it

    WARNING – This number should never be bigger than 1 (you’d be getting more than Loop recommends). If you think you need a number bigger than 0.7, perhaps you should examine your settings.

    Adjust Watch Crown Rotation Required for Bolus Confirmation

    If you find the amount of rotation of the crown too much to easily complete the bolus confirmation, this one is for you! This makes it easier for kids, teens, and some adults. Certain watch cases make spinning the crown more difficult as well, so reducing the rotation can be very helpful.

    This customization changes the rotation for confirmation from 1 full rotation (1.0 or 100%) to something less. I like to use 70% (or 0.7).

    • Keyword: previousAccumulatedRotation
    • Folder: Loop / WatchApp Extension / Controllers /
    • File: BolusInterfaceController.swift
    • Line: 311 & 360

    Original line 311:

        if abs(previousAccumulatedRotation) < 1.0 && abs(accumulatedRotation) >= 1.0 {

    Change both numbers to the desired amount, such as 0.7.

    Changed line to use 70% crown rotation:

        if abs(previousAccumulatedRotation) < 0.7 && abs(accumulatedRotation) >= 0.7 {

    Original line 360:

        if abs(accumulatedRotation) >= 1 {

    Changed line to use 70% crown rotation:

        if abs(accumulatedRotation) >= 0.7 {

    Pods: Increase Log File History Hours

    This customization increases the number of hours maintained by the Issue Report.  It is not specific to pods.  However, the only reason to do this if you are having issues with your pods not reaching full life and you’d like to reach out to the developers for help.  The default hours maintained is 48.  This customization increases that to 84.  This provides time for the pod to reach the full 80 hours and then 4 hours for you to remember you meant to capture an Issue Report. This will capture the full life of the pod from prime through replace with time to spare before and after the pod.

    This customization changes the number of hours for maintaining the log of Loop activities.

    • Keyword: deviceLog.getLogEntries
    • Folder: Loop / Loop / Managers /
    • File: DeviceDataManager.swift
    • Line: 201 (master), 204 (automatic-bolus or FreeAPS)

    Original:

          self.deviceLog.getLogEntries(startDate: Date() - .hours(48)) { (result) in

    Change the 48 to 84 (or suitable number of hours that you typically use a pod).

    Everything below here requires a Workspace build

    Note that if you examine the folder names in the folder tree on the left side of Xcode, some folders do not match the detailed path on the right side for the Workspace build.

    For example, the top of the RileyLink folder tree on the left is RileyLink, while the full path to the right shows the actual path name on the mac, i.e., /Users/{your name}/Downloads/{more path info}/LoopWorkspace/rileylink_ios.

    This is normal – don’t let it confuse you. The actual folder name is shown below.

    Modify Override Sensitivity

    This requires a workspace build. 

    Some people want finer settings on the override sensitivity scale – especially for children.

    At the same time, any override more than a factor of 2 from 100% causes Loop predictions to be wrong – especially if a carb count is entered.

    This customization changes the lower bound for sensitivity to 50% (factor of 2 smaller than 100%) and provides 5% steps.

    • Keyword: allScaleFactorPercentages
    • Folder: LoopKit / LoopKitUI / Views
    • File: InsulinSensitivityScalingTableViewCell.swift
    • Line: 19

    Original line:

        private let allScaleFactorPercentages = Array(stride(from: 10, through: 200, by: 10))

    Change to:

        private let allScaleFactorPercentages = Array(stride(from: 50, through: 200, by: 5))

    Medtronic: Disable mySentry

    This requires a workspace build.

    Folks on Medtronic Pumps that have the mySentry feature (523, 554, 723, 754)  report battery draining rapidly on the radio-link.

    A fix has been reported in GitHub.

    This customization disables the mySentry feature, but will give you longer battery life AND fewer communications issues (less yellow/red loops, less bolus errors).

    • Keyword: hasMySentry
    • Folder: rileylink_ios/MinimedKit/Models
    • File: PumpModel.swift
    • Line: 54

    Original line:

        return generation >=23

    Change to:

        return false

    Pods: Add Extra Insulin on Insertion

    This requires a workspace build.

    The default value is 0.0 u of extra insulin.  It is strongly recommended that you start with a small number and work your way up.

    • Keyword: cannulaInsertionUnitsExtra
    • Folder: rileylink_ios/OmniKit/Model
    • File: Pod.swift
    • Line: 65

    Default:

    public static let cannulaInsertionUnitsExtra = 0.0 // edit to add a fixed additional amount of insulin during cannula insertion

    Pods: Change Default Expiration Reminder

    This requires a workspace build.

    The default value is 2 hours before the 72 hour end of “guaranteed” life on the pod; this is measured from the time the insulin is injected into the pod. The range of allowed values is:

    • no smaller than 1 hour, i.e., remind at 71 hours
    • no bigger than 24 hours, i.e., remind at 48 hours

    The information needed to make the modification:

    • Keyword: expirationReminderAlertDefaultTimeBeforeExpiration
    • Folder: rileylink_ios/OmniKit/Model
    • File: Pod.swift
    • Line: 69

    Default:

    public static let expirationReminderAlertDefaultTimeBeforeExpiration = TimeInterval.hours(2)

    The Pod has an internal timer that keeps track of minutes that the Pod has been active. This timer may have a slight drift with respect to actual time, so the 72 hour expiration beeps or the 80 hour Pod shutdown may be a few minutes before or after you expect it, based on this reported expiration date/time. However, the reminder is simply a iPhone notification – it will occur at the stated minute. And if the pod is replaced before the reminder – you might still get a reminder notification because this is based on an iPhone (not a pod) reminder function.

    Skip to content