starting changing code to new API
This commit is contained in:
@ -8,12 +8,10 @@
|
||||
import struct
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
|
||||
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT, OpCodeDictKeys
|
||||
|
||||
from tmtccmd.tc.packer import TcQueueT
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from pus_tc.service_200_mode import pack_mode_data, Modes
|
||||
from tmtccmd.tc import QueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||
from tmtccmd.utility import ObjectId
|
||||
|
||||
@ -70,41 +68,33 @@ def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
)
|
||||
|
||||
|
||||
def pack_rad_sensor_test_into(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, f"Commanding Radiation sensor handler {object_id}")
|
||||
)
|
||||
def pack_rad_sensor_test_into(object_id: ObjectId, q: QueueHelper, op_code: str):
|
||||
q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
|
||||
|
||||
if op_code in OpCodes.ON:
|
||||
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, tc_queue)
|
||||
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, q)
|
||||
if op_code in OpCodes.NORMAL:
|
||||
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, tc_queue)
|
||||
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, q)
|
||||
if op_code in OpCodes.OFF:
|
||||
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, tc_queue)
|
||||
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, q)
|
||||
if op_code in OpCodes.REQ_HK_ONCE:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.REQ_OS_HK}"))
|
||||
cmd = generate_one_hk_command(
|
||||
sid=make_sid(object_id.as_bytes, set_id=SetIds.HK), ssc=0
|
||||
q.add_log_cmd(f"Rad sensor: {Info.REQ_OS_HK}")
|
||||
q.add_pus_tc(
|
||||
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetIds.HK))
|
||||
)
|
||||
tc_queue.appendleft(cmd.pack_command_tuple())
|
||||
if op_code in OpCodes.DEBUG_ON:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_ON}"))
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_ON}")
|
||||
command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if op_code in OpCodes.DEBUG_OFF:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_OFF}"))
|
||||
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
|
||||
command = object_id.as_bytes + struct.pack(
|
||||
"!I", CommandIds.DISABLE_DEBUG_OUTPUT
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
|
||||
def rad_sensor_mode_cmd(
|
||||
object_id: ObjectId, mode: Modes, info: str, tc_queue: TcQueueT
|
||||
):
|
||||
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {info}"))
|
||||
def rad_sensor_mode_cmd(object_id: ObjectId, mode: Modes, info: str, q: QueueHelper):
|
||||
q.add_log_cmd(f"Rad sensor: {info}")
|
||||
mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
Reference in New Issue
Block a user