nightscout / AndroidAPS

Opensource automated insulin delivery system (closed loop)
https://wiki.aaps.app
GNU Affero General Public License v3.0
694 stars 1.7k forks source link

[3.0-beta1] Medtronic SMBs show as Meal Boluses as well as Incorrect IOB calculation from temp basals #798

Closed siggy226 closed 2 years ago

siggy226 commented 2 years ago
  1. Using Medtronic, SMBs initially show correctly, but after 10-15 minutes get changed to appear as meal boluses. I read issue #739, was unclear what that setup was (I've never heard of a Dexcom app uploading to NS). In my setup, only AAPS is uploading to NS, and switching to Dash driver with all other settings identical shows SMBs correctly. image

  2. When AAPS has set a 0 temp basal for 30 or 90 minutes it is applying the full negative IOB, even though a new rate is set after the next loop. In this case, a 90 minute 0.00 basal was set at 2:14, the full 90 minutes of IOB was deducted. At 2:19, 0.00 was set again for 90 minutes, and the full 90 minutes of IOB was deducted, even though those rates only actually ran for 5 minutes each. Same occurred at 2:39AM with 30 minutes of IOB deducted even though it only ran for 5 minutes. image

andyrozman commented 2 years ago

@siggy226 I will need logs for that... Can you reproduce that?

This is situation that should be resolved by reading history, but there seems to be some weird problem somewhere...

siggy226 commented 2 years ago

Logs uploaded here: https://drive.google.com/drive/folders/1ynmcsDaHBumSsVACpbhk6MkcklXdvmzm?usp=sharing

I switched back over to a Dash pod right after I noticed the issue and haven't gone back to reproduce.

jroth-haj commented 2 years ago

@andyrozman do you need more logs?

andyrozman commented 2 years ago

I think I know where the problem lies, so I am trying to fix it (TBR one), problem with boluses is little more global, and will require more investigation. @siggy226 will you be able to test this, as soon as I am done with fix? Should be done by end of day on sunday.

@jroth-haj If you can help test this, this would be great... Are you experiencing the same problem?

andyrozman commented 2 years ago

So both fixes are ready in my branch, if you guys could test it. I don't have SMB on my test device, so I couldn't test it myself... @siggy226 @jroth-haj

https://github.com/andyrozman/AndroidAPS/tree/bug798_meal_tbr

siggy226 commented 2 years ago

@andyrozman I can build later today and test

siggy226 commented 2 years ago

@andyrozman SMBs look good. Thank you!

Temp basals/IOB are still an issue (see 3:05 and 3:40 entries). I tested by enacting some high temp targets to get a 0.00 u/hr rate, then cancelling the temp target to trigger loop to restart an actual rate. Profile basal at this time is 1.3 u/hr. Manually refreshing pump history a few times didn't make any changes. image

I also noticed that AAPS is a bit all over the place with display though as well: Pump shows 4.95 (which matched what loop requested), 29 minutes remaining: image Treatments shows the rate of 4.95 started: image MDT tab shows 5.0 (rounded from 4.95), but 13 minutes remaining: image Action tab says I can cancel a rate of 2.80: image Home shows scheduled basal of 1.75, but graph shows an increased rate: image

Logs: AndroidAPS._2021-10-3112-48-43.log

andyrozman commented 2 years ago

Ok, so I found the problem, and its real whooper... It seems that Zero TBR are not time limited (when normal TBR is cancelled we get cancel command in history (rate=0, duration=0), this doesn't happen if we have standard Zero TBR, so duration shown (and taken by us is always full one)... The problem was there since the beginning and nobody noticed this before...

I know what I need to fix, and I will do it in next few days... I will send notification here when its ready to be tested...

siggy226 commented 2 years ago

Thanks for the effort. I'll be on the lookout and ready to test.

andyrozman commented 2 years ago

I checked in the fix, so both issues should be fixed. Can you please check it if it works for you... @siggy226

siggy226 commented 2 years ago

@andyrozman Installed today and testing. Initial test, the fix looks good. I will let it run for a while and report back.

siggy226 commented 2 years ago

Edit: Noticed I had installed the old build, not the new one. Continue to test with correct build now.

siggy226 commented 2 years ago

@andyrozman I tried 2 installs, the first over the top of the last build. On initial connection to the pump while reading history AAPS would crash and restart. I then cleared data, uninstalled and did a fresh install. This ran for a short time, but then again entered a loop of read history > crash > restart. I attached the recent log, but can grab further back if you need them. AndroidAPS.log

andyrozman commented 2 years ago

@siggy226 So I looked at both logs... The first one is done with older version of App... The second actually had a problem. I refactored code a little so it should work now... Please let me know...

andyrozman commented 2 years ago

@siggy226 Any news about this? Does it work now?