This commit is contained in:
Robin Müller 2022-05-23 18:34:28 +02:00
parent ba69be6296
commit e7cb7ca096
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
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 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.utility import ObjectId
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_13_PLPCDU_HSPD,
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):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.ON,
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_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.ON, 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(
srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict,
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 = object_id_dict.get(RTD_IDS[tgt_rtd_idx])
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(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())
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(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())
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(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())

View File

@ -115,7 +115,9 @@ def pack_service_queue_user(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
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:
object_id = PDU_1_HANDLER_ID
return pack_pdu1_commands(