diff --git a/config/definitions.py b/config/definitions.py index f48c235..249fbe5 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -15,3 +15,4 @@ class CustomServiceList(enum.Enum): TMP1075_1 = "tmp1075_1" TMP1075_2 = "tmp1075_2" HEATER = "heater" + IMTQ = "imtq" diff --git a/config/object_ids.py b/config/object_ids.py index bffa66e..884c78e 100644 --- a/config/object_ids.py +++ b/config/object_ids.py @@ -18,6 +18,7 @@ TMP_1075_2_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x6]) HEATER_ID = bytearray([0x54, 0x00, 0x00, 0x1]) PCDU_HANDLER_ID = bytearray([0x44, 0x00, 0x10, 0x00]) SOLAR_ARRAY_DEPLOYMENT_ID = bytearray([0x44, 0x00, 0x10, 0x01]) +IMTQ_HANDLER_ID = bytearray([0x44, 0x00, 0x10, 0x14]) class ObjIdIds(enum.IntEnum): @@ -32,6 +33,7 @@ class ObjIdIds(enum.IntEnum): TMP1075_2_HANDLER_ID = 8 HEATER_ID = 9 SOLAR_ARRAY_DEPLOYMENT_ID = 10 + IMTQ_HANDLER_ID = 11 def set_object_ids() -> Dict[int, bytearray]: @@ -47,5 +49,6 @@ def set_object_ids() -> Dict[int, bytearray]: ObjIdIds.HEATER_ID: HEATER_ID, ObjIdIds.PCDU_HANDLER_ID: PCDU_HANDLER_ID, ObjIdIds.SOLAR_ARRAY_DEPLOYMENT_ID: SOLAR_ARRAY_DEPLOYMENT_ID, + ObjIdIds.IMTQ_HANDLER_ID: IMTQ_HANDLER_ID, }) return object_id_dict diff --git a/pus_tc/imtq.py b/pus_tc/imtq.py index c0bdecf..1692f5d 100644 --- a/pus_tc/imtq.py +++ b/pus_tc/imtq.py @@ -25,31 +25,25 @@ class ImtqActionIds: start_actuation_dipole = bytearray([0x0, 0x0, 0x0, 0x02]) -def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: +def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: tc_queue.appendleft( (QueueCommands.PRINT, - "Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex()) + "Testing ISIS IMTQ handler with object id: 0x" + object_id.hex()) ) if ImtqTestProcedure.all or ImtqTestProcedure.command_dipole: tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Commanding dipole")) - command = object_id + Tmp1075ActionIds.start_adc_conversion - command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) - tc_queue.appendleft(command.pack_command_tuple()) - - if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp: - tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Read temperature")) - command = object_id + Tmp1075ActionIds.get_temp - command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) + command = object_id + ImtqActionIds.start_adc_conversion + command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int) -> bytearray: """ This function packs the command causing the ISIS IMTQ to generate a dipole. @param object_id The object id of the gomspace device handler. - @param x_dipole The dipole of the x coil in 10^-4*Am^2 - @param y_dipole The dipole of the y coil in 10^-4*Am^2 - @param z_dipole The dipole of the z coil in 10^-4*Am^2 + @param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000) + @param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000) + @param z_dipole The dipole of the z coil in 10^-4*Am^2 (max. 2000) @param duration The duration in milliseconds the dipole will be generated by the coils. When set to 0, the dipole will be generated until a new dipole actuation command is sent. @@ -57,7 +51,8 @@ def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_di action_id = ImtqActionIds.start_actuation_dipole command = bytearray() command = object_id + action_id - - xDipole - command - return command \ No newline at end of file + command.extend(x_dipole.to_bytes(length=2, byteorder='big')) + command.extend(y_dipole.to_bytes(length=2, byteorder='big')) + command.extend(z_dipole.to_bytes(length=2, byteorder='big')) + command.extend(duration.to_bytes(length=2, byteorder='big')) + return command diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 576ecf4..282f5b5 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -19,6 +19,7 @@ from pus_tc.p60dock import pack_p60dock_test_into from pus_tc.pdu2 import pack_pdu2_test_into from pus_tc.pdu1 import pack_pdu1_test_into from pus_tc.acu import pack_acu_test_into +from pus_tc.imtq import pack_imtq_test_into from pus_tc.tmp1075 import pack_tmp1075_test_into from pus_tc.heater import pack_heater_test_into from config.definitions import CustomServiceList @@ -54,8 +55,11 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu object_id = get_object_id(ObjIdIds.TMP1075_2_HANDLER_ID) return pack_tmp1075_test_into(object_id, service_queue) if service == CustomServiceList.HEATER.value: - object_id = get_object_id(ObjIdIds.HEATER) + object_id = get_object_id(ObjIdIds.HEATER_ID) return pack_heater_test_into(object_id, service_queue) + if service == CustomServiceList.IMTQ.value: + object_id = get_object_id(ObjIdIds.IMTQ_HANDLER_ID) + return pack_imtq_test_into(object_id, service_queue) LOGGER.warning("Invalid Service !")