Index: dialin/common/msg_defs.py =================================================================== diff -u -r96006d22aa13f0287e2697a7cac7604201633263 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- dialin/common/msg_defs.py (.../msg_defs.py) (revision 96006d22aa13f0287e2697a7cac7604201633263) +++ dialin/common/msg_defs.py (.../msg_defs.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -91,8 +91,8 @@ MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST = 0x46 # UI request to change pressure limits MSG_ID_HD_PRESSURE_LIMITS_CHANGE_RESPONSE = 0x47 # HD response to change pressure limits request MSG_ID_DG_FANS_DATA = 0x48 # DG broadcast fans data - MSG_ID_HD_CALIBRATION_DATA = 0x49 # HD broadcast calibration data - MSG_ID_DG_CALIBRATION_DATA = 0x4A # DG broadcast calibration data + MSG_ID___AVAILABLE_4 = 0x49 # HD broadcast calibration_record data + MSG_ID___AVAILABLE_5 = 0x4A # DG broadcast calibration_record data MSG_ID_UI_HEPARIN_PAUSE_RESUME_REQUEST = 0x4B # UI request to pause/resume Heparin delivery MSG_ID_HD_HEPARIN_PAUSE_RESUME_RESPONSE = 0x4C # HD Heparin Pause/Resume Response MSG_ID_HD_HEPARIN_DATA = 0x4D # HD Broadcast heparin data @@ -152,9 +152,9 @@ MSG_ID_HD_ACCEL_OVERRIDE = 0x8027 # HD accelerometer sensor override request MSG_ID_HD_ACCEL_MAX_OVERRIDE = 0x8028 # HD accelerometer sensor max. override request MSG_ID_HD_ACCEL_SEND_INTERVAL_OVERRIDE = 0x8029 # HD accelerometer data broadcast interval override request - MSG_ID_HD_ACCEL_SET_CALIBRATION = 0x802A # HD accelerometer set calibration factors request - MSG_ID_HD_BLOOD_FLOW_SET_CALIBRATION = 0x802B # Blood flow set calibration factors request - MSG_ID_HD_DIALYSATE_FLOW_SET_CALIBRATION = 0x802C # Dialysate flow set calibration factors request + MSG_ID___AVAILABLE_6 = 0x802A # This msg ID is available for use + MSG_ID___AVAILABLE_7 = 0x802B # This msg ID is available for use + MSG_ID___AVAILABLE_8 = 0x802C # This msg ID is available for use MSG_ID_HD_SET_PARAMETER_TREATMENT_PARAMETER = 0x802D # Set a treatment parameter (will change actual setting, not an override) MSG_ID_HD_VALVES_HOME = 0x802E # Home an HD Valve MSG_ID_HD_VALVES_POSITION_OVERRIDE = 0x802F # Set an HD valve to a position in counts @@ -169,8 +169,17 @@ MSG_ID_DIAL_IN_PUMP_HOME_CMD = 0x8038 # Dialysate inlet pump home command MSG_ID_DIAL_OUT_PUMP_HOME_CMD = 0x8039 # Dialysate outlet pump home command MSG_ID_SUPER_CLEAR_ALARMS_CMD = 0x803A # Clears all alarms (even if non-recoverable or fault) - MSG_ID_HD_REQUEST_CALIBRATION_DATA = 0x803B # Requests calibration data from HD - MSG_ID_HD_ERASE_CALIBRATION_DATA = 0x803C # Requests calibration data on HD be erased + MSG_ID___AVAILABLE_9 = 0x803B # This msg ID is available for use + MSG_ID___AVAILABLE_10 = 0x803C # This msg ID is available for use + MSG_ID_HD_SET_CALIBRATION_RECORD = 0x803D # HD set calibration_record record that is received from Dialin + MSG_ID_HD_GET_CALIBRATION_RECORD = 0x803E # HD get calibration_record record that is requested from Dialin + MSG_ID_HD_SEND_CALIBRATION_RECORD = 0x803F # HD send calibration_record record to CAN bus to be received in Dialin (equivalent to publish) + MSG_ID_HD_SET_SYSTEM_RECORD = 0x8040 # HD set system record that is received from Dialin + MSG_ID_HD_GET_SYSTEM_RECORD = 0x8041 # HD get system record that is requested from Dialin + MSG_ID_HD_SEND_SYSTEM_RECORD = 0x8042 # HD send system record to CAN bus to be received in Dialin (equivalent to publish) + MSG_ID_HD_GET_SERVICE_RECORD = 0x8043 # HD get service record that is requested from Dialin + MSG_ID_HD_SET_SERVICE_RECORD = 0x8044 # HD set service record that is received from Dialin + MSG_ID_HD_SEND_SERVICE_RECORD = 0x8045 # HD send service record to CAN bus to be received in Dialin (equivalent to publish) MSG_ID_DG_TESTER_LOGIN_REQUEST = 0XA000 # DG tester log-in MSG_ID_DG_ALARM_STATE_OVERRIDE = 0xA001 # DG alarm state override message ID @@ -197,7 +206,7 @@ MSG_ID_DG_ACCEL_OVERRIDE = 0xA017 # DG accelerometer sensor override request MSG_ID_DG_ACCEL_MAX_OVERRIDE = 0xA018 # DG accelerometer sensor max. override request MSG_ID_DG_ACCEL_SEND_INTERVAL_OVERRIDE = 0xA019 # DG accelerometer data broadcast interval override request - MSG_ID_DG_ACCEL_SET_CALIBRATION = 0xA01A # DG accelerometer set calibration factors request + MSG_ID___AVAILABLE_11 = 0xA01A # This msg ID is available for use MSG_ID_RO_PUMP_SET_PWM = 0xA01B # RO pump set PWM for open loop MSG_ID_DRAIN_PUMP_SET_DELTA_PRESSURE_OVERRIDE = 0xA01C # Drain pump set delta pressure override MSG_ID_HEAT_DISINFECT_RECIRC_PATH_DURATION_MINS = 0xA01D # Heat disinfection recirculation path duration in minutes @@ -212,7 +221,7 @@ MSG_ID_CONCENTRATE_PUMP_STATE_CHANGE_REQUEST = 0xA026 # Concentrate pumps' state change request (on / off) MSG_ID_CONCENTRATE_PUMP_PUBLISH_INTERVAL_OVERRIDE = 0xA027 # Concentrate pumps' data publish interval override request MSG_ID_DG_START_STOP_INLET_UV_REACTOR = 0xA028 # DG start/stop inlet UV reactor - MSG_ID_DG_REQUEST_CALIBRATION_DATA = 0xA029 # Requests calibration data from DG + MSG_ID_DG_REQUEST_CALIBRATION_DATA = 0xA029 # Requests calibration_record data from DG MSG_ID_DG_FANS_DATA_PUBLISH_OVERRIDE = 0xA02A # Fans data publish interval override request MSG_ID_DG_START_STOP_OUTLET_UV_REACTOR = 0xA02B # DG start/stop outlet UV reactor MSG_ID_DG_UV_REACTORS_HEALTH_OVERRIDE = 0xA02C # DG UV reactors health override request @@ -222,7 +231,18 @@ MSG_ID_DG_RO_FLOW_RATE_OVERRIDE = 0xA030 # DG RO flow rate override MSG_ID_DG_RO_PUMP_TARGET_FLOW_OVERRIDE = 0xA031 # DG RO pump target flow rate override MSG_ID_DG_RO_PUMP_TARGET_PRESSURE_OVERRIDE = 0xA032 # DG RO pump target pressure override - MSG_ID_DG_SET_CALIBRATION_DATA = 0xA033 # DG set calibration data + MSG_ID_DG_SET_CALIBRATION_RECORD = 0xA033 # DG set calibration_record record + MSG_ID_DG_GET_CALIBRATION_RECORD = 0xA034 # DG get calibration_record record + MSG_ID_DG_SEND_CALIBRATION_RECORD = 0xA035 # DG send calibration_record record from firmware + MSG_ID_DG_SET_SYSTEM_RECORD = 0xA036 # DG send system record + MSG_ID_DG_GET_SYSTEM_RECORD = 0xA037 # DG get system record + MSG_ID_DG_SEND_SYSTEM_RECORD = 0xA038 # DG send system record from firmware + MSG_ID_DG_SET_SERVICE_RECORD = 0xA03A # DG set service record that is sent from Dialin + MSG_ID_DG_GET_SERVICE_RECORD = 0xA039 # DG get service record that is requested from Dialin + MSG_ID_DG_SEND_SERVICE_RECORD = 0xA03B # DG send service record that is requested from Dialin + MSG_ID_DG_GET_SCHEDULED_RUNS_RECORD = 0xA03C # DG get scheduled runs that is requested from Dialin + MSG_ID_DG_SET_SCHEDULED_RUNS_RECORD = 0xA03D # DG set scheduled runs that is received from Dialin + MSG_ID_DG_SEND_SCHEDULED_RUNS_RECORD = 0xA03E # DG send scheduled runs to CAN bus to be received in Dialin (equivalent to publish) MSG_ID_HD_DEBUG_EVENT = 0xFFF1 # HD debug event text to be logged in event log MSG_ID_DG_DEBUG_EVENT = 0xFFF2 # DG debug event text to be logged in event log Index: dialin/dg/dialysate_generator.py =================================================================== diff -u -r1ab15a50a984c98b85eb63b7dd843fda51f4a412 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision 1ab15a50a984c98b85eb63b7dd843fda51f4a412) +++ dialin/dg/dialysate_generator.py (.../dialysate_generator.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -31,7 +31,10 @@ from .fans import Fans from .uv_reactors import UVReactors from .concentrate_pumps import ConcentratePumps -from .calibration import DGCalibration +from .calibration_record import DGCalibration +from .system_record import DGSystemRecord +from .service_record import DGService +from .scheduled_runs_record import DGScheduledRunsRecord from ..utils.conversions import integer_to_bytearray from ..protocols.CAN import (DenaliCanMessenger, DenaliMessage, DenaliChannels) from ..utils.base import _AbstractSubSystem, _publish, _LogManager @@ -149,7 +152,10 @@ self.thermistors = Thermistors(self.can_interface, self.logger) self.fans = Fans(self.can_interface, self.logger) self.uv_reactors = UVReactors(self.can_interface, self.logger) - self.calibration = DGCalibration(self.can_interface, self.logger) + self.calibration_record = DGCalibration(self.can_interface, self.logger) + self.system_record = DGSystemRecord(self.can_interface, self.logger) + self.service_record = DGService(self.can_interface, self.logger) + self.scheduled_runs_record = DGScheduledRunsRecord(self.can_interface, self.logger) def get_version(self): """ Index: dialin/hd/hemodialysis_device.py =================================================================== diff -u -r0cab9b7a747d7e2dfc36698ea2481b62971ec786 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision 0cab9b7a747d7e2dfc36698ea2481b62971ec786) +++ dialin/hd/hemodialysis_device.py (.../hemodialysis_device.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -26,6 +26,9 @@ from .dialysate_outlet_flow import HDDialysateOutletFlow from .treatment import HDTreatment from .valves import HDValves +from .calibration_record import HDCalibration +from .system_record import HDSystem +from .service_record import HDService from .pressure_occlusion import HDPressureOcclusion from ..protocols.CAN import (DenaliMessage, DenaliCanMessenger, @@ -88,9 +91,9 @@ msg_id = MsgIds.MSG_ID_HD_OP_MODE.value self.can_interface.register_receiving_publication_function(channel_id, msg_id, self._handler_hd_op_mode_sync) - msg_id = MsgIds.MSG_ID_HD_CALIBRATION_DATA.value - self.can_interface.register_receiving_publication_function(channel_id, msg_id, - self._handler_hd_cal_data_sync) + #msg_id = MsgIds.MSG_ID_HD_CALIBRATION_DATA.value + #self.can_interface.register_receiving_publication_function(channel_id, msg_id, + # self._handler_hd_cal_data_sync) # create properties self.hd_operation_mode = self.HD_OP_MODE_INIT_POST @@ -119,6 +122,9 @@ self.treatment = HDTreatment(self.can_interface, self.logger) self.pressure_occlusion = HDPressureOcclusion(self.can_interface, self.logger) self.valves = HDValves(self.can_interface, self.logger) + self.calibration_record = HDCalibration(self.can_interface, self.logger) + self.system_record = HDSystem(self.can_interface, self.logger) + self.service_record = HDService(self.can_interface, self.logger) def get_operation_mode(self): """ @@ -128,22 +134,22 @@ """ return self.hd_operation_mode - def get_hd_calibration_data(self): + def get_hd_calibration_data(self): #TODO remove """ - Gets the HD calibration record + Gets the HD calibration_record record - @return: The hd calibration record + @return: The hd calibration_record record """ return self.hd_calibration_data @_publish(["hd_calibration_data"]) - def _handler_hd_cal_data_sync(self, message): + def _handler_hd_cal_data_sync(self, message): #TODO remove """ - Handles published HD calibration data messages. Current HD calibration data + Handles published HD calibration_record data messages. Current HD calibration_record data is captured for reference. Call cmd_request_hd_calibration_data() method - to request HD to publish HD calibration data. + to request HD to publish HD calibration_record data. - @param message: published HD calibration data broadcast message + @param message: published HD calibration_record data broadcast message @return: None """ rev = struct.unpack('i', bytearray( @@ -219,7 +225,7 @@ def cmd_hd_request_calibration_data(self): """ - Constructs and sends an HD calibration data request command via CAN bus. + Constructs and sends an HD calibration_record data request command via CAN bus. Constraints: Must be logged into HD. @@ -231,24 +237,24 @@ message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, message_id=MsgIds.MSG_ID_HD_REQUEST_CALIBRATION_DATA.value) - self.logger.debug("requesting HD calibration data.") + self.logger.debug("requesting HD calibration_record data.") # Send message received_message = self.can_interface.send(message) if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: - self.logger.debug("HD calibration data request accepted.") + self.logger.debug("HD calibration_record data request accepted.") else: - self.logger.debug("HD calibration data request failed.") + self.logger.debug("HD calibration_record data request failed.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False def cmd_hd_erase_calibration_data(self): """ - Constructs and sends an erase HD calibration data request command via CAN bus. + Constructs and sends an erase HD calibration_record data request command via CAN bus. Constraints: Must be logged into HD. @@ -263,16 +269,16 @@ message_id=MsgIds.MSG_ID_HD_ERASE_CALIBRATION_DATA.value, payload=key) - self.logger.debug("requesting HD calibration data be erased.") + self.logger.debug("requesting HD calibration_record data be erased.") # Send message received_message = self.can_interface.send(message) if received_message is not None: if received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] == 1: - self.logger.debug("HD calibration data erasure request accepted.") + self.logger.debug("HD calibration_record data erasure request accepted.") else: - self.logger.debug("HD calibration data erasure request failed.") + self.logger.debug("HD calibration_record data erasure request failed.") return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") Index: dialin/ui/utils.py =================================================================== diff -u -r2547391a5b9dd00230b8238dba5d0ae6caf2e4c6 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- dialin/ui/utils.py (.../utils.py) (revision 2547391a5b9dd00230b8238dba5d0ae6caf2e4c6) +++ dialin/ui/utils.py (.../utils.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -5,7 +5,7 @@ # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN # WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # -# @file utils.py +# @file nv_ops_utils.py # # @author (last) Behrouz NematiPour # @date (last) 10-Nov-2020 Index: tests/hd_valves_test.py =================================================================== diff -u -r00f4ddaae026d8d24318ea039b7d1f322c99ec09 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- tests/hd_valves_test.py (.../hd_valves_test.py) (revision 00f4ddaae026d8d24318ea039b7d1f322c99ec09) +++ tests/hd_valves_test.py (.../hd_valves_test.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -39,6 +39,7 @@ overall_time_seconds = 4 loops = 5 counter = 0 + valve = ValvesEnum.VBV valves.cmd_hd_valves_broadcast_interval_override(100) @@ -47,7 +48,7 @@ valves.cmd_home_hd_valve(valve.value) sleep(5) - f = open("Valves_Test_200.txt", "w") + f = open("Valves_Test_200.log", "w") while counter < loops: @@ -57,6 +58,7 @@ while overall_counter < (overall_time_seconds/sleep_time): sleep(sleep_time) + status = ('ID, {}, Pos, {}, PosCnt, {}, Cmd, {}, State, {}, Current, {}, PosA, {}, PosB, {}, PosC, {} \r' .format(valves.valves_status[valve.name]['Valve'], valves.valves_status[valve.name]['PosID'], @@ -67,6 +69,7 @@ valves.valves_status[valve.name]['PosA'], valves.valves_status[valve.name]['PosB'], valves.valves_status[valve.name]['PosC'])) + print(status) f.write(status) overall_counter = overall_counter + 1 @@ -76,24 +79,7 @@ while overall_counter < (overall_time_seconds / sleep_time): sleep(sleep_time) - status = ('ID, {}, Pos, {}, PosCnt, {}, Cmd, {}, State, {}, Current, {}, PosA, {}, PosB, {}, PosC, {} \r' - .format(valves.valves_status[valve.name]['Valve'], - valves.valves_status[valve.name]['PosID'], - valves.valves_status[valve.name]['PosCnt'], - valves.valves_status[valve.name]['Cmd'], - valves.valves_status[valve.name]['State'], - valves.valves_status[valve.name]['Current'], - valves.valves_status[valve.name]['PosA'], - valves.valves_status[valve.name]['PosB'], - valves.valves_status[valve.name]['PosC'])) - print(status) - f.write(status) - overall_counter = overall_counter + 1 - counter += 1 - - f.close() - """ print("Reset") #valves.cmd_set_hd_valve_pwm(2, 50, 0) Index: version.py =================================================================== diff -u -r812bbf1e5b3b2f1c4f5cfbef1264787e18afb5c3 -rdf4353089f674167fa92bebb1447d2278b9b30d9 --- version.py (.../version.py) (revision 812bbf1e5b3b2f1c4f5cfbef1264787e18afb5c3) +++ version.py (.../version.py) (revision df4353089f674167fa92bebb1447d2278b9b30d9) @@ -1,69 +1 @@ -########################################################################### -# -# Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. -# -# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN -# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. -# -# @file version.py -# -# @author (last) Peter Lucia -# @date (last) 10-Nov-2020 -# @author (original) Peter Lucia -# @date (original) 16-Jun-2020 -# -############################################################################ -import subprocess - -VERSION = "0.8.1" - - -def get_branch(): - """ - Gets the current branch name in the current git repository - - @return: The current branch name, None if it can't be determined - """ - - try: - return subprocess.check_output("git rev-parse --abbrev-ref HEAD", shell=True).decode("utf-8").strip() - except subprocess.CalledProcessError: - return None - - -def get_last_commit(): - """ - Gets the latest commit in the current git repository - - @return: (str) the latest commit in the current git repository, None if it can't be determined - """ - try: - return subprocess.check_output("git rev-parse --short=7 HEAD", shell=True).decode("utf-8").strip() - except subprocess.CalledProcessError: - return None - - -def check_if_git_repo(): - """ - Checks if we're in a git repo or not to know if we can get the git branch and commit - - @return: True if in a git repo, False otherwise - """ - - return subprocess.call(["git", "branch"], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) == 0 - - -branch = None -commit = None - -DEV_VERSION = VERSION - -if check_if_git_repo(): - branch = get_branch() - commit = get_last_commit() - DEV_VERSION += "-{0}".format(branch) - DEV_VERSION += "-{0}".format(commit) - - -if __name__ == '__main__': - print(VERSION) +dialin/version.py \ No newline at end of file