pazaan / 600SeriesAndroidUploader

Your Medtronic 600-series pump data, direct to Nightscout
http://pazaan.github.io/600SeriesAndroidUploader/
MIT License
189 stars 312 forks source link

CNL stability and efficiency #213

Closed Pogman closed 5 years ago

Pogman commented 6 years ago

With extended testing it's been discovered that the CNL can send very late responses at a maximum of 20000ms.

Currently there is a general read timeout at 10 seconds and this can miss these occasional late responses. With a rework of pump read/write to cover this, it makes a number of the message clearing safeguards redundant and will decrease the average polling time from around 12 sec to around 8 sec.

For situations where the uploader is constantly in-out of range with the pump and comms are being broken while in progress the risk of producing a E86/E81 CNL error needing a replug increases. Catching these late messages and lost connections stops this happening.

During history reading where there can be 100's of packets being transferred the timeout period needs dynamic adjustment so as to not timeout too early or late. With the in-out range situation the first few packets may be read and the next 60 or 70 etc missed where we would usually have timed out but actually the pump still keeps sending. We may even miss the first 100 packets and get the last 5. We need to allow for this or we may end up with a NAK response due to the pump being in the wrong state for further request commands. If we try to close in this state the CNL will E86.

Pogman commented 5 years ago

Closed - completed and available in 0.7.0 release