Skip to content
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

Floating point accuracy fix in set_temp_basal #198

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

Conversation

cjo20
Copy link

@cjo20 cjo20 commented Jul 15, 2016

Basal rates weren't being set correctly in the pump (e.g. 0.6u/hr was being set as 0.575u/hr)

if rate = 0.6:

>>> int(0.6/0.025)
23
>>> 0.6/0.025
23.999999999999996

If the user is trying to set a basal rate that the pump can support, this should always result in better behaviour than the current code. oref0 dev should only try to set supported rates.

If users try to set basal rates not supported by the pump, it could end up setting a rate up to 0.0125u/hr more than they requested.

@scottleibrand
Copy link

scottleibrand commented Jul 15, 2016

Can you PR this against the openaps/decocare repo as well? Not sure which branch, but that same file is at https://github.com/openaps/decocare/blob/master/decocare/commands.py#L296 in master.

@cjo20
Copy link
Author

cjo20 commented Jul 16, 2016

Done here: openaps/decocare#2

@scottleibrand
Copy link

Merged openaps/decocare#2 and tested. Confirmed it allows setting a 0.6U/hr temp, whereas without this fix it ended up at 0.575U/hr. 👍 for merge

@scottleibrand
Copy link

Per openaps/decocare#1 it looks like this branch is no longer used by openaps, so it's up to @bewest whether he wants to try to keep it in sync with openaps/decocare or not.

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