Index: dialin/common/msg_defs.py =================================================================== diff -u -r1fd5bc0ed97d0d90223fa78ec195dd7636712c5b -rd4cf7e98bfe73fde95043613fa894b64b57d11a8 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 1fd5bc0ed97d0d90223fa78ec195dd7636712c5b) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision d4cf7e98bfe73fde95043613fa894b64b57d11a8) @@ -25,6 +25,7 @@ MSG_DIALIN_ID_UI_SYSTEM_USAGE_REQUEST = 0x89 MSG_DIALIN_ID_HD_SYSTEM_USAGE_RESPONSE = 0x8A MSG_DIALIN_ID_DG_SYSTEM_USAGE_RESPONSE = 0x8C + MSG_DIALIN_ID_HD_VALVES_POSITION_COUNT_OVERRIDE = 0x8058 MSG_DIALIN_ID_HD_DISINFECT_STATE = 0x7E Index: dialin/dg/hd_proxy.py =================================================================== diff -u -r597b213629a8243dd0d76ee5fe16f7b83e64483f -rd4cf7e98bfe73fde95043613fa894b64b57d11a8 --- dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision 597b213629a8243dd0d76ee5fe16f7b83e64483f) +++ dialin/dg/hd_proxy.py (.../hd_proxy.py) (revision d4cf7e98bfe73fde95043613fa894b64b57d11a8) @@ -74,7 +74,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_fill(self, volume:int=1500, start:int=1) -> int: + def cmd_fill(self, volume: int = 1500, start: int = 1) -> int: """ Constructs and sends the fill command. Constraints: @@ -105,20 +105,20 @@ self.logger.debug("Timeout!!!!") return False - def cmd_drain(self, volume:int=200, tare_load_cell:bool=False) -> int: + def cmd_drain(self, volume: int = 200, tareLoadCell: bool = False) -> int: """ Constructs and sends the drain command. Constraints: DG must be in re-circulate mode. Given drain to volume must be between 0 and 1950 mL. @param volume: unsigned int - volume (in mL) to drain the inactive reservoir to. - @param tare_load_cell: bool - flag indicates to tare loadcell. + @param tareLoadCell: bool - flag indicates to tare loadcell. @return: 1 if successful, zero otherwise """ vol = integer_to_bytearray(volume) - tare = integer_to_bytearray(tare_load_cell) + tare = integer_to_bytearray(tareLoadCell) payload = vol + tare message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, @@ -138,7 +138,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_start_stop_dg(self, start:bool=True) -> int: + def cmd_start_stop_dg(self, start: bool = True) -> int: """ Constructs and sends the start/stop DG command Constraints: @@ -174,7 +174,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_start_stop_trimmer_heater(self, start:bool=True) -> int: + def cmd_start_stop_trimmer_heater(self, start: bool = True) -> int: """ Constructs and sends the start/stop DG trimmer heater command @@ -207,7 +207,7 @@ self.logger.debug("Timeout!!!!") return False - def cmd_stop_primary_heater(self): + def cmd_stop_primary_heater(self) -> None: """ Constructs and sends stop heat disinfect command @@ -221,7 +221,7 @@ self.logger.debug("Stopping heat disinfection process") self.can_interface.send(message, 0) - def cmd_sample_water(self, cmd:int) -> None: + def cmd_sample_water(self, cmd: int) -> None: """ Constructs and sends sample water command Index: dialin/dg/heat_disinfect.py =================================================================== diff -u -r5aea950f649f72211632cbb17be314f3b4c24f10 -rd4cf7e98bfe73fde95043613fa894b64b57d11a8 --- dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision 5aea950f649f72211632cbb17be314f3b4c24f10) +++ dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision d4cf7e98bfe73fde95043613fa894b64b57d11a8) @@ -102,4 +102,4 @@ self.cancellation_mode = cancellation_mode self.r1_level = r1 - self.r2_level = r2 \ No newline at end of file + self.r2_level = r2 Index: dialin/dg/temperature_sensors.py =================================================================== diff -u -r0514a69831286e4727429f57e046f71e73e78110 -rd4cf7e98bfe73fde95043613fa894b64b57d11a8 --- dialin/dg/temperature_sensors.py (.../temperature_sensors.py) (revision 0514a69831286e4727429f57e046f71e73e78110) +++ dialin/dg/temperature_sensors.py (.../temperature_sensors.py) (revision d4cf7e98bfe73fde95043613fa894b64b57d11a8) @@ -16,6 +16,7 @@ import struct from ..utils.conversions import integer_to_bytearray from ..utils.conversions import float_to_bytearray +from ..utils.checks import check_broadcast_interval_override_ms from ..common.msg_defs import MsgIds, MsgFieldPositions from .constants import NO_RESET from ..protocols.CAN import (DenaliMessage, DenaliChannels) @@ -206,12 +207,15 @@ Constructs and sends broadcast time interval. Constraints: Must be logged into DG. - Given interval must be non-zero and a multiple of the DG priority task interval (10 ms). + Given interval must be non-zero and a multiple of the DG general task interval (50 ms). @param ms: (int) Publish time interval in ms @param reset: (int) 1 to reset a previous override, 0 to override @returns 1 if successful, zero otherwise """ + if not check_broadcast_interval_override_ms(ms): + return False + reset_value = integer_to_bytearray(reset) interval_value = integer_to_bytearray(ms) payload = reset_value + interval_value Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -ra89c772d75b8c0a755f91dcb69bebaa20daef2ea -rd4cf7e98bfe73fde95043613fa894b64b57d11a8 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision a89c772d75b8c0a755f91dcb69bebaa20daef2ea) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision d4cf7e98bfe73fde95043613fa894b64b57d11a8) @@ -29,6 +29,7 @@ from .dialysate_outlet_flow import HDDialysateOutletFlow from .treatment import HDTreatment from .valves import HDValves +from .voltages import HDVoltages from .calibration_record import HDCalibrationNVRecord from .system_record import HDSystemNVRecords from .service_record import HDServiceNVRecords @@ -89,6 +90,8 @@ # create properties self.hd_operation_mode = HDOpModes.MODE_INIT.value self.hd_operation_sub_mode = 0 + self.hd_logged_in = False + self.hd_set_logged_in_status(False) # Create command groups self.accel = HDAccelerometer(self.can_interface, self.logger) @@ -109,6 +112,7 @@ self.pressure_occlusion = HDPressureOcclusion(self.can_interface, self.logger) self.syringe_pump = HDSyringePump(self.can_interface, self.logger) self.valves = HDValves(self.can_interface, self.logger) + self.voltages = HDVoltages(self.can_interface, self.logger) self.calibration_record = HDCalibrationNVRecord(self.can_interface, self.logger) self.system_record = HDSystemNVRecords(self.can_interface, self.logger) self.service_record = HDServiceNVRecords(self.can_interface, self.logger) @@ -121,6 +125,23 @@ """ return self.hd_operation_mode + def get_hd_logged_in(self): + """ + Gets the logged in status of the HD + + @return: True if HD is logged in, False if not + """ + return self.hd_logged_in + + @_publish(["hd_logged_in"]) + def hd_set_logged_in_status(self, logged_in:bool=False): + """ + Callback for HD logged in status change. + @param logged_in boolean logged in status for HD + @return: none + """ + self.hd_logged_in = logged_in + @_publish(["hd_operation_mode"]) def _handler_hd_op_mode_sync(self, message): """ @@ -159,6 +180,7 @@ if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: self.logger.debug("Success: Logged In") + self.hd_set_logged_in_status(True) else: self.logger.debug("Failure: Log In Failed.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] @@ -295,3 +317,4 @@ # Send message self.can_interface.send(message, 0) self.logger.debug("Sent request to HD to reset...") + self.hd_set_logged_in_status(False)