check glucose >= 40 #83
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have observed occasionally that the state
.needCalibration14
coincides with an unreliable glucose reading ('---'). Presumably, if an entered calibration is too far off the regression line, the logic is to stop supplying glucose readings until a new calibration has been provided. On these occasions (and also all states for whichhasReliableGlucose
isfalse
the glucose bytes in the glucose Rx message are0500
(a 'glucose' of 5 mg/dL).With this PR, the
glucose
property inGlucose
returnsnil
ifglucoseMessage.glucose
is less than 40 (the range of the Dex system is 40 - 400 mg/dL).Incidentally, since the glucose bytes in the glucose Rx message are always
0500
when the glucose is unreliable, it may be unnecessary to compute thehasReliableGlucose
property inCalibrationState
and check for it here.Update: for some reason the glucose bytes are
0100
in the.stopped
state (a 'glucose' of 1 mg/dL). However, the logic here still holds.