bewest / decoding-carelink

python serial driver for mm comlink2 protocol
http://bewest.github.io/decoding-carelink
Other
71 stars 52 forks source link

Carb ratio on bolus wizard history records #146

Open ps2 opened 8 years ago

ps2 commented 8 years ago

The carb_ratio attribute is being decoded wrong, I believe.

https://github.com/bewest/decoding-carelink/blob/master/decocare/records/bolus.py#L98

 {
    "_type": "BolusWizard", 
    "bg": 100, 
    "bg_target_high": 140, 
    "_description": "BolusWizard 2015-11-14T20:59:47 head[2], body[15] op[0x5b]", 
    "timestamp": "2015-11-14T20:59:47", 
    "_body": "0f5000783c4100003200000000328c", 
    "_head": "5b64", 
    "unabsorbed_insulin_total": 0.0, 
    "correction_estimate": 0.0, 
    "_date": "affb140e0f", 
    "bolus_estimate": 1.25, 
    "bg_target_low": 65, 
    "carb_ratio": 8.0, 
    "food_estimate": 1.25, 
    "carb_input": 15, 
    "sensitivity": 60
  }, 

The carb ratio in my pump is 12, not 8.

I noticed this when comparing decoding results from my minimed_rf and decocare. Here is how I do it: https://github.com/ps2/minimed_rf/blob/master/lib/minimed_rf/log_entries/bolus_wizard.rb#L111

The offsets are different, as mine include the 'head' and '_date' positions.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/28258343-carb-ratio-on-bolus-wizard-history-records?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github).