Improved verification and checking to prevent possible 0x31 pod faults#110
Conversation
itsmojo
commented
Jan 12, 2024
- Add new non-persistent deliveryStatusVerified podState boolean
- Validate podState insulin delivery state against each pod status return
- Never schedule a basal if pod might possibly be not suspended
- Never start a bolus if one might be possibly be running
- Never start a temp basal if one might possibly be running
- Add optimzation to skip cancelTB before setting a TB when safe to do so
- Add new PodCommsError for pod setup not complete condition
- Add checks to never do a cancel command unless pod setup is complete
- Use matching generic PumpManager error comment strings
- Add unacknowledgedCommand checking to acknowledgeAlerts()
- Add unacknowledgedCommand checking to configureAlerts()
- Update residual OmnipodKit framework comment to OmniBLE
- Update some Unacknowledged command logging to match elsewhere
- Expanded and updated variable use comments
+ Add new non-persistent deliveryStatusVerified podState boolean + Validate podState insulin delivery state against each pod status return + Never schedule a basal if pod might possibly be not suspended + Never start a bolus if one might be possibly be running + Never start a temp basal if one might possibly be running + Add optimzation to skip cancelTB before setting a TB when safe to do so + Add new PodCommsError for pod setup not complete condition + Add checks to never do a cancel command unless pod setup is complete + Use matching generic PumpManager error comment strings + Add unacknowledgedCommand checking to acknowledgeAlerts() + Add unacknowledgedCommand checking to configureAlerts() + Update residual OmnipodKit framework comment to OmniBLE + Update some Unacknowledged command logging to match elsewhere
ps2
left a comment
There was a problem hiding this comment.
Thanks Joe. I think tackling these errors is really needed, and I appreciate you working on it. See my comments about deliveryStatusVerified. I think at least by that name, that's what unacknowledgedCommand is trying to track. It looks like this new var is maybe also trying to track when we've detected a state corruption of some sort, like when a TB is running, but our state says it's not. Maybe for this particular use, the variable could be renamed to something that indicates that, maybe "deliveryStateInconsistencyDetected" or something like that?
…cted + Improved logic and comments for possible safety suspend before set basal + Updated comments for renamed non-persistent state with a reversed sense
|
Tested with both the previous version and the newly renamed variable with updated logic.
I'm not sure how to trigger a fault that would have caused an 0x31 to be sent in before making this modification. |
There was a problem hiding this comment.
The deliveryStateInconsistencyDetected variable seems to be tracking three things:
- Our PodState is out of sync with DeliveryStatus (updateDeliveryStatus setting deliveryStateInconsistencyDetected to true))
- We haven’t talked to the pod yet (PodState initializers)
- We sent a message (podCommsSession.send), but didn’t process the response (updateDeliveryStatus setting deliveryStateInconsistencyDetected to false)
I'm ok adding something for no. 1, and this var name makes sense, and the calls around this use case make sense, but maybe could be persisted; if we detect a problem, and the app then quits, it'd still be appropriate to be tracking this, no?
For no. 2, piggybacking and using the same var for the no. 1 use case is maybe not great. This use case doesn't need persistence.
For no. 3, this is what the unacknowledged command system is tackling. I really don't like having another layer trying to track this. If we are missing things, like the acknowledgeAlerts not checking for unacknowledged commands, then they should be added. But please focus on fixing the system we already have instead of adding another mostly redundant system.
+ Updated commenting and variable testing to make things more obvious + Return noResponse for bolus check comms error instead of unfinalizedBolus + DeliveryStatus improvements to fix var name typo and add a suspended var + New optional initialDeliveryStatus parameter for PodState.init() for testing + Have runTemporaryBasalProgram() match the OmniKit version
|
Code review:
Test with an rPi DASH (simulated) pod running code that has OmniBLE PR 110 applied to the code.
I did a few test cases: Standard code (with PR)
Standard code (with PR)
I then applied a test patch that overwrites the lastDeliveryStatusReceived with a flag indicating a temporary basal is running: Standard code (with PR and test patch)
Standard code (with PR and test patch)
Restored to Standard code (with PR):
|
|
|
||
| if status.lastProgrammingMessageSeqNum == pendingCommand.sequence { | ||
| self.log.debug("Unacknowledged command was received by pump") | ||
| self.log.default("Unacknowledged command was received by pump") |