Code Customization

For Loop 3, please use the LoopDocs page (see link below). This page is left for those still using FreeAPS, which is based off Loop 2.2.x

In a DIY community, there are requests for code customization instructions. Some customizations are captured for the convenience of those who want to make use of them. For a while, customizations with directions in LoopDocs only contained those that did not require a workspace build, while this page contained some newer customizations plus those that required a workspace build. Now that everyone uses the workspace build method, the editors are working to consolidate the customizations into LoopDocs.  This may take some time. With each update of information in LoopDocs, this page will be updated with the appropriate links to that section in LoopDocs for a given customization. 

Regardless of the location of the customization (here or LoopDocs), please read Instructions for Finding the Lines. Using the Key_Phrase (LoopDocs) or Keyword (this page) makes it much easier to find the code to change.

These code customizations are found in LoopDocs, so click on the link for instructions:

The following code customizations are found only on this site – they will be left here and retired over time because they will not be needed for those using Loop 3.

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

Medtronic: Disable mySentry

This requires a workspace build and is only needed for older code, i.e., Loop v2.2.4 and earlier; FreeAPS v2.1 (176) and earlier. Current versions of the code have this available as a selectable options in the pump menu where needed.

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: Change Default Expiration Reminder

For Loop 3, the reminder can be selected internal to the app. No reminder is an option with Loop 3.

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.

Food Emojis

This customization allows you to move current emojis found on the carb entry screen to different absorption speed categories as well as add emojis to fit your usage.

Many users find using Medium (3 hours) for some foods found in the Fast (2 hours) section improves meal management. For those with child loopers, adding new emojis and re-arranging emojis can be a great way to teach them how different foods affect them and how to pick the correct absorption time when they are working on self-management. Finally, those adjusting the default absorption times for fast/medium/slow, may wish to adjust these emoji classifications as well.

You can move the emojis around, make a new line, or whatever you like. Just make sure each emoji follows the same pattern of being surrounded by double-quotes, followed by a comma.

The information needed to make the modification:

  • Keywords: [double quote] [emoji] [double quote] [comma] [space]. Follow this format.
  • Folder: LoopKit/LoopKitUI/CarbKit
  • File: FoodEmojiDataSource.swift
  • Lines: 16-23, 31-33, 41-42, 50-53

Examples of where you may want to move some emojis:

Move doughnut and pie to slow. Move pancakes, bread, chocolate, and milk to medium

Examples of emojis you may want to add:

Fast:
"🧃", "🥭","🫐" ,"🧋"
Medium:
"🥯", "🥚", "🧇",
Slow:
"🧈",
Other:
"❓",

You can copy/paste emojis from an emoji website, like https://getemoji.com/.

Patch for Ema and Orange Link Devices

This is suitable for Loop Master v2.2.x but is not needed for Loop 3.

As of FreeAPS v2.2 (203), the update is already incorporated, so consider a fresh download and build of FreeAPS instead of the patch.

There were a number of updates related to the EmaLink and OrangeLink that did not make it into the release for Loop v2.2.6 or FreeAPS v2.2 (201) or (202). This has been documented at the link below – so head over there and follow the directions.

  • It is fairly easy to apply this patch (and the link documents all the things added with the patch)
  • It is recommended (as with all first-time customizations) that you first build the application as downloaded to make sure there are no build error and then apply the patch and repeat the build
  • Patch is found here: Updates Needed for Ema and Orange Displays

Disable Suspend Beeps

The pump suspended interface is different for Loop 3. Once it is released, a variation may be added to LoopDocs. 

Some people requested the ability to suspend a pump without reminder beeps on the pod. (This safety feature was added in Loop v2.2.6, but there are no controls to determine when that beeps begin or how frequently it beeps, i.e., every 5 minutes. It can be silenced in the Pod Settings display after the first beep when the Alarm shows up.)

This customization permanently silences the reminder beep when suspending a pod.

  • Keyword: usePodSuspendedReminder
  • Folder: rileylink_ios / OmniKit / PumpManager
  • File:PodCommsSession.swift
  • Line: 574

Original line:

     let usePodSuspendedReminder = suspendTime == 0 || suspendTime > .minutes(5) // untimed or long enough suspend

Comment out original line by putting “//” at the beginning and add new line:

     // let usePodSuspendedReminder = suspendTime == 0 || suspendTime > .minutes(5) // untimed or long enough suspend
     let usePodSuspendedReminder = false
Skip to content