Repository navigation
Don't fail a sensor over an event-log error while it is still active - #31
Merged
Merged
Conversation
Bytes 0-6 of patch status are the sensor's latest event-log entry, and they repeat until it logs another. An error code there while the patch state is still active (4) is history, not the sensor's live state: a Libre 3 Plus logged errorData 8 at minute 8083 and kept sending readings, but LibreLoop latched "Replace sensor" / "Sensor failed" until a new sensor was paired (#29). An error code from an active sensor now raises a soft, retractable "Check sensor" notice, as code 7 already did. "Replace sensor" needs the patch state to leave active; a sensor that stops sending glucose already shows signal loss. The alert's event entry is persisted so the same entry doesn't alert again after a relaunch, and discarding a sensor now clears its replacement state, so the next sensor doesn't show "Sensor failed" from its scan until it pairs. Fixes #29
|
Wow, that was quick, thanks @ps2! |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #29.
Bytes 0–6 of the Libre 3 patch status are the sensor's latest event-log entry, and they repeat until it logs another. An
errorDatacode there whilepatchStateis still active (4) is history, not the sensor's live state, but LibreLoop latched "Replace sensor" / "Sensor failed" on it until a new sensor was paired.attention@lifeCount.index) is persisted, so a relaunch or reconnect doesn't alert again for the same entry.discardSensor()now clearssensorNeedsReplacement/sensorEndedNormally, so a new sensor doesn't show "Sensor failed" from its scan until it pairs (from the issue's related problems).Testing
Unit tests: 16/16 pass. Three are new;
testReplacementRecordsTheSensorEndOncenow uses a terminated patch state (6), since errorData 8 with an active sensor is the case this changes.In the iOS Simulator against libre3sim:
POST /event {"errorData":8}(patch state stays 4)sensor attention: checkSensor (rawAttention=replaceSensor, sensorError=terminated, patchState=active); "Check sensor" notice; readings keep forwarding; no Replace Sensor in the HUDsensorIssuePOST /event {"errorData":0}sensor attention: none; notice retractedPOST /terminate {"errorData":8}(patch state 8)sensor attention: replaceSensor; "Replace sensor" alert and HUD status