-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add recommended bolus and pump bolus increment to Nightscout devicestatus #793
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
base: dev
Are you sure you want to change the base?
Add recommended bolus and pump bolus increment to Nightscout devicestatus #793
Conversation
|
I made some updates to this PR, see below:
|
|
My son is using this branch, it has been running without issues. Currently developing the LoopFollow side of this. |
|
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. |
… throttle) + APS triggers uploads
|
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. |
dnzxy
left a comment
There was a problem hiding this 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 .
kingst
left a comment
There was a problem hiding this 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.
| extension BaseNightscoutManager { | ||
| /// Call once from init. Hooks up: | ||
| /// 1) external upload requests (NotificationCenter) | ||
| /// 2) Core Data change triggers → kicks per lane |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[minor / optional] I haven't seen the phrases kick or lane, is this a standard nomenclature for Combine workflows? I think I understand what it means, but maybe lanes are classes / objects and kicks are sends? I'm not 100% sure so this comment is optional
| private let queue = DispatchQueue(label: "BaseNightscoutManager.queue", qos: .background) | ||
| private var coreDataPublisher: AnyPublisher<Set<NSManagedObjectID>, Never>? | ||
| private var subscriptions = Set<AnyCancellable>() | ||
| let queue = DispatchQueue(label: "BaseNightscoutManager.queue", qos: .utility) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change the qos, was there priority inversion?

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.