Merge remote-tracking branch 'origin/develop' into mueller/acu-hk

This commit is contained in:
Robin Müller 2022-05-23 18:34:44 +02:00
commit 3586b541c1
3 changed files with 26 additions and 32 deletions

View File

@ -2,7 +2,11 @@ from typing import Optional
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from spacepackets.ecss import PusTelecommand from spacepackets.ecss import PusTelecommand
from tmtccmd.config import ServiceOpCodeDictT, add_op_code_entry, add_service_op_code_entry from tmtccmd.config import (
ServiceOpCodeDictT,
add_op_code_entry,
add_service_op_code_entry,
)
from tmtccmd.tc.definitions import TcQueueT from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.utility import ObjectId from tmtccmd.utility import ObjectId
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
@ -25,7 +29,7 @@ RTD_IDS = [
oids.RTD_12_ACU, oids.RTD_12_ACU,
oids.RTD_13_PLPCDU_HSPD, oids.RTD_13_PLPCDU_HSPD,
oids.RTD_14_TCS_BRD, oids.RTD_14_TCS_BRD,
oids.RTD_15_IMTQ oids.RTD_15_IMTQ,
] ]
@ -43,26 +47,14 @@ class Info:
def specify_rtd_cmds(cmd_dict: ServiceOpCodeDictT): def specify_rtd_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict() op_code_dict = dict()
add_op_code_entry( add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.ON, info=Info.ON)
op_code_dict=op_code_dict, add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.NORMAL, info=Info.NORMAL)
keys=OpCodes.ON, add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.OFF, info=Info.OFF)
info=Info.ON
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL,
info=Info.NORMAL
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.OFF,
info=Info.OFF
)
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict, op_code_entry=op_code_dict,
name=CustomServiceList.RTD.value, name=CustomServiceList.RTD.value,
info="RTD commands" info="RTD commands",
) )
@ -75,27 +67,27 @@ def pack_rtd_commands(op_code: str, object_id: Optional[ObjectId], tc_queue: TcQ
object_id_dict = get_object_ids() object_id_dict = get_object_ids()
object_id = object_id_dict.get(RTD_IDS[tgt_rtd_idx]) object_id = object_id_dict.get(RTD_IDS[tgt_rtd_idx])
if op_code in OpCodes.ON: if op_code in OpCodes.ON:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.ON, submode=0) app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.ON, submode=0
)
cmd = PusTelecommand( cmd = PusTelecommand(
service=200, service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.NORMAL: if op_code in OpCodes.NORMAL:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0) app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0
)
cmd = PusTelecommand( cmd = PusTelecommand(
service=200, service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.OFF: if op_code in OpCodes.OFF:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.OFF, submode=0) app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.OFF, submode=0
)
cmd = PusTelecommand( cmd = PusTelecommand(
service=200, service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
) )
tc_queue.appendleft(cmd.pack_command_tuple()) tc_queue.appendleft(cmd.pack_command_tuple())

View File

@ -116,7 +116,9 @@ def pack_service_queue_user(
object_id=object_id, tc_queue=service_queue, op_code=op_code object_id=object_id, tc_queue=service_queue, op_code=op_code
) )
if service == CustomServiceList.RTD.value: if service == CustomServiceList.RTD.value:
return pack_rtd_commands(object_id=None, tc_queue=service_queue, op_code=op_code) return pack_rtd_commands(
object_id=None, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
object_id = obj_id_man.get(PDU_1_HANDLER_ID) object_id = obj_id_man.get(PDU_1_HANDLER_ID)
return pack_pdu1_commands( return pack_pdu1_commands(