Index: HD/HD_DialOutFlow.py =================================================================== diff -u -r082ea4c8b0c6a3c804453308990d0bb98a0a2156 -rc5826238ca4b80671231a9c564af3ea01b9be06f --- HD/HD_DialOutFlow.py (.../HD_DialOutFlow.py) (revision 082ea4c8b0c6a3c804453308990d0bb98a0a2156) +++ HD/HD_DialOutFlow.py (.../HD_DialOutFlow.py) (revision c5826238ca4b80671231a9c564af3ea01b9be06f) @@ -1,10 +1,26 @@ +########################################################################### +# +# 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 HD_DialOutFlow.py +# +# @date 31-Mar-2020 +# @author P. Lucia +# +# @brief +# +# +############################################################################ from enum import Enum from DialIn.CoreCANProtocol import DenaliMessage from DialIn.CoreCANProtocol import DenaliChannels import matplotlib.pyplot as plt import sys import numpy as np -# TODO: Commented code needs to be removed +# TODO: Commented code needs to be removed, general maintenance is required class DialOutStates(Enum): @@ -28,7 +44,6 @@ # Broadcast message ID MSG_ID_DIALYSATE_UF_DATA = 0x0009 - DIALOUT_STATES = list(DialOutStates) # variable storing information received by Handler @@ -39,10 +54,10 @@ \param can_interface: reference to DenaliMessenger """ - self.__can_interface = can_interface - self.__can_interface.register_receiving_publication_function(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, - message_id=self.MSG_ID_DIALYSATE_UF_DATA, - function=self.receiveDialysateUFDataHandler) + self.can_interface = can_interface + self.can_interface.register_receiving_publication_function(channel_id=DenaliChannels.hd_sync_broadcast_ch_id, + message_id=self.MSG_ID_DIALYSATE_UF_DATA, + function=self.receiveDialysateUFDataHandler) ## DialOutBroadcast a dictionary storing latest broadcast values of the following keys: # state, target_volume, measured_volume, pwm, motor_current, motor_speed. self.DialOutBroadcast = {'target_volume': 0, @@ -53,6 +68,7 @@ 'motor_mc_current': 0, 'pwm': 0} + # FIXME: This commented code needs to be removed or fixed. #self.__BroadCastSignals = {'time': [], # 'state': [], # 'target_volume': [], @@ -74,7 +90,7 @@ msg = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, message_id=self.MSG_ID_SET_DIALOUT_FLOW_STATE, payload=payload) - received_msg = self.__can_interface.send(msg) + received_msg = self.can_interface.send(msg) else: print("Argument to setUFState method are incorrect", file=sys.stderr) @@ -104,7 +120,7 @@ msg = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_hd_ch_id, message_id=self.MSG_ID_SET_DIALOUT_FLOW_RX, payload=payload) - received_msg = self.__can_interface.send(msg) + received_msg = self.can_interface.send(msg) print(received_msg) else: print("Arguments to setUFRx are incorrect", file=sys.stderr) @@ -138,6 +154,7 @@ self.DialOutBroadcast['motor_speed'] = np.int16(int.from_bytes(bytearray(payload[10:12]), byteorder=DenaliMessage.BYTE_ORDER, signed=True)) + # FIXME: This commented code needs to be removed or fixed. #self.__BroadCastSignals['time'].append(self.__time) #self.__BroadCastSignals['state'].append(state_num * 100) #self.__BroadCastSignals['target_volume'].append(self.DialOutBroadcast['target_volume']) @@ -151,6 +168,7 @@ \return: None """ + # FIXME: BroadCastSignals is commented out in the constructor right now. time = self.__BroadCastSignals['time'] state = self.__BroadCastSignals['state'] target = self.__BroadCastSignals['target_volume']