Skip to content

Round to supported rate before setting temp basal rate #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MikePlante1
Copy link

The issue this addresses would not be noticed with Loop, as Loop rounds before attempting to enact a temporary basal rate. This issue became apparent when using Trio, though, since Trio does not round before attempting to enact a temporary basal rate, leaving the task of rounding up to the pump's submodule. OmniBLE and OmniKit both already internally handle this rounding task, so this PR aims to add it to MinimedKit as well.

@MikePlante1
Copy link
Author

I added this commit to my in-vitro build of Trio-dev.

I added a debugging log message in Trio whenever it attempts to enact a temp basal rate that is unsupported by the pump. Before when this was triggered, I would check Trio's History and see two temp basal records for the same time and one of them would be for the unsupported rate. Here's an example of that:

Since adding this commit to my in-vitro Trio build, however, I have had a couple log messages for attempts to enact an unsupported basal rate, but Trio's History only shows the single rounded and supported temp basal rate. Given this, I think this commit solves this issue.

@marionbarker
Copy link
Contributor

Status

Changes look good.

Code Review

The code changes look appropriate and necessary for an app that relies on the pump manager to manage allowed pump basal rates.

Test

  • Loop test, below, was successful
  • Trio test, previous comment, was successful

Loop tests

Loop will not call with a rate that is not "allowed". So this test is to just ensure Loop continues to work as expected with the modification.

Configuration

  • LoopWorkspace dev branch, commit 3d48a5c
  • Use MinimedKit version from this PR, commit 1b7168b
  • Build on to SE 2nd gen phone running iOS 18.4
  • Add MDT 515 pump to Loop

Test Scenario

  • Set Dosing Strategy to Temp Basal only
    • Change the glucose source which caused an abrupt drop in glucose, so initially Loop lowered TB
    • Configure glucose trace to be flat and add carbs but do not bolus
  • As Loop commands a change to TB for MDT, report rates on Loop display and pump in table below
    • first indication was when scheduled basal was running
Loop MDT display Basal Type MDT pump display
1.45 Sch 1.45
0.45 TB 0.45
1.45 Sch 1.45
6.00 TB 6.0

Loop continues to work as expected. (maxBasal setting in therapy is 6 U/hr)

Trio tests

I did not reproduce the error or resolution for Trio because @MikePlante1 already did that in the previous comment.

Copy link
Contributor

@marionbarker marionbarker left a comment

Choose a reason for hiding this comment

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

Approving from code review and test.

@ps2 ps2 self-requested a review April 6, 2025 18:16
Copy link
Contributor

@ps2 ps2 left a comment

Choose a reason for hiding this comment

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

The responsibility should be for the caller to send the right rates.

  1. For automated dosing, it is important that the algo is making the right decision for rounding (up or down).
  2. For manual dosing, it's important that the user know what rate they are setting.

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