Don't think we should have a magic number of 500 for this considering this is done on the HD and DG side. Maybe ALARM_ID_MAX_ALARMS = 500 in alarm_defs.py?
Still too many () now. You can still have 2 Hz default publish time if you want - I just didn't like the arrangement. Should be more like ( 500 / TASK_PRIORITY_INTERVAL ) so it is clear that you want every 500 ms.
Consider checking for the Zero each time we execute this state (not just after timeout). Consider moving timeout to the alarm below (give zero time to happen, alarm if timeout). Consider giving alarm a little more than 10 ms (maybe 20 or 30ms) as 10ms is how long it will take to go from init to zero state (i.e. 10ms timeout will occur as soon as we get here).
This might be reservoir 1 - there is a pre-treatment reservoir mgmt function handling this - check to see which reservoir is active at beginning of prime here.
That one is intentional. I actually tried to find a word with a correct meaning with the same character length as Target, Actual, Origin. Since this one is not showing up on any scrip or file other than the code, that is fine.
STEADY_VOLUME_COUNT_SEC is a number of seconds of stability indicating volume is steady. This only works because sampling time above is once per second. If somebody changes the sampling time, this condition will not be right.
There is only one state in this override message. It can be status or state (depending on message ID), but not both. Whichever it is, you are passing it to a function twice as if it is two different things. You need to revert back to having two override messages and two message handlers - one for status and one for state.
I think soon we need to replace these error-prone indexing data extraction with the new conversion functions in the utility module. As an example take a look at ui/hd_simulator.py@1926:
@publish(["ui_version"])
def _handler_ui_version(self, message) -> None:
"""
Handles the ui version response
@param message: The ui version response message
@return: None
"""
payload = message['message']
index = DenaliMessage.PAYLOAD_START_INDEX
major, index = bytearray_to_byte(payload, index, False)
minor, index = bytearray_to_byte(payload, index, False)
micro, index = bytearray_to_byte(payload, index, False)
build, index = bytearray_to_short(payload, index, False)
compt, index = bytearray_to_integer(payload, index, False)
self.ui_version = f"v{major}.{minor}.{micro}.{build}.{compt}"
self.logger.debug(f"UI VERSION: {self.ui_version}")
if self.console_out:
print("Version:", self.ui_version)