Summary of Loop with LnL Patches
The Loop and Learn team provides an easy method to apply some frequently requested patches to the released version of Loop 3 with minimal effort.
High Level Summary of what is added with LnL Patches:
Loop with LnL Patches adds the following to the released version of Loop 3:
- 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. 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.
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.
- 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)
- Automatic Strategy Switching
- Switch Dosing Strategy between Temp Basal (below threshold) to Automatic Bolus (above threshold) at a glucose level you choose
- 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
- Partial Bolus Application Factor
- Adjust the percentage of recommended insulin that Loop delivers for each Automatic Bolus when that Dosing Strategy is selected
- 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 the released version of Loop and stored in the main_lnl_branch found in the loopnlearn repository for LoopWorkspace. There are several ways to build this version.
- Mac-Xcode Build Method:
- Choose Loop with Patches in the Build-Select script
- LoopDocs: GitHub Browser Build Method
- Follow the standard directions to create a fork from the LoopKit/LoopWorkspace repository as described in LoopDocs link above
- Modify your build_loop.yml file as described in these two sections of the LnL Code Customization page:
- Loop and Learn: GitHub Browser Build Method
- This was the first method created for using Browser Build method to get the LnL Patches
- It is still available, but your fork must be from the loopnlearn repository (not LoopKit), so requires skipping back and forth between documentation pages
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, but the documentation updates have been slow as we explore the new capabilities of this method.