v1.10.0 #65
@ -45,3 +45,4 @@ class CustomServiceList(enum.Enum):
|
||||
ACS_ASS = "acs-ass"
|
||||
SUS_ASS = "sus-ass"
|
||||
TCS_ASS = "tcs-ass"
|
||||
TIME = "time"
|
||||
|
@ -1,19 +1,14 @@
|
||||
import argparse
|
||||
from typing import Union, Dict
|
||||
from typing import Union
|
||||
|
||||
from tmtccmd.config.definitions import (
|
||||
ServiceOpCodeDictT,
|
||||
HkReplyUnpacked,
|
||||
DataReplyUnpacked,
|
||||
)
|
||||
from tmtccmd.tm.service_3_base import Service3Base
|
||||
from tmtccmd.tc.definitions import TcQueueT
|
||||
from tmtccmd.utility.retval import RetvalDictT
|
||||
from tmtccmd.pus.obj_id import ObjectIdDictT
|
||||
from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
||||
from tmtccmd.core.backend import TmTcHandler
|
||||
from tmtccmd.config.hook import TmTcHookBase
|
||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||
from tmtccmd.config.globals import OpCodeDictKeys
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
@ -75,6 +70,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
add_ploc_mpsoc_cmds,
|
||||
add_ploc_supv_cmds,
|
||||
add_system_cmds,
|
||||
add_time_cmds,
|
||||
)
|
||||
from pus_tc.devs.gps import GpsOpCodes
|
||||
|
||||
@ -88,6 +84,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
add_ploc_mpsoc_cmds(cmd_dict=service_op_code_dict)
|
||||
add_ploc_supv_cmds(cmd_dict=service_op_code_dict)
|
||||
add_system_cmds(cmd_dict=service_op_code_dict)
|
||||
add_time_cmds(cmd_dict=service_op_code_dict)
|
||||
|
||||
op_code_dict = {
|
||||
GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0})
|
||||
|
@ -179,6 +179,23 @@ def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
)
|
||||
|
||||
|
||||
def add_time_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
from pus_tc.system.time import OpCodes, Info
|
||||
|
||||
op_code_dict = dict()
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=OpCodes.SET_CURRENT_TIME,
|
||||
info=Info.SET_CURRENT_TIME,
|
||||
)
|
||||
add_service_op_code_entry(
|
||||
srv_op_code_dict=cmd_dict,
|
||||
name=CustomServiceList.TIME.value,
|
||||
info="Time Service",
|
||||
op_code_entry=op_code_dict,
|
||||
)
|
||||
|
||||
|
||||
def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
|
||||
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info
|
||||
from pus_tc.devs.pdu1 import Pdu1OpCodes
|
||||
|
@ -146,9 +146,7 @@ class Submode:
|
||||
FIRMWARE = 2
|
||||
|
||||
|
||||
def pack_star_tracker_commands(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
):
|
||||
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
|
28
pus_tc/system/time.py
Normal file
28
pus_tc/system/time.py
Normal file
@ -0,0 +1,28 @@
|
||||
from datetime import datetime
|
||||
|
||||
from spacepackets.ecss import PusTelecommand
|
||||
from tmtccmd.config import QueueCommands
|
||||
from tmtccmd.tc.definitions import TcQueueT
|
||||
|
||||
from tmtccmd.logging import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
class OpCodes:
|
||||
SET_CURRENT_TIME = ["0", "set-curr-time"]
|
||||
|
||||
|
||||
class Info:
|
||||
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||||
|
||||
|
||||
def pack_set_current_time_ascii_command(tc_queue: TcQueueT, ssc: int):
|
||||
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||||
current_time_ascii = time_test_current_time.encode("ascii")
|
||||
LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
|
||||
tc_queue.appendleft((QueueCommands.PRINT, Info.SET_CURRENT_TIME))
|
||||
command = PusTelecommand(
|
||||
service=9, subservice=128, ssc=ssc, app_data=current_time_ascii
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
@ -36,6 +36,7 @@ from pus_tc.system.core import pack_core_commands
|
||||
from pus_tc.devs.star_tracker import pack_star_tracker_commands
|
||||
from pus_tc.devs.syrlinks_hk_handler import pack_syrlinks_command
|
||||
from pus_tc.devs.gps import pack_gps_command
|
||||
from pus_tc.system.time import pack_set_current_time_ascii_command
|
||||
from pus_tc.system.acs import pack_acs_command, pack_sus_cmds
|
||||
from pus_tc.devs.plpcdu import pack_pl_pcdu_commands
|
||||
from pus_tc.devs.str_img_helper import pack_str_img_helper_command
|
||||
@ -230,6 +231,8 @@ def pack_service_queue_user(
|
||||
return pack_acs_command(tc_queue=service_queue, op_code=op_code)
|
||||
if service == CustomServiceList.TCS_ASS.value:
|
||||
return pack_tcs_sys_commands(tc_queue=service_queue, op_code=op_code)
|
||||
if service == CustomServiceList.TIME.value:
|
||||
return pack_set_current_time_ascii_command(tc_queue=service_queue, ssc=0)
|
||||
LOGGER.warning("Invalid Service !")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user