Skip to content

Forward the newest trend reading, not the oldest - #58

Merged
ps2 merged 1 commit into
next-devfrom
fix-newest-trend-reading
Oct 18, 2026
Merged

ps2 merged 1 commit into
next-devfrom
fix-newest-trend-reading

Conversation

@ps2

@ps2 ps2 commented Oct 13, 2026 •

Copy link
Copy Markdown

Since afba845 ("Sort glucose before filterDateRange", May 2026), glucosesToSamplesFilter returns readings oldest-first. The MiaoMiao/Bubble path in LibreTransmitterManager+Transmitters.swift still keeps trends.first as "the newest" reading.

Each cycle filters to readings newer than the previous cycle's newest reading (latestBackfill). .first then picks the oldest of those. So Loop gets a reading from the start of the interval since the last cycle, about one cycle (~5 min) older than the current one, rather than the current reading.

This changes it to .last, the same as the Libre 2 EU path (LibreTransmitterManager+Libre2EU.swift).

Tested by building only; there's no MiaoMiao/Bubble hardware here to check against.

glucosesToSamplesFilter returns readings oldest-first since afba845 (Sort glucose before filterDateRange), but the MiaoMiao/Bubble path still kept trends.first as the newest, so it forwarded the oldest new trend reading each cycle. Use .last, as the Libre 2 EU path does.
@ps2
ps2 requested a review from dabear October 13, 2026 16:40
@dabear

dabear commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

LGTM.
As a FYI;
I am considering if dropping libre1+miaomiao/bubble, libre2+miaomiao/bubble and libre2+ miaomiao/bubble makes any sense. The libre1 path is probably entirely free of users since the sensor is globally discontinued. Some reports indicate mexico still sell libre 1 though.

By dropping third party transmitter support, (some of which actively block phone nfc scan from working), we could focus more on the libre 2 and 2 plus direct path, allowing also activation of the sensor via phone nfc scan .

This is just some thoughts for now.

@ps2

ps2 commented Oct 18, 2026

Copy link
Copy Markdown
Author

Yes, I don’t have actual stats on usage of libre one so I can’t say one way or the other whether or not it’s still being used but if we have good evidence that it’s not I think it does definitely make sense to drop it.

@ps2
ps2 merged commit dde20cd into next-dev Oct 18, 2026
ps2 added a commit to LoopKit/LoopWorkspace that referenced this pull request Oct 19, 2026
Loop: issue reports to the LoopKit developers (LoopKit/Loop#2585), even
alarm loudness (LoopKit/Loop#2589), stop AlarmKit alarms after a relaunch
(LoopKit/Loop#2590), alarms play through silent mode (LoopKit/Loop#2591),
carb entry sync identifier (LoopKit/Loop#2587).

LoopKit: watch glucose duplicate crash (LoopKit/LoopKit#655), chart
back-gesture (LoopKit/LoopKit#656, LoopKit/LoopKit#658), iOS 17.6 and
watchOS 10.6 (LoopKit/LoopKit#659), previous pump's reservoir values
(LoopKit/LoopKit#657), carb entry sync identifier (LoopKit/LoopKit#654).

LibreLoop: not-an-Abbott-product notice (LoopKit/LibreLoop#25), iOS 17.6
(LoopKit/LibreLoop#26), backfilled readings in Recent Readings
(LoopKit/LibreLoop#27).

LibreTransmitter: forward the newest trend reading (LoopKit/LibreTransmitter#58).

EversenseKit and MixpanelService: iOS 17.6 (LoopKit/EversenseKit#7,
LoopKit/MixpanelService#9).
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.

2 participants