Skip to content

Conversation

@bjorkert
Copy link
Member

@bjorkert bjorkert commented Oct 6, 2025

This PR adds two fields to the Nightscout upload so clients like LoopFollow can display a correction recommendation and respect the pump’s bolus step:
• openaps.recommendedBolus — the treatment view equivalent recommended correction bolus, for no new carbs.
• pump.bolusIncrement — the smallest supported bolus volume from the active pump.

@bjorkert
Copy link
Member Author

bjorkert commented Oct 6, 2025

CleanShot 2025-10-06 at 13 00 21

@bjorkert
Copy link
Member Author

I made some updates to this PR, see below:

  • Removed NightscoutManager injection from APSManager to eliminate the circular dependency.
  • NightscoutManager now directly @injects BolusCalculationManager and APSManager (in stead of the ad-hoc resolve()).
  • Deleted Nightscout upload calls from APSManager loop, Nightscout is already updated via Core Data subscriptions. This avoids a second, redundant upload path that could potentially create duplicates.
  • The uploaded bolusIncrement sourced from preferences instead of pumpmanager.

@bjorkert
Copy link
Member Author

My son is using this branch, it has been running without issues. Currently developing the LoopFollow side of this.

@bjorkert bjorkert marked this pull request as draft October 20, 2025 14:08
@bjorkert
Copy link
Member Author

Doing some refactoring and re-implementing upload triggering from APSManager to catch situations where the upload based on data fails, but in a way that prevent duplicate uploads. Changing this PR to a draft while working/testing.

@bjorkert
Copy link
Member Author

bjorkert commented Oct 20, 2025

Pulled the Nightscout subscriber logic into BaseNightscoutManager+Subscribers.swift and added lane-based “kick” pipelines (2s throttle) to avoid double uploads. APSManager now requests uploads via requestNightscoutUpload (carbs/pumpHistory/overrides/tempTargets).

I'll resume testing and will open up this for review again if/when I am happy with the tests.

@bjorkert bjorkert marked this pull request as ready for review October 31, 2025 12:48
Copy link
Contributor

@dnzxy dnzxy left a comment

Choose a reason for hiding this comment

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

I'll approve this based on in-vivo testing on my end and in-vivo testing with LFxTrio on @bjorkert 's end with his son's setup.

Jonas and I have discussed this PR extensively via DM over the last ~2 weeks.
Are we okay with the naming and changes here? Functionality-wise it's okay, but it is a bigger change, so asking you folks, too, @marv-out @kingst .

Copy link

@kingst kingst left a comment

Choose a reason for hiding this comment

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

Overall this LGTM. I didn't test it, my review is just from reading the code. I have one optional suggestion and one question but in general this PR is ready to go.

@salguccio
Copy link

[bjorkert] I wanted to thank you for this feature, which thanks to you, hundreds of people are using for their children. It works great with precise advice. I also thank all the other developers who make life easier for all of us. Thank you...

@dnzxy
Copy link
Contributor

dnzxy commented Nov 21, 2025

How are 100s of users using a feature that has not been merged to either LoopFollow or Trio, @salguccio ?

@dnzxy
Copy link
Contributor

dnzxy commented Nov 21, 2025

If @kingst is fine with these changes, so am I. LGTM!

Copy link

@kingst kingst left a comment

Choose a reason for hiding this comment

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

The changes lgtm, ship it!

@dnzxy dnzxy merged commit c5d55ef into nightscout:dev Nov 21, 2025
3 checks passed
@salguccio
Copy link

Come fanno centinaia di utenti a utilizzare una funzionalità che non è stata unita né a LoopFollow né a Trio?@salguccio?

I help so many people who personally ask me for help... and I apply the patch because I know it works without any problems... in fact I can't wait for you to publish the dev version applying everything natively... if you want I can have you write to the people who are using it for their children personally... I created a chat on WhatsApp of all of us users I'll send you the screenshot of how many we are... Anyway thanks guys... you are precious for us dysbetics and for the parents THANK YOU....!!!!

@salguccio
Copy link

WhatsApp Image 2025-11-21 at 23 59 46

We are not that many, but there are more than 200 parents who follow their children...

@dnzxy
Copy link
Contributor

dnzxy commented Nov 23, 2025

Come fanno centinaia di utenti a utilizzare una funzionalità che non è stata unita né a LoopFollow né a Trio?@salguccio?

I help so many people who personally ask me for help... and I apply the patch because I know it works without any problems... in fact I can't wait for you to publish the dev version applying everything natively...

Please don’t do that @salguccio . The whole point of a pull request is for developers (read: people who understand the changes and possible side effects) to have the chance to review the code, test it, if necessary ask for adjustments, and once approved, have it merged.

Unless you are specifically asked to build a pull request to test it, you DO NOT just apply it and you absolutely DO NOT ship an unfinished pull request to other users who run Trio ON THEIR CHILDREN.

I am AMAZED I need to put this in writing.

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.

4 participants