Skip to content

Add Libre 3/3+ - #1275

Draft
trioneer-dev wants to merge 76 commits into
nightscout:devfrom
trioneer-dev:feat/dev-libre3
Draft

Add Libre 3/3+ #1275
trioneer-dev wants to merge 76 commits into
nightscout:devfrom
trioneer-dev:feat/dev-libre3

Conversation

@trioneer-dev

@trioneer-dev trioneer-dev commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Integrates the LibreLoop CGM plugin (with adaptations to work with pre next-dev LoopKit) so Trio can pair FreeStyle Libre 3 / 3+ sensors directly (no internet reliance, no external app).
  • Ships as three new submodules (LibreLoop, LibreCRKit, LoopAlgorithm) wired through Trio's existing PluginManager / PluginSource path.
  • Adds Libre 3 / 3+ to the CGM picker and surfaces sensor lifecycle + status highlight on the home glucose view via the shared CGM highlight pipeline.

Important

1-min readings are currently not supported
This is still experimental

Test plan

  • Fresh install → CGM settings → Libre 3 / 3+ visible in picker
  • Pair a new Libre 3 / 3+ sensor and complete warmup
  • Glucose values arrive on a normal 5-min cadence; no gaps > 6 min under steady conditions
  • Backfill on cold-start / relaunch fills the last 24 h of history
  • Sensor progress bobble on home view matches remaining lifetime; flips to grace period near expiry
  • Alerts from LibreLoop (sensor issue, expiring, expired) show up
  • Swap between Libre 3 / 3+ and another CGM (e.g. G7) and back — no stuck state (watch out, not down Receiver ID before removing Libre)
  • Loop enacts against Libre readings; no regressions vs. current Trio behaviour
  • Simulator scenarios still work

trioneer-dev and others added 30 commits June 19, 2026 22:30
…ing + per-pump test suites

# Conflicts:
#	Trio/Sources/Localizations/Main/Localizable.xcstrings
#	Trio/Sources/Services/Alerts/AlertCatalogRegistry.swift
#	Trio/Sources/Services/UserNotifications/UserNotificationsManager.swift
#	TrioTests/AlertCatalogRegistryOmniFaultTests.swift
…M-app section + Carbs Required grams

Brings the eight follow-up commits added on top of the prior PR nightscout#1203
integration. Notable runtime change: .xdrip is now covered by the
CGM-owns-alerts gate, so xDrip4iOS users will see their reading-driven
alarms move into the new "Handled by CGM App" section.
… on 0.47.11

The pinned SwiftFormat 0.47.11 doesn't split a single --exclude argument
on commas — it treats the whole string as one literal path token, so
the combined "Pods,Generated,...,LibreLoop,..." form silently
matched nothing. Every submodule was being reformatted on each Trio
build. Switch to one --exclude flag per path; that form is unambiguous
across SwiftFormat versions.
@dnzxy
dnzxy marked this pull request as ready for review July 11, 2026 23:38
@MikePlante1

Copy link
Copy Markdown
Contributor

@kingst @MikePlante1 @marv-out how do we feel about adding this to Trio dev?

I’d definitely be fine with adding it as a feature branch, but I think it probably needs a little more testing before getting added to dev.

@dnzxy

dnzxy commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Thanks!

It‘s part of Loop next-dev and we haven’t had any reports of issues. I‘d like to keep # of feature branches to an absolute minimum, because we are actively blocking people from using it by splitting all these device drivers up into different feature branches :-/

@marv-out

Copy link
Copy Markdown
Contributor

I'm okay with adding it to dev to get more testers

@MikePlante1

Copy link
Copy Markdown
Contributor

Maybe at least a "(beta)" label or something if adding it straight to dev?

@dnzxy

dnzxy commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

I suggest we just follow Loop here for once, and move it to dev. It‘s dev for a reason. Merging is only blocked by CI, need to check that.

@kingst kingst left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test it, but LGTM based on code review. I'm fine merging this to dev

@MikePlante1

Copy link
Copy Markdown
Contributor

I suggest we just follow Loop here for once, and move it to dev. It‘s dev for a reason. Merging is only blocked by CI, need to check that.

next-dev != dev, but okay

@marv-out

Copy link
Copy Markdown
Contributor

Merging is only blocked by CI, need to check that.

Seems to be a type check error in Sources/LibreCRKit/Crypto/FirstPairSourceSlice.swift, especially

let cf0Source = [UInt8](repeating: 0, count: 3)
    + [0x05]
    + Array(cf0State[0..<8])
    + Array(cf0State[8..<12])
    + Array(cf0State[12..<14])
let bd0Source = [UInt8](repeating: 0, count: 3)
    + [0x03]
    + Array(bd0State[0..<8])
    + Array(bd0State[8..<12])
    + Array(bd0State[12..<14])

explicitly telling the compiler which types there are seems to fix it, but it probably needs to be PRed against loopandlearn/LibreCRKit

dnzxy and others added 4 commits July 18, 2026 00:36
# Conflicts:
#	.gitmodules
#	Trio/Sources/APS/PluginManager.swift
#	Trio/Sources/Helpers/CGMOptions.swift
…/dev-libre3

# Conflicts:
#	.gitmodules
#	Trio/Sources/APS/PluginManager.swift
#	Trio/Sources/Helpers/CGMOptions.swift
@dnzxy

dnzxy commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Moving this to draft until the 1-min handling is addressed.

@dnzxy
dnzxy marked this pull request as draft July 26, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants