pimpimmi / LibreAlarm

https://plus.google.com/communities/118306966582165178782
GNU General Public License v3.0
52 stars 48 forks source link

Use multi-block reading mode and better mask #23

Closed jamorham closed 8 years ago

jamorham commented 8 years ago

The PR adds multi-block reading mode (enabled by default in the code) which reduces the number of required NFC transactions by a factor of 3. In other tests I have done this significantly speeds up reading and reduces the chance for transaction errors and should also save battery.

As discussed previously, this PR there is a new mask of 0x0FFF when converting values. With the conversion algorithm currently in place this would give a max value of 409mg/dl or approx 22 mmol.

I think this is quite close to the upper value the sensor can report and without this I think there can be incorrect random high values reported.

Please let me know what you think? I have seen the 0x0FFF mask used in other similar apps but I don't know whether at high levels this is correct or whether it will "wrap around" to a lower value. This would need testing, but that is difficult!

I have left that item commented out of the code for now as it is a very significant change.