Skip to content

Add sensor life configuration for Anubis transmitters #8

Merged
marionbarker merged 3 commits into
loopandlearn:devfrom
MikePlante1:anubis
Jul 20, 2026
Merged

Add sensor life configuration for Anubis transmitters #8
marionbarker merged 3 commits into
loopandlearn:devfrom
MikePlante1:anubis

Conversation

@MikePlante1

Copy link
Copy Markdown

Summary

Adds user-configurable sensor session length (10–60 days) for Anubis-modded
G6 transmitters, while stock G5/G6 transmitters keep the standard 10-day
session. Also limits the sensor lifecycle progress bar on the main view so it
only appears during the final 48 hours of a session, matching G7SensorKit
behavior.

Builds on the earlier work surfacing G5/G6 sensor lifecycle and detecting
Anubis-modded transmitters via the version frame.

Changes

  • Anubis detection: the transmitter expiry (bytes 13–14 of the version-rx
    frame) is read on connect until known (needsExpiryRead) and persisted in
    TransmitterManagerState; a reported 180-day lifetime identifies an Anubis
    transmitter.
  • Configurable sensor life: transmitter settings gain a wheel picker for
    session length (10–60 days), shown for Anubis transmitters only. The value
    is clamped, persisted across app restarts, and stock transmitters remain
    fixed at 10 days.
  • Dynamic session expiry: sessionExpDate is stamped on each reading from
    the configured sensor life, and refreshed when the setting changes or the
    transmitter reports its expiry.
  • Sensor-start event metadata: the logged sensor-start event now uses the
    configured expectedLifetime, and a warmupPeriod of 50 min for Anubis vs
    2 h for stock.
  • Progress bar visibility: the session lifecycle ring stays hidden until
    the final 48 h of the session (warning state inside 24 h, critical at
    expiry), matching G7SensorKit. Without this gate the bar sits on the main
    view for the entire session. The warmup ring is unaffected.
1 2

Implements user-configurable sensor session length (10–60 days) for Anubis-modded transmitters, while maintaining stock 10-day sessions for standard G5/G6 transmitters.

Key changes:
- Transmitter version frame detection identifies Anubis modification (180-day expiry)
- sessionExpDate now updated dynamically based on configured sensor life
- Warmup period adjusted for Anubis (50 min) vs stock (2 h)
- Settings UI provides wheel picker for sensor life selection (10–60 days)
- State persistence for selected sensor life across app sessions
Add a guard statement to keep the session progress ring hidden until the transmitter session enters its final 48 hours. This improves the user experience by reducing visual clutter during the early stages of a session.
@MikePlante1
MikePlante1 requested a review from dnzxy July 17, 2026 04:21
@dnzxy

dnzxy commented Jul 20, 2026

Copy link
Copy Markdown

@marionbarker I'd like to merge this. Then we PR this from here to upstream CGMBLEKit. Is that okay with you? No one other than Trio uses this forked submodule afaik?

@dnzxy
dnzxy requested a review from marionbarker July 20, 2026 12:02
@dnzxy

dnzxy commented Jul 20, 2026

Copy link
Copy Markdown

@ps2 could you have a brief look at this, if you can accept this as-is to LoopKit?

@MikePlante1

Copy link
Copy Markdown
Author

@marionbarker I'd like to merge this. Then we PR this from here to upstream CGMBLEKit. Is that okay with you? No one other than Trio uses this forked submodule afaik?

Since LoopKit#215 is open from dev, merging this PR will just update that one.

@marionbarker

Copy link
Copy Markdown

No. I keep loopandlearn trio branch available for any items like this where loopandlearn differs from the upstream fork.

  • It is very confusing even with this restriction, I never want to see loopandlearn dev (or main) ahead of any LoopKit upstream fork

I see that tests were requested and submitted for LoopKit#215.

That PR (215) should never have been submitted from loopandlearn dev branch. It should have been from a feature branch.

Is the MikePlante1:anubis branch what you want to have eventually merged into LoopKit/CGMBLEKit?

@marionbarker

Copy link
Copy Markdown

OK @MikePlante1 explained the situation to me. I was not noticing when #6 and #7 went past.
I'm willing to compromise. We can clean up the branches at loopandlearn after the fact since they are already ahead of the upstream fork.

@marionbarker

Copy link
Copy Markdown

Test

✅ successful test

Trio Test

Started with Trio dev branch, 0.8.4.24, and then pointed to MikePlante1:anubis for CGMBLEKit.
Since I don't have an Anubis, I modified CGMBLEKit/CGMBLEKit/TransmitterManager.swift, line 456 to always return true for isAnubis var. This revealed the Sensor Life row, in which I could pick values from 10 to 60 days.

Loop Test

Started with Loop dev branch, v3.14.3, and then pointed to MikePlante1:anubis for CGMBLEKit.
Since I don't have an Anubis, I modified CGMBLEKit/CGMBLEKit/TransmitterManager.swift, line 456 to always return true for isAnubis var. This revealed the Sensor Life row, in which I could pick values from 10 to 60 days.

@marionbarker marionbarker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There are several places within the last few commits for Anubis where the Trio countdown ring is explicitly mentioned.

This should be agnostic to how the OS-AID app is using the lifecycle and warmup duration. Loop uses a line underneath the CGM display, Trio uses a ring. I would prefer those comments be updated to refer to lifecycle or warmup.

This is found in 3 places:
CGMBLEKit/CGMBLEKitUI/TransmitterManager+UI.swift
lines 105, 106 and 124.

@marionbarker marionbarker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Approve from code review and test for Trio and Loop.

@marionbarker
marionbarker merged commit 976a4d8 into loopandlearn:dev Jul 20, 2026
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.

3 participants