JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
339 stars 337 forks source link

Implemented Insulin on Board. #366

Open eduardopietre opened 2 years ago

eduardopietre commented 2 years ago

Insulin on Board implementation, all done locally. OpenAPS docs were used as reference for this implementation: https://openaps.readthedocs.io/en/latest/docs/While%20You%20Wait%20For%20Gear/understanding-insulin-on-board-calculations.html

This commit features:

Things to notice:

Sample screenshot: Simulator Screen Shot - iPhone 8

bjornoleh commented 2 years ago

Hi,

I had a look at your contribution. Looks good at first glance!

Some suggestions:

I am also unsure about what "Enable display" does. I only see the chart turn on/off with the "show on chart" setting. Should the current/historical (during scrolling) IOB value be displayed somewhere?

IMG_8E360349C1AF-1

loopy321 commented 2 years ago

This looks great! Thanks! I was wondering if borrowing from loopkit would aid in implementing COB and predictions to get something like: https://github.com/LoopKit/Loop/blob/dev/Documentation/Screenshots/Phone%20Graphs.png

LiroyvH commented 2 years ago

We should perhaps also free some screen real-estate to simply show a total IOB (and perhaps COB). Perhaps below the pie-chart is an option. Currently the text there mimics the days setting; so it's pretty much redundant. If IOB is enabled, showing the IOB there as a number may be a nice touch.

Just an idea. :)

bjornoleh commented 2 years ago

Agreed. And perhaps move the pie chart to the far left, so it can sit close to the days setting.

eduardopietre commented 2 years ago

Hi, Thanks for all the feedback! About the label / displaying the IOB value on screen, there are two TODOs annotations at RootViewController.swift: here and here. The logic to calculate these values is already on place, the only work missing is the user interface itself. However, I lack the UI experience and talent needed to create it.

Recently I have had close to no free time to code. COB would be a very nice addition, and could even reuse most of the plotting logic. Unfortunately, I'm not able to work on it right now. Feedback is appreciated, Thanks!

loopy321 commented 2 years ago

Can IOB be added to the calendar events? I'm guessing here