From 0c99bc9d1154599c363234bc250324b29de3956a Mon Sep 17 00:00:00 2001
From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de>
Date: Wed, 11 Aug 2021 16:49:32 +0200
Subject: [PATCH] star tracker on command
---
.idea/runConfigurations/PDU1_Test_UDP.xml | 4 ++--
config/hook_implementations.py | 3 ++-
pus_tc/pdu1.py | 25 ++++++++++++++---------
pus_tc/tc_packer_hook.py | 7 ++-----
4 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/.idea/runConfigurations/PDU1_Test_UDP.xml b/.idea/runConfigurations/PDU1_Test_UDP.xml
index 22ea5c2..7e5d81c 100644
--- a/.idea/runConfigurations/PDU1_Test_UDP.xml
+++ b/.idea/runConfigurations/PDU1_Test_UDP.xml
@@ -6,9 +6,9 @@
-
+
-
+
diff --git a/config/hook_implementations.py b/config/hook_implementations.py
index 2dfb5e2..b3154dc 100644
--- a/config/hook_implementations.py
+++ b/config/hook_implementations.py
@@ -52,6 +52,7 @@ class EiveHookObject(TmTcHookBase):
op_code_dict_srv_pdu1 = {
"0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "1": ("PDU1: Turn star tracker on", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1)
@@ -151,7 +152,7 @@ class EiveHookObject(TmTcHookBase):
service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple
- service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu2_tuple
+ service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple
diff --git a/pus_tc/pdu1.py b/pus_tc/pdu1.py
index fc52e65..083511f 100644
--- a/pus_tc/pdu1.py
+++ b/pus_tc/pdu1.py
@@ -30,46 +30,51 @@ class PDU1TestProcedure:
turn_channel_3_off = True
-def pack_pdu1_test_into(
- pdu1_object_id: bytearray, p60dock_object_id: bytearray, tc_queue: TcQueueT
-):
- tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU1"))
+def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
+ tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1"))
+
+ if op_code == 1:
+ tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on"))
+ command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
+ PDUConfigTable.out_en_2.parameter_size, Channel.on)
+ command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
+ tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
- command = pack_ping_command(pdu1_object_id, ping_data)
+ command = pack_ping_command(object_id, ping_data)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
command = pack_get_param_command(
- pdu1_object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
+ object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size
)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)"))
- command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_2.parameter_address,
+ command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)"))
- command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_2.parameter_address,
+ command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
- command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_3.parameter_address,
+ command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
- command = pack_set_param_command(pdu1_object_id, PDUConfigTable.out_en_3.parameter_address,
+ command = pack_set_param_command(object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.off)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py
index 322c1b5..3ef0797 100644
--- a/pus_tc/tc_packer_hook.py
+++ b/pus_tc/tc_packer_hook.py
@@ -48,11 +48,8 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
object_id = P60_DOCK_HANDLER
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.PDU1.value:
- pdu1_object_id = PDU_1_HANDLER_ID
- p60dock_object_id = P60_DOCK_HANDLER
- return pack_pdu1_test_into(
- pdu1_object_id=pdu1_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
- )
+ object_id = PDU_1_HANDLER_ID
+ return pack_pdu1_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.PDU2.value:
pdu2_object_id = PDU_2_HANDLER_ID
p60dock_object_id = P60_DOCK_HANDLER