Summary of Loop with LnL Patches

The Customization Select Script provides an easy method to add desired options to the released version of Loop 3.2.2 (and even the dev branch).

The loopnlearn fork with Loop with LnL Patches (main_lnl_patches) branch will not be maintained after Loop 3.2.2.

For Loop 3.2.3 and later, please use the main LoopKit GitHub username to get your code.

High Level Summary of what is added with LnL Patches:

Loop with LnL Patches adds the following to the released version of Loop 3.2.2:

  • CustomTypeOne LoopPatches
  • xDrip4iOS client
  • GlucoseDirect client
  • Loop and Learn Logo embedded in Loop Logo

This version of Loop is not supported by the developers of Loop and will not be supported by the Loop and Learn Team with the next release (but you can still customize). If you build Loop with LnL Patches and have problems or questions, make it very clear you are using this patched version if you ask for help.

Why these patches?

The CustomTypeOne LoopPatches are one of the most requested customizations for Loop 3.x.

WARNING: The CustomTypeOne LoopPatches do NOT have guardrails – be very careful when setting values and always test the results.

The two added clients support Libre as a CGM without the need for the internet, using either xDrip4iOS or GlucoseDirect. They both use the shared app group feature to talk to Loop.

WARNING: If your Libre reports at 1-minute intervals, you must take steps to limit the reporting to Loop to 5-minute intervals. Otherwise, your pod will probably fault early due to Loop responding to every CGM update.

xDrip4iOS now has a selection for this option.

The Loop and Learn Logo makes it easy to see that you have built with these patches applied.

CustomTypeOne LoopPatches

The CustomTypeOne LoopPatches are a popular set of patches that supply some features that are available in FreeAPS along with some new features implemented by Jon Fawcett.

This section provide a high-level summary. Please also read the detailed description in LoopPatches Documentation.

These patches are enabled, disabled and adjusted through the iOS Setting -> Loop menu (not in the Loop app).

When using mmol/L, be aware that the localized decimal separator is not supported.

  • Example: use 13.9 not 13,9.
  • If you enter 13,9 – there is no error but the value will be interpreted as 13
  • Only the value should be entered on the threshold row; the units match your glucose sensor

The patch code is located at this GitHub URL: LoopPatches.

  1. Add Now Marker, Main Charts
    • Display Feature
    • A vertical line is presented on each of the 4 main charts on the main Loop screen
    • This can be enabled or disabled (default)
  2. Automatic Strategy Switching
    • Switch Dosing Strategy between Temp Basal (below threshold) to Automatic Bolus (above threshold) at a glucose level you choose
  3. Negative IOB Factor
    • Restrict the insulin Loop doses for negative IOB to prevent rebound lows
    • This feature is disabled by selecting a factor of 100% (default setting is 1.0, same as 100%)
    • Note – this modifies what Loop records as IOB whenever IOB is negative
  4. Partial Bolus Application Factor
    • Adjust the percentage of recommended insulin that Loop delivers for each Automatic Bolus when that Dosing Strategy is selected
  5. Basal Lock
    • Prevent Loop from reducing or suspending insulin when you go over a set glucose value to assist with stubborn highs
    • Basal is “locked” to be no lower than the scheduled rate (overrides are ignored)
    • Use with care; meant for high glucose >250 mg/dL (13.9 mmol/L)
    • When used improperly, this can cause lows

For Loopers Using Libre as  CGM

What is a heartbeat and why should it come from a CGM?

For optimum performance, the app should be driven by the continuous glucose monitor (CGM) so the Loop cycle starts with the most recent glucose information available, updates the glucose prediction and then sends commands to the pump, if needed, to modify insulin delivery.

When the phone is locked, a mechanism is required to “wake” up the app out of background mode so it can keep that loop symbol a nice green color.

A Bluetooth connection is used by Loop to perform this waking from background while the phone is locked.  This is called the heartbeat.

  • Best case – this comes from the CGM (this is the case with Dexcom where app is on the Looper’s phone)
  • Second best case – this comes from the RileyLink device (for Eros or Medtronic)
  • With DASH pods, there is no reliable heartbeat that works all of the time when the phone is locked

In order to solve this problem, the folks who work with Libre sensors make the Bluetooth connection available to Loop. This is an area where more progress may happen, but for now, it is xDrip4iOS that has this feature working with Loop. Follow the heartbeat instructions below to get best performance using Libre and allow continued looping while phone is locked.

Using xDrip4iOS heartbeat

Users of Libre with xDrip4iOS now have the heartbeat option (allows Loop to work with the phone locked).

Instructions for use:

Loop with customizations has an option to make a bluetooth connection to the CGM transmitter, which will then work as a heartbeat.

It is disabled by default. Can be enabled in xDrip4iOS user interface (UI).

Note for Libre 2 users : the reading will run 1 minute behind.

If you haven’t setup your CGM yet in xDrip4iOS :

  • Force close Loop
  • In xDrip4iOS make sure you have made a first connection to the CGM
  • Force close xDrip4iOS
  • Reopen Loop
  • Select xDrip4iOS as CGM and open the xDrip4iOS UI (within Loop)
  • Enable “use CGM as heartbeat”
  • Keep the app in the foreground and wait till the text under the UISwitch changes to
    • Did connect to CGM, You can now run both xDrip4iOS and Loop
  • Once you see this text, you can reopen xDrip4iOS

How to Build Loop with LnL Patches:

These patches are added to Loop 3.2.2 and stored in the main_lnl_branch found in the loopnlearn repository for LoopWorkspace.

WARNING: This will not be supported in the next release (3.4); you will be given tools to choose your customizations.

There are several ways to build this version.

  1.  Mac-Xcode Build Method:
  2. LoopDocs: GitHub Browser Build Method

The GitHub Browser Build method is new with Loop 3, but once you get used to it, it may become your preferred method.

The ability to just edit the build_loop.yml file to add patches of your choice is an added advantage of the GitHub Browser Build method

The addition of the Customization Select Script that can be run with Mac-Xcode or inserted into build_loop.yml makes many customizations much easier.

Skip to content