Skip to content

Format Rec. Bolus with the pump's bolus increment#700

Open
bjorkert wants to merge 2 commits into
devfrom
fix/rec-bolus-formatting
Open

Format Rec. Bolus with the pump's bolus increment#700
bjorkert wants to merge 2 commits into
devfrom
fix/rec-bolus-formatting

Conversation

@bjorkert

@bjorkert bjorkert commented Jul 8, 2026

Copy link
Copy Markdown
Member

Rec. Bolus was formatted two different ways. The Loop device status parser used a hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser went through InsulinMetric, which drops to one fraction digit below 10 U. The same recommendation rendered as 0.00U in the info table on a Loop URL and 0 on a Trio URL.

Both parsers now use InsulinFormatter, which derives its fraction digits from the pump's reported bolusIncrement, so Rec. Bolus is shown at the precision the pump can actually deliver — two decimals for a 0.05 U DASH pod. The unit suffix is dropped to match the other insulin rows in the info table.

When the device status carries no recommendation, the info row and deviceRecBolus are now cleared. Previously the Loop parser left both stale, so an old recommendation could linger in the info table, the Rec. Bolus alarm condition, and the Live Activity.

The Loop device status parser formatted Rec. Bolus with a hardcoded
String(format: "%.2fU"), while the OpenAPS/Trio parser routed the value
through InsulinMetric. The same recommendation rendered as "0.00U" on a
Loop URL and "0" on a Trio URL. Use InsulinMetric on both paths.
Rec. Bolus was formatted two different ways: the Loop parser used a
hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser went
through InsulinMetric, which drops to one fraction digit below 10 U. The
same recommendation rendered as "0.00U" on a Loop URL and "0" on a Trio
URL.

Both parsers now use InsulinFormatter, which derives its fraction digits
from the pump's reported bolusIncrement, so the value is shown at the
precision the pump can actually deliver. The unit suffix is dropped to
match the other insulin rows in the info table.

Clear the info row and deviceRecBolus when the device status carries no
recommendation, so a stale value can't linger in the info table, the
Rec. Bolus alarm condition, or the Live Activity.
@bjorkert bjorkert changed the title Format Loop's recommended bolus with InsulinMetric Format Rec. Bolus with the pump's bolus increment Jul 8, 2026
bjorkert added a commit that referenced this pull request Jul 9, 2026
Rec. Bolus was formatted two different ways: the Loop parser used a
hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser went
through InsulinMetric, which drops to one fraction digit below 10 U. The
same recommendation rendered as "0.00U" on a Loop URL and "0" on a Trio
URL.

Both parsers now use InsulinFormatter, which derives its fraction digits
from the pump's reported bolusIncrement, so the value is shown at the
precision the pump can actually deliver. The unit suffix is dropped to
match the other insulin rows in the info table.

Clear the info row and deviceRecBolus when the device status carries no
recommendation, so a stale value can't linger in the info table, the
Rec. Bolus alarm condition, or the Live Activity.
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.

1 participant