Code Customization

Introduction to Code Customization

In a DIY community, there are always new code customizations. Some of these have been captured for those who don’t lurk in multiple chat rooms.

For each topic, click on the icon to read the details. The customization for adding a different insulin model is found here: Lyumjev.

If the topic begins with the phrase Workspace Only, this means you need to use a workspace build to have access to this customization.  However, if you use the Build-Select page to download and build 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 tab, use the Xcode / Find / 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.

Note – this is a new page and not all topics have been finished. Send feedback if there’s a topic you really want to see completed.

Found in LoopDocs

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

  • Disable Authentication for Bolusing
  • Default Carb Absorption Times
  • Exponential Insulin Curve
  • Loop Logo
  • Adjust the sensitivity of Watch’s digital crown for carb and bolus entry

Adjust the Percent Bolus in Automatic-Bolus 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 bolus that Loop recommends 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.

Workspace Only: Modify the Override Sensitivity

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))

Workspace Only: Disable mySentry

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: MYSentry
  • Folder: rileylink_ios/MinimedKit/Models
  • File: PumpModel.swift
  • Line: 54

Original line:

    return generation >=23

Change to:

  return false

Skip to content