Index: dialin/dg/alarms.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/alarms.py (.../alarms.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/alarms.py (.../alarms.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -18,8 +18,7 @@ from .constants import RESET, NO_RESET from ..common.msg_defs import MsgIds -from ..protocols.CAN import (DenaliMessage, - DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish from ..utils.conversions import integer_to_bytearray Index: dialin/dg/calibration_record.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/calibration_record.py (.../calibration_record.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/calibration_record.py (.../calibration_record.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -303,7 +303,8 @@ for i in hardware_names: hardware[i] = {'fourth_order': [' int: + def cmd_start_stop_dg_chemical_disinfect(self, start: bool = True) -> int: """ Constructs and sends the start/stop DG chemical disinfect command @@ -307,16 +307,16 @@ # 1 is to start if start: cmd = 1 - str = "Starting" + str_text = "Starting" else: cmd = 0 - str = "Stopping" + str_text = "Stopping" payload = integer_to_bytearray(cmd) message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_dg_ch_id, message_id=MsgIds.MSG_ID_DG_START_STOP_CHEM_DISINFECT.value, payload=payload) - self.logger.debug(str + " DG chemical disinfect") + self.logger.debug(str_text + " DG chemical disinfect") received_message = self.can_interface.send(message) Index: dialin/dg/heat_disinfect.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/heat_disinfect.py (.../heat_disinfect.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -3,7 +3,7 @@ from logging import Logger from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import DenaliMessage, DenaliChannels +from ..protocols.CAN import DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum @@ -121,4 +121,3 @@ self.r1_level = r1 self.r2_level = r2 self.heat_disinfect_ui_state = ui - Index: dialin/dg/heaters.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/heaters.py (.../heaters.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/heaters.py (.../heaters.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -20,7 +20,7 @@ from .constants import NO_RESET from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum from ..utils.checks import check_broadcast_interval_override_ms from ..utils.conversions import integer_to_bytearray, float_to_bytearray @@ -225,4 +225,3 @@ else: self.logger.debug("Timeout!!!!") return False - Index: dialin/dg/ro_pump.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/ro_pump.py (.../ro_pump.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/ro_pump.py (.../ro_pump.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -19,7 +19,7 @@ from .constants import RESET, NO_RESET from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum from ..utils.checks import check_broadcast_interval_override_ms from ..utils.conversions import integer_to_bytearray, float_to_bytearray Index: dialin/dg/rtc.py =================================================================== diff -u -rebf0a72a1a1a52f3cfe20975de4857201275888c -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/rtc.py (.../rtc.py) (revision ebf0a72a1a1a52f3cfe20975de4857201275888c) +++ dialin/dg/rtc.py (.../rtc.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -13,14 +13,15 @@ # @date (original) 13-May-2021 # ############################################################################ -import ctypes -from ..protocols.CAN import (DenaliMessage, DenaliChannels) -from ..utils.conversions import integer_to_bytearray -from ..utils.base import AbstractSubSystem, publish -from ..common.msg_defs import MsgIds + from logging import Logger +from ..common.msg_defs import MsgIds +from ..protocols.CAN import DenaliMessage, DenaliChannels +from ..utils.base import AbstractSubSystem +from ..utils.conversions import integer_to_bytearray + class DGRTC(AbstractSubSystem): """ @@ -72,9 +73,10 @@ self.logger.debug(received_message) # str_res = str(flow) - self.logger.debug("Time and Date in rtc set to seconds: " + str(sec) + " minutes: " + str(min) + " hours: " + - str(hour) + " days: " + str(day) + " months: " + str(month) + " years: " + str(year) + - str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + self.logger.debug( + "Time and Date in rtc set to seconds: " + str(sec) + " minutes: " + str(min) + " hours: " + + str(hour) + " days: " + str(day) + " months: " + str(month) + " years: " + str(year) + + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: Index: dialin/dg/samplewater.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/samplewater.py (.../samplewater.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/samplewater.py (.../samplewater.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -18,8 +18,9 @@ from .constants import NO_RESET from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import DenaliChannels +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish +from ..utils.conversions import integer_to_bytearray class DGSampleWater(AbstractSubSystem): @@ -106,4 +107,3 @@ else: self.logger.error("Timeout!!!!") return False - Index: dialin/dg/scheduled_runs_record.py =================================================================== diff -u -rebf0a72a1a1a52f3cfe20975de4857201275888c -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/scheduled_runs_record.py (.../scheduled_runs_record.py) (revision ebf0a72a1a1a52f3cfe20975de4857201275888c) +++ dialin/dg/scheduled_runs_record.py (.../scheduled_runs_record.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -3,7 +3,7 @@ import math from collections import OrderedDict from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish from ..utils.nv_ops_utils import NVOpsUtils from logging import Logger @@ -141,7 +141,7 @@ # messages + the length of scheduled runs record. The rest is the CAN messaging CRC and is not # needed. end_of_data_index = self.SCHEDULED_RUNS_RECORD_START_INDEX + self.SCHEDULED_RECORD_SPECS_BYTES + \ - self.received_msg_length + self.received_msg_length # Get the scheduled runs data only self.cal_data = message['message'][self.SCHEDULED_RUNS_RECORD_START_INDEX:end_of_data_index] @@ -190,8 +190,8 @@ # Check the data type of the crc value_bytes = self._get_data_type_bytes(data_type) # Unpack the data - data = struct.unpack(data_type, self.raw_scheduled_runs_record[raw_payload_temp_start_index: - raw_payload_temp_start_index + value_bytes])[0] + data = struct.unpack(data_type, self.raw_scheduled_runs_record[ + raw_payload_temp_start_index:raw_payload_temp_start_index + value_bytes])[0] self.dg_scheduled_runs_record[group][self.SCHEDULED_RUNS_VALUE_INDEX] = data elif group == 'padding': # Get the data type @@ -217,13 +217,11 @@ self.SCHEDULED_RUNS_DATA_TYPE_INDEX] value_bytes = self._get_data_type_bytes(data_type) # Unpack the values to written to the dictionary - data = struct.unpack(data_type, self.raw_scheduled_runs_record[raw_payload_temp_start_index: - raw_payload_temp_start_index + - value_bytes])[0] + data = struct.unpack(data_type, self.raw_scheduled_runs_record[ + raw_payload_temp_start_index:raw_payload_temp_start_index + value_bytes])[0] # Update the index of the raw payload for the next read raw_payload_temp_start_index += value_bytes - self.dg_scheduled_runs_record[group][hardware_group][hardware]\ - [self.SCHEDULED_RUNS_VALUE_INDEX] = data + self.dg_scheduled_runs_record[group][hardware_group][hardware][self.SCHEDULED_RUNS_VALUE_INDEX] = data def _prepare_dg_scheduled_runs_record(self): """ @@ -239,7 +237,7 @@ # The second element of the hardware groups are the byte sizes, add them to calculate the overall byte size. groups_byte_size = scheduled_runs[1] + self._get_data_type_bytes(record_crc['crc'] - [self.SCHEDULED_RUNS_DATA_TYPE_INDEX]) + [self.SCHEDULED_RUNS_DATA_TYPE_INDEX]) # Calculate the padding size: # If bytes in the dictionary % max write bytes to EEPROM (16) is 0, not padding is needed # Else padding = (ceil(dictionary bytes/max write to EEPROM (16)) * max write to EEPROM (16)) - dictionary bytes Index: dialin/dg/service_record.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/service_record.py (.../service_record.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/service_record.py (.../service_record.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -5,7 +5,7 @@ from logging import Logger from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish from ..utils.nv_ops_utils import NVOpsUtils Index: dialin/dg/switches.py =================================================================== diff -u -rebf0a72a1a1a52f3cfe20975de4857201275888c -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/switches.py (.../switches.py) (revision ebf0a72a1a1a52f3cfe20975de4857201275888c) +++ dialin/dg/switches.py (.../switches.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -1,13 +1,13 @@ - import struct -from ..utils.conversions import integer_to_bytearray -from ..common.msg_defs import MsgIds, MsgFieldPositions +from enum import unique +from logging import Logger + from .constants import RESET, NO_RESET -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..common.msg_defs import MsgIds, MsgFieldPositions +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum from ..utils.checks import check_broadcast_interval_override_ms -from logging import Logger -from enum import unique +from ..utils.conversions import integer_to_bytearray @unique Index: dialin/dg/system_record.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/system_record.py (.../system_record.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/system_record.py (.../system_record.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -5,7 +5,7 @@ from logging import Logger from ..common.msg_defs import MsgIds, MsgFieldPositions -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, DialinEnum, publish from ..utils.nv_ops_utils import NVOpsUtils @@ -228,11 +228,12 @@ @return: system record dictionary and the byte size of this group """ groups_byte_size = 0 - system_records = OrderedDict({'system_record': - {'top_level_pn': [' int: + def cmd_uv_reactors_data_broadcast_interval_override(self, ms: int, reset: int = NO_RESET) -> int: """ Constructs and sends the UV reactors data publish interval. Constraints: @@ -189,7 +188,7 @@ self.logger.debug("UV reactors health override Timeout!!!") return False - def cmd_start_stop_inlet_uv_reactor(self, state:int=ReactorsStates.UV_REACTOR_STATE_OFF.value) -> int: + def cmd_start_stop_inlet_uv_reactor(self, state: int = ReactorsStates.UV_REACTOR_STATE_OFF.value) -> int: """ Constructs and sends a start/stop command to the DG inlet UV reactor @@ -220,7 +219,7 @@ self.logger.debug(operation + "inlet UV reactor timeout!!") return False - def cmd_start_stop_outlet_uv_reactor(self, state:int=ReactorsStates.UV_REACTOR_STATE_ON.value) -> int: + def cmd_start_stop_outlet_uv_reactor(self, state: int = ReactorsStates.UV_REACTOR_STATE_ON.value) -> int: """ Constructs and sends a start/stop command to the DG outlet UV reactor Index: dialin/dg/valves.py =================================================================== diff -u -rf06c062512981820509a86a07a54b7070adbf3d1 -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/valves.py (.../valves.py) (revision f06c062512981820509a86a07a54b7070adbf3d1) +++ dialin/dg/valves.py (.../valves.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -20,7 +20,7 @@ from .constants import NO_RESET from ..common.msg_defs import MsgIds -from ..protocols.CAN import (DenaliMessage, DenaliChannels) +from ..protocols.CAN import DenaliMessage, DenaliChannels from ..utils.base import AbstractSubSystem, publish, DialinEnum from ..utils.checks import check_broadcast_interval_override_ms from ..utils.conversions import integer_to_bytearray @@ -76,20 +76,20 @@ END_POS_VALVES_STATES = START_POS_VALVES_STATES + 2 # Valves States come in as a U16 value (2 bytes) # Valve IDs - VALVE_RESERVOIR_FILL = 0 # VRF - VALVE_RESERVOIR_INLET = 1 # VRI - VALVE_RESERVOIR_DRAIN = 2 # VRD - VALVE_RESERVOIR_OUTLET = 3 # VRO - VALVE_PRESSURE_OUTLET = 4 # VPO - VALVE_BYPASS_FILTER = 5 # VBF - VALVE_RECIRCULATE = 6 # VRC - VALVE_DRAIN = 7 # VDR - VALVE_PRESSURE_INLET = 8 # VPI - VALVE_SAMPLING_PORT = 9 # VSP - VALVE_RESERVOIR_DRAIN_1 = 10 # VRD1 - VALVE_RESERVOIR_DRAIN_2 = 11 # VRD2 - VALVE_PRODUCTION_DRAIN = 12 # VPD - NUM_OF_VALVES = 13 # Number of valves + VALVE_RESERVOIR_FILL = 0 # VRF + VALVE_RESERVOIR_INLET = 1 # VRI + VALVE_RESERVOIR_DRAIN = 2 # VRD + VALVE_RESERVOIR_OUTLET = 3 # VRO + VALVE_PRESSURE_OUTLET = 4 # VPO + VALVE_BYPASS_FILTER = 5 # VBF + VALVE_RECIRCULATE = 6 # VRC + VALVE_DRAIN = 7 # VDR + VALVE_PRESSURE_INLET = 8 # VPI + VALVE_SAMPLING_PORT = 9 # VSP + VALVE_RESERVOIR_DRAIN_1 = 10 # VRD1 + VALVE_RESERVOIR_DRAIN_2 = 11 # VRD2 + VALVE_PRODUCTION_DRAIN = 12 # VPD + NUM_OF_VALVES = 13 # Number of valves def __init__(self, can_interface, logger: Logger): """ Index: dialin/dg/voltages.py =================================================================== diff -u -rebf0a72a1a1a52f3cfe20975de4857201275888c -r5ac4d7d984a093a2e76df9ecef4b3753f76b6abd --- dialin/dg/voltages.py (.../voltages.py) (revision ebf0a72a1a1a52f3cfe20975de4857201275888c) +++ dialin/dg/voltages.py (.../voltages.py) (revision 5ac4d7d984a093a2e76df9ecef4b3753f76b6abd) @@ -15,15 +15,15 @@ ############################################################################ import struct from enum import unique +from logging import Logger + +from .constants import RESET, NO_RESET +from ..common.msg_defs import MsgIds, MsgFieldPositions +from ..protocols.CAN import DenaliMessage, DenaliChannels +from ..utils.base import AbstractSubSystem, publish from ..utils.base import DialinEnum from ..utils.checks import check_broadcast_interval_override_ms -from ..protocols.CAN import (DenaliMessage, - DenaliChannels) from ..utils.conversions import integer_to_bytearray, float_to_bytearray -from .constants import RESET, NO_RESET -from ..utils.base import AbstractSubSystem, publish -from ..common.msg_defs import MsgIds, MsgFieldPositions -from logging import Logger # Monitored voltages @@ -135,7 +135,7 @@ self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_PRIM_HTR_V.value] = v24p[0] self.monitored_voltages[DGMonitoredVoltages.MONITORED_LINE_24V_TRIM_HTR_V.value] = v24t[0] - def cmd_monitored_voltage_override(self, signal:int=0, volts:float=0.0, reset:int=NO_RESET) -> int: + def cmd_monitored_voltage_override(self, signal: int = 0, volts: float = 0.0, reset: int = NO_RESET) -> int: """ Constructs and sends the DG monitored voltage override command Constraints: @@ -169,14 +169,14 @@ else: str_res = str(volts) + " V. " self.logger.debug("Monitored DG voltage overridden to " + str_res + - str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") return False - def cmd_monitored_voltages_broadcast_interval_override(self, ms:int=1000, reset:int=NO_RESET) -> int: + def cmd_monitored_voltages_broadcast_interval_override(self, ms: int = 1000, reset: int = NO_RESET) -> int: """ Constructs and sends the monitored DG voltages broadcast interval override command Constraints: @@ -211,7 +211,7 @@ else: str_res = str(ms) + " ms: " self.logger.debug("DG monitored voltages broadcast interval overridden to " + str_res + - str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) + str(received_message['message'][DenaliMessage.PAYLOAD_START_INDEX])) # response payload is OK or not OK return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: