NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.39k stars 1.14k forks source link

Sensor expiry alert resolution increased to 1 decimal point #3610

Closed Navid200 closed 1 month ago

Navid200 commented 1 month ago

Fixes: https://github.com/NightscoutFoundation/xDrip/issues/3569 Sensor expiry alert shows "Sensor will expire in 1 hour" even if 1.99 hours are still l eft to expiry as shown here: https://github.com/NightscoutFoundation/xDrip/issues/3569.

I can speculate that the intent was for the alert to show 24 hours left and 12 hours left, and 6 hours left and 2 hours left. But, because we want this to be a silent alert, we have made it wait for the screen to be unlocked or the charger to be disconnected.

As a result, when 2 hours are left to expiry, the alert does not trigger. it triggers when the user unlocks the phone after that time. But, the format chosen can only show integer values.

The 24-hour value shows 23 hours are left. The 12 hour alert shows 11 hours are left. It is really bad when the 2-hour alert shows 1 hour left.

This PR rounds down the value to 1 decimal point instead of dropping the fractional part completely.


Not tested yet
I have tested a fictitious case and verified functionality. However, I will test this in real action in 10 days with a G7.

Please let me know if I have overlooked anything.

Navid200 commented 1 month ago

I have tested this with fake data source. Please see the results in the following two images. Please look at the time, the sensor expiry note at the bottom and the sensor expiry alert flag content.
You can see that the sensor expiry alert flag now shows 1 decimal point.
Screenshot_20240804-004914 Screenshot_20240804-004934

Navid200 commented 1 month ago

There is still something wrong: Screenshot_20240812-211628

There seems to be a 0.4-hour discrepancy. That is 60 x 0.4 = 24 minutes.

I will investigate.

Navid200 commented 1 month ago

This one looks much better: Screenshot_20240813-101519 Screenshot_20240813-102011

I may just be looking at the rounding effect to 1 decimal point. Let's see what the 2-hour notification looks like.

Navid200 commented 1 month ago

This looks pretty good to me.
Screenshot_20240813-190657 Screenshot_20240813-190712