Index: leahi_dialin/fp/modules/boost_pump.py =================================================================== diff -u -rc3cb761794ec2dd44f4289b2d2441ff6bc037f6a -r7628b7a718a1b52c33f58a6003ef13cba4db5e5d --- leahi_dialin/fp/modules/boost_pump.py (.../boost_pump.py) (revision c3cb761794ec2dd44f4289b2d2441ff6bc037f6a) +++ leahi_dialin/fp/modules/boost_pump.py (.../boost_pump.py) (revision 7628b7a718a1b52c33f58a6003ef13cba4db5e5d) @@ -52,11 +52,12 @@ self.p40_target_pressure = 0.0 self.p40_target_flow = 0.0 self.p40_target_duty_cycle = 0.0 + self.p40_pump_duty_cycle_pct = 0.0 + self.p40_pump_fb_duty_cycle_pct = 0.0 - - @publish(["ro_pump_timestamp", "p40_pump_state", "p40_pump_duty_cycle", "p40_pump_fb_duty_cycle", - "p40_pump_speed", "p40_target_pressure", "p40_target_flow", "p40_target_duty_cycle"]) + "p40_pump_speed", "p40_target_pressure", "p40_target_flow", "p40_target_duty_cycle", + "p40_pump_duty_cycle_pct", "p40_pump_fb_duty_cycle_pct" ]) def _handler_pump_sync(self, message, timestamp=0.0): """ Handles published FP ro pump data messages. FP ro pump data is captured @@ -80,6 +81,10 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] self.p40_target_duty_cycle = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.p40_pump_duty_cycle_pct = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] + self.p40_pump_fb_duty_cycle_pct = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] self.boost_pump_timestamp = timestamp Index: leahi_dialin/fp/modules/pressure_sensors.py =================================================================== diff -u -r68422d08c4141999a13496343264483a32314d37 -r7628b7a718a1b52c33f58a6003ef13cba4db5e5d --- leahi_dialin/fp/modules/pressure_sensors.py (.../pressure_sensors.py) (revision 68422d08c4141999a13496343264483a32314d37) +++ leahi_dialin/fp/modules/pressure_sensors.py (.../pressure_sensors.py) (revision 7628b7a718a1b52c33f58a6003ef13cba4db5e5d) @@ -36,7 +36,6 @@ X2_PRES = 6 X3_PRES = 7 X4_PRES = 8 - X5_PRES = 9 class FPPressureSensors(AbstractSubSystem): @@ -69,7 +68,6 @@ self.x2_pres = 0.0 self.x3_pres = 0.0 self.x4_pres = 0.0 - self.x5_pres = 0.0 self.m1_pres_temp = 0.0 self.m3_pres_temp = 0.0 self.p8_pres_temp = 0.0 @@ -79,13 +77,12 @@ self.x2_pres_temp = 0.0 self.x3_pres_temp = 0.0 self.x4_pres_temp = 0.0 - self.x5_pres_temp = 0.0 @publish([ "fp_pressure_timestamp", "m1_pres", "m3_pres", "p8_pres", "p13_pres", "p17_pres", - "x1_pres", "x2_pres", "x3_pres", "x4_pres", "x5_pres", + "x1_pres", "x2_pres", "x3_pres", "x4_pres", "m1_pres_temp", "m3_pres_temp", "p8_pres_temp", "p13_pres_temp", "p17_pres_temp", - "x1_pres_temp", "x2_pres_temp", "x3_pres_temp", "x4_pres_temp", "x5_pres_temp", + "x1_pres_temp", "x2_pres_temp", "x3_pres_temp", "x4_pres_temp", ]) def _handler_pressure_sync(self, message, timestamp=0.0): """ @@ -114,29 +111,25 @@ message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] self.x4_pres = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] - self.x5_pres = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10]))[0] self.m1_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_10:MsgFieldPositions.END_POS_FIELD_10]))[0] self.m3_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_12:MsgFieldPositions.END_POS_FIELD_12]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_11:MsgFieldPositions.END_POS_FIELD_11]))[0] self.p8_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_12:MsgFieldPositions.END_POS_FIELD_12]))[0] self.p13_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_14:MsgFieldPositions.END_POS_FIELD_14]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_13:MsgFieldPositions.END_POS_FIELD_13]))[0] self.p17_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_15:MsgFieldPositions.END_POS_FIELD_15]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_14:MsgFieldPositions.END_POS_FIELD_14]))[0] self.x1_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_16:MsgFieldPositions.END_POS_FIELD_16]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_15:MsgFieldPositions.END_POS_FIELD_15]))[0] self.x2_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_17:MsgFieldPositions.END_POS_FIELD_17]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_16:MsgFieldPositions.END_POS_FIELD_16]))[0] self.x3_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_18:MsgFieldPositions.END_POS_FIELD_18]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_17:MsgFieldPositions.END_POS_FIELD_17]))[0] self.x4_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_19:MsgFieldPositions.END_POS_FIELD_19]))[0] - self.x5_pres_temp = struct.unpack('f', bytearray( - message['message'][MsgFieldPositions.START_POS_FIELD_20:MsgFieldPositions.END_POS_FIELD_20]))[0] + message['message'][MsgFieldPositions.START_POS_FIELD_18:MsgFieldPositions.END_POS_FIELD_18]))[0] self.fp_pressure_timestamp = timestamp @@ -221,4 +214,38 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") + return False + + def cmd_pressure_temperature_override(self, sensor: int, temperature: float, reset: int = NO_RESET) -> int: + """ + Constructs and sends the pressure temperature override command. + Constraints: + Must be logged into FP. + + @param sensor: unsigned int - sensor ID + @param temperature: float - temperature in C + @param reset: integer - 1 to reset a previous override, 0 to override + @return: 1 if successful, zero otherwise + """ + + rst = integer_to_bytearray(reset) + tmp = float_to_bytearray(temperature) + idx = integer_to_bytearray(sensor) + payload = rst + tmp + idx + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_fp_ch_id, + message_id=MsgIds.MSG_ID_FP_TEMPERATURE_OVERRIDE_REQUEST.value, + payload=payload) + + self.logger.debug("override pressure temperature") + + # Send message + received_message = self.can_interface.send(message) + + # If there is content... + if received_message is not None: + # response payload is OK or not OK + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") return False \ No newline at end of file Index: leahi_dialin/fp/modules/ro_pump.py =================================================================== diff -u -rc3cb761794ec2dd44f4289b2d2441ff6bc037f6a -r7628b7a718a1b52c33f58a6003ef13cba4db5e5d --- leahi_dialin/fp/modules/ro_pump.py (.../ro_pump.py) (revision c3cb761794ec2dd44f4289b2d2441ff6bc037f6a) +++ leahi_dialin/fp/modules/ro_pump.py (.../ro_pump.py) (revision 7628b7a718a1b52c33f58a6003ef13cba4db5e5d) @@ -52,11 +52,15 @@ self.p12_target_pressure = 0.0 self.p12_target_flow = 0.0 self.p12_target_duty_cycle = 0.0 + self.p12_pump_duty_cycle_pct = 0.0 + self.p12_pump_fb_duty_cycle_pct = 0.0 + @publish(["ro_pump_timestamp", "p12_pump_state", "p12_pump_duty_cycle", "p12_pump_fb_duty_cycle", - "p12_pump_speed", "p12_target_pressure", "p12_target_flow", "p12_target_duty_cycle"]) + "p12_pump_speed", "p12_target_pressure", "p12_target_flow", "p12_target_duty_cycle", + "p12_pump_duty_cycle_pct", "p12_pump_fb_duty_cycle_pct" ]) def _handler_pump_sync(self, message, timestamp=0.0): """ Handles published FP ro pump data messages. FP ro pump data is captured @@ -80,6 +84,10 @@ message['message'][MsgFieldPositions.START_POS_FIELD_6:MsgFieldPositions.END_POS_FIELD_6]))[0] self.p12_target_duty_cycle = struct.unpack('f', bytearray( message['message'][MsgFieldPositions.START_POS_FIELD_7:MsgFieldPositions.END_POS_FIELD_7]))[0] + self.p12_pump_duty_cycle_pct = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_8:MsgFieldPositions.END_POS_FIELD_8]))[0] + self.p12_pump_fb_duty_cycle_pct = struct.unpack('f', bytearray( + message['message'][MsgFieldPositions.START_POS_FIELD_9:MsgFieldPositions.END_POS_FIELD_9]))[0] self.ro_pump_timestamp = timestamp Index: leahi_dialin/fp/modules/temperatures.py =================================================================== diff -u -r68422d08c4141999a13496343264483a32314d37 -r7628b7a718a1b52c33f58a6003ef13cba4db5e5d --- leahi_dialin/fp/modules/temperatures.py (.../temperatures.py) (revision 68422d08c4141999a13496343264483a32314d37) +++ leahi_dialin/fp/modules/temperatures.py (.../temperatures.py) (revision 7628b7a718a1b52c33f58a6003ef13cba4db5e5d) @@ -113,4 +113,40 @@ return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] else: self.logger.debug("Timeout!!!!") + return False + + def cmd_temperatures_value_override(self, sensor_index: int, sensor_value: float, reset: int = NO_RESET) -> int: + """ + Constructs and sends the value override of a temperature sensor. + Constraints: + Must be logged into FP. + Given sensor_index must be one of the sensors listed below. + + @param sensor_index : (int) Index of the sensor + @param sensor_value: (float) Value of the sensor to override + @param reset: (int) whether to reset the override value. The default is NO_RESET + @returns 1 if successful, zero otherwise + + """ + rst = integer_to_bytearray(reset) + value = float_to_bytearray(sensor_value) + index = integer_to_bytearray(sensor_index) + + payload = rst + value + index + + message = DenaliMessage.build_message(channel_id=DenaliChannels.dialin_to_fp_ch_id, + message_id=MsgIds.MSG_ID_FP_TEMPERATURE_OVERRIDE_REQUEST.value, + payload=payload) + + self.logger.debug("Setting sensor {} to {} C".format(sensor_index, sensor_value)) + + # Send message + received_message = self.can_interface.send(message) + + # If there is content in message + if received_message is not None: + # Response payload is OK or not + return received_message['message'][DenaliMessage.PAYLOAD_START_INDEX] + else: + self.logger.debug("Timeout!!!!") return False \ No newline at end of file