re-run black
This commit is contained in:
parent
492d364246
commit
d182a9d5ec
@ -3,6 +3,7 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import enum
|
||||
|
||||
from tmtccmd import CcsdsTmtcBackend
|
||||
|
@ -3,6 +3,7 @@
|
||||
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
||||
it to your needs.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os.path
|
||||
from typing import Dict
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Hook function which packs telecommands based on service and operation code string
|
||||
"""
|
||||
|
||||
import logging
|
||||
from typing import List, cast
|
||||
|
||||
|
@ -124,8 +124,8 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
||||
pw.dlog(f"New time (UTC): {new_time_dt}")
|
||||
if info.name == "CLOCK_DUMP":
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond milliseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000.0
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond microseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Current time: {time_dt}")
|
||||
if info.name == "ACTIVE_SD_INFO":
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""HK Handling for EIVE OBSW"""
|
||||
|
||||
import dataclasses
|
||||
import logging
|
||||
import base64 # noqa
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""Core EIVE TM handler module
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sqlite3
|
||||
import uuid
|
||||
|
@ -11,6 +11,7 @@ from tmtccmd.config import CmdTreeNode
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Subservice(enum.IntEnum):
|
||||
SET_TIME = 128
|
||||
DUMP_TIME = 129
|
||||
@ -31,11 +32,11 @@ class Info:
|
||||
|
||||
def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == CmdStr.SET_CURRENT_TIME:
|
||||
current_time = datetime.datetime.now(datetime.UTC).isoformat() + "Z" + "\0"
|
||||
current_time_ascii = current_time.encode("ascii")
|
||||
_LOGGER.info(
|
||||
f"Current time in ASCII format: {current_time_ascii}"
|
||||
current_time = (
|
||||
datetime.datetime.now(datetime.timezone.utc).isoformat() + "Z" + "\0"
|
||||
)
|
||||
current_time_ascii = current_time.encode("ascii")
|
||||
_LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
|
||||
q.add_log_cmd(Info.SET_CURRENT_TIME)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
@ -45,14 +46,14 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
)
|
||||
)
|
||||
elif cmd_str == CmdStr.RELATIVE_TIMESHIFT:
|
||||
nanos = input("Specify relative timeshift in nanoseconds")
|
||||
nanos_packed = struct.pack("!Q", nanos)
|
||||
nanos = int(input("Specify relative timeshift in nanoseconds: "))
|
||||
nanos_packed = struct.pack("!q", nanos)
|
||||
q.add_log_cmd(Info.RELATIVE_TIMESHIFT)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=PusService.S9_TIME_MGMT,
|
||||
subservice=Subservice.RELATIVE_TIMESHIFT,
|
||||
app_data=nanos_packed
|
||||
app_data=nanos_packed,
|
||||
)
|
||||
)
|
||||
elif cmd_str == CmdStr.DUMP_TIME:
|
||||
@ -68,5 +69,5 @@ def create_time_node() -> CmdTreeNode:
|
||||
time_node = CmdTreeNode("time", "Time Management")
|
||||
time_node.add_child(CmdTreeNode(CmdStr.SET_CURRENT_TIME, "Set current time"))
|
||||
time_node.add_child(CmdTreeNode(CmdStr.DUMP_TIME, "Dumpy current time"))
|
||||
time_node.add_child(CmdTreeNode(CmdStr.RELATIVE_TIMESHIFT,Info.RELATIVE_TIMESHIFT))
|
||||
time_node.add_child(CmdTreeNode(CmdStr.RELATIVE_TIMESHIFT, Info.RELATIVE_TIMESHIFT))
|
||||
return time_node
|
||||
|
Loading…
x
Reference in New Issue
Block a user