ps2/rileylink_ios

incorrect maxBolus in ReadSettings response on x22 pumps

ecc1 opened this issue · 7 comments

ecc1 commented

While debugging my own code and comparing it to yours, I think I found a bug here:
https://github.com/ps2/rileylink_ios/blob/dev/MinimedKit/Messages/ReadSettingsCarelinkMessageBody.swift#L56

I may be misunderstanding your Swift code, but on a x22 model pump, the maxBolus value is in byte 6, not byte 7.
See https://github.com/bewest/decoding-carelink/blob/master/decocare/commands.py#L1274
versus https://github.com/bewest/decoding-carelink/blob/master/decocare/commands.py#L1310
(Ben's indices are all off by 1 compared to yours (and mine)).

Here is some test data:

model 522 pump

C0 15 0C 02 00 05 01 78 00 64 00 00 01 00 01 00 00 64 01 03 00 0F

should produce (among other values):

{
  "AutoOff": "12h0m0s",
  "InsulinAction": "3h0m0s",
  "InsulinConcentration": 100,
  "MaxBolus": 12,
  "MaxBasal": 2.5,
  "RfEnabled": true,
  "TempBasalType": "Absolute",
  "SelectedPattern": 0
}

model 523 pump

C0 19 0C 02 00 01 01 00 8C 00 50 00 00 00 00 00 00 64 01 03 00 14 00 64 00 00

{
  "AutoOff": "12h0m0s",
  "InsulinAction": "3h0m0s",
  "InsulinConcentration": 100,
  "MaxBolus": 14,
  "MaxBasal": 2,
  "RfEnabled": false,
  "TempBasalType": "Absolute",
  "SelectedPattern": 0
}
ps2 commented

What is the RFEnabled field?

ecc1 commented

On Thu, Sep 22, 2016 at 07:02:38PM -0700, Pete Schwamb wrote:

What is the RFEnabled field?

I took this as-is from decocare. I think it's true when either a
remote or a meter has been enabled, otherwise false (but I haven't
verified that).

Eric Cooper e c c @ c m u . e d u

ps2 commented

I just tested on a 522, with some random max bolus values, including 24.9, and this is parsing it correctly.

ps2 commented

Here's the response from my 522 when I set the max bolus to 24.9:

a7 350535 c0 19000400010000f90078000000010000640103000a0032010101000000000000000000000000000000000000000000000000000000000000000000000000000000b0

0xf9 is rxData[7]. rxData[6] is 0, so I don't think that can be right.

ps2 commented

I just tested on a 551 (530G) and it's parsing correctly too. Perhaps this is a 5 vs 7 issue?

ps2 commented

Just tested on a 723 and it's working. Going to close. If you think I'm still missing something, let me know, and I'll reopen it.

ps2 commented

Ah, grabbed the wrong pump; thought I had a 522, but it was a 523.. Will retest on the 522.