Compare commits
18 Commits
v6.1.1
...
96636d59e9
Author | SHA1 | Date | |
---|---|---|---|
96636d59e9 | |||
5a0edbefa8 | |||
5bdba2dbad | |||
3ae6ccfb77 | |||
de84bf112b | |||
d182a9d5ec | |||
492d364246 | |||
33cf7b1613 | |||
d8c49aed80 | |||
97afd24e52 | |||
4704616ca7 | |||
92c0172b59 | |||
49b55f01e3 | |||
f87095bf68 | |||
928759d1bc | |||
dc17919108 | |||
5f71f27f0e | |||
f8d63e56cb |
@ -10,6 +10,15 @@ list yields a list of all related PRs for each release.
|
||||
|
||||
# [unreleased]
|
||||
|
||||
## Added
|
||||
|
||||
- Added version set for STR.
|
||||
- Command for relative timeshift.
|
||||
|
||||
## Fixed
|
||||
|
||||
- EPS power commands working again.
|
||||
|
||||
# [v6.1.1] 2024-03-06
|
||||
|
||||
## Added
|
||||
|
@ -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
|
||||
|
@ -75,9 +75,10 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
||||
7902;0x1ede;BIT_LOCK;INFO;A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7903;0x1edf;BIT_LOCK_LOST;INFO;A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
7905;0x1ee1;FRAME_PROCESSING_FAILED;LOW;The CCSDS Board could not interpret a TC;fsfw/src/fsfw/datalinklayer/DataLinkLayer.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP;INFO;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;No description;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8900;0x22c4;CLOCK_SET;INFO;Clock has been set. P1: old timeval seconds. P2: new timeval seconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8901;0x22c5;CLOCK_DUMP_LEGACY;INFO;Clock dump event. P1: timeval seconds P2: timeval milliseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8902;0x22c6;CLOCK_SET_FAILURE;LOW;Clock could not be set. P1: Returncode.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
8903;0x22c7;CLOCK_DUMP;INFO;Clock dump event. P1: timeval seconds P2: timeval microseconds.;fsfw/src/fsfw/pus/Service9TimeManagement.h
|
||||
9100;0x238c;TC_DELETION_FAILED;MEDIUM;Deletion of a TC from the map failed. P1: First 32 bit of request ID, P2. Last 32 bit of Request ID;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
|
||||
9700;0x25e4;TEST;INFO;No description;fsfw/src/fsfw/pus/Service17Test.h
|
||||
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;No description;fsfw/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
|
||||
|
|
@ -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
|
||||
|
||||
@ -116,9 +117,9 @@ def handle_pus_procedure(
|
||||
|
||||
def handle_eps_procedure(queue_helper: DefaultPusQueueHelper, cmd_path_list: List[str]):
|
||||
obj_id_man = get_object_ids()
|
||||
if len(cmd_path_list) == 1:
|
||||
return pack_power_commands(queue_helper, cmd_path_list[0])
|
||||
assert len(cmd_path_list) >= 2
|
||||
assert len(cmd_path_list) >= 1
|
||||
if cmd_path_list[0] == "power":
|
||||
return pack_power_commands(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "pwr_ctrl":
|
||||
return pack_power_ctrl_command(queue_helper, cmd_path_list[1])
|
||||
if cmd_path_list[0] == "p60_dock":
|
||||
|
@ -122,12 +122,18 @@ def handle_event_packet( # noqa C901: Complexity okay here
|
||||
new_time_dt = datetime.datetime.fromtimestamp(new_time, datetime.timezone.utc)
|
||||
pw.dlog(f"Old time (UTC): {old_time_dt}")
|
||||
pw.dlog(f"New time (UTC): {new_time_dt}")
|
||||
if info.name == "CLOCK_DUMP":
|
||||
if info.name == "CLOCK_DUMP_LEGACY":
|
||||
specific_handler = True
|
||||
# param 1 is timeval seconds, param 2 is timeval subsecond milliseconds
|
||||
time = event_def.param1 + event_def.param2 / 1000.0
|
||||
time_dt = datetime.datetime.fromtimestamp(time, datetime.timezone.utc)
|
||||
pw.dlog(f"Current time: {time_dt}")
|
||||
if info.name == "CLOCK_DUMP":
|
||||
specific_handler = True
|
||||
# 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":
|
||||
sd_0_state = (event_def.param2 >> 16) & 0xFFFF
|
||||
sd_1_state = event_def.param2 & 0xFFFF
|
||||
|
@ -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
|
||||
|
@ -140,9 +140,15 @@ class OpCode:
|
||||
SELECT_TARGET_FIRMWARE_BACKUP = "fw_backup"
|
||||
SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT = "fw_main_persistent"
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = "fw_backup_persistent"
|
||||
REQUEST_VERSION = "request_version"
|
||||
|
||||
|
||||
class Info:
|
||||
ON_BOOTLOADER = "Switch to Mode On, Submode Bootloder"
|
||||
ON_FIRMWARE = "Switch to Mode On, Submode Firmware"
|
||||
NORMAL = "Switch to Mode Normal"
|
||||
OFF = "Switch to Mode Off"
|
||||
PING = "Send Ping"
|
||||
ONE_SHOOT_HK = "One shoot HK Set"
|
||||
ENABLE_HK = "Enable Periodic HK"
|
||||
DISABLE_HK = "Disable Periodic HK"
|
||||
@ -163,6 +169,7 @@ class Info:
|
||||
SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT = (
|
||||
"Select backup firmware slot persistently"
|
||||
)
|
||||
REQUEST_VERSION = "Request the active Firmware Version"
|
||||
|
||||
|
||||
class SetId(enum.IntEnum):
|
||||
@ -316,10 +323,6 @@ def pack_star_tracker_commands( # noqa C901
|
||||
q.add_log_cmd("Star tracker: Temperature request")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_TEMPERATURE)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == "8":
|
||||
q.add_log_cmd("Star tracker: Request version")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_VERSION)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||
if cmd_str == "9":
|
||||
q.add_log_cmd("Star tracker: Request interface")
|
||||
data = obyt + struct.pack("!I", StarTrackerActionId.REQ_INTERFACE)
|
||||
@ -730,6 +733,13 @@ def pack_star_tracker_commands( # noqa C901
|
||||
if cmd_str == OpCode.SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT:
|
||||
q.add_log_cmd(Info.SELECT_TARGET_FIRMWARE_BACKUP)
|
||||
q.add_pus_tc(create_update_firmware_target_cmd(True, FirmwareTarget.BACKUP))
|
||||
if cmd_str == OpCode.REQUEST_VERSION:
|
||||
q.add_log_cmd(Info.REQUEST_VERSION)
|
||||
q.add_pus_tc(
|
||||
create_action_cmd(
|
||||
object_id=STAR_TRACKER_ID, action_id=StarTrackerActionId.REQ_VERSION
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def create_update_firmware_target_cmd(
|
||||
@ -880,6 +890,8 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
||||
handle_contrast_set(hk_data, pw)
|
||||
elif set_id == SetId.BLOB_STATS:
|
||||
handle_blob_stats_set(hk_data, pw)
|
||||
elif set_id == SetId.VERSION:
|
||||
handle_version_set(hk_data, pw)
|
||||
else:
|
||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||
|
||||
@ -902,6 +914,25 @@ def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
|
||||
return current_idx
|
||||
|
||||
|
||||
def handle_version_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received Version Set")
|
||||
if len(hk_data) != 16:
|
||||
_LOGGER.warning(
|
||||
f"Version dataset HK with length {len(hk_data)} of unexpected size"
|
||||
)
|
||||
current_idx = unpack_time_hk(hk_data, 0, pw)
|
||||
program = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Program: {program}")
|
||||
current_idx += 1
|
||||
major = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Major: {major}")
|
||||
current_idx += 1
|
||||
minor = struct.unpack("!B", hk_data[current_idx : current_idx + 1])[0]
|
||||
pw.dlog(f"Minor: {minor}")
|
||||
current_idx += 1
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5))
|
||||
|
||||
|
||||
def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
|
||||
pw.dlog("Received temperature set")
|
||||
if len(hk_data) < 24:
|
||||
@ -1208,7 +1239,7 @@ def handle_blob_stats_set(hk_data: bytes, pw: PrintWrapper):
|
||||
i, noise_list[i], threshold_list[i], lvalid_list[i], oflow_list[i]
|
||||
)
|
||||
)
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=4))
|
||||
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=6))
|
||||
|
||||
|
||||
def handle_star_tracker_action_replies(
|
||||
@ -1251,60 +1282,15 @@ def handle_read_secondary_tm_set(pw: PrintWrapper, custom_data: bytes):
|
||||
|
||||
|
||||
def create_str_node() -> CmdTreeNode:
|
||||
# Zip the two classes together into a dictionary
|
||||
op_code_strs = [
|
||||
getattr(OpCode, key) for key in dir(OpCode) if not key.startswith("__")
|
||||
]
|
||||
info_strs = [getattr(Info, key) for key in dir(OpCode) if not key.startswith("__")]
|
||||
combined_dict = dict(zip(op_code_strs, info_strs))
|
||||
node = CmdTreeNode(
|
||||
"str", "Star Tracker Device", hide_children_which_are_leaves=True
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCode.ON_BOOTLOADER, "Mode On, Submode Bootloader"))
|
||||
node.add_child(CmdTreeNode(OpCode.ON_FIRMWARE, "Mode On, Submode Firmware"))
|
||||
node.add_child(CmdTreeNode(OpCode.NORMAL, "Mode Normal"))
|
||||
node.add_child(CmdTreeNode(OpCode.OFF, "Mode Off"))
|
||||
node.add_child(CmdTreeNode(OpCode.PING, "Star Tracker: Ping"))
|
||||
node.add_child(CmdTreeNode(OpCode.TAKE_IMAGE, "Take Image"))
|
||||
node.add_child(CmdTreeNode(OpCode.UPLOAD_IMAGE, Info.UPLOAD_IMAGE))
|
||||
node.add_child(CmdTreeNode(OpCode.DOWNLOAD_IMAGE, Info.DOWNLOAD_IMAGE))
|
||||
node.add_child(CmdTreeNode(OpCode.ONE_SHOOT_HK, Info.ONE_SHOOT_HK))
|
||||
node.add_child(CmdTreeNode(OpCode.ENABLE_HK, Info.ENABLE_HK))
|
||||
node.add_child(CmdTreeNode(OpCode.DISABLE_HK, Info.DISABLE_HK))
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.SET_IMG_PROCESSOR_MODE, Info.SET_IMG_PROCESSOR_MODE)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.ADD_SECONDARY_TM_TO_NORMAL_MODE,
|
||||
Info.ADD_SECONDARY_TM_TO_NORMAL_MODE,
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.READ_SECONDARY_TM_SET, Info.READ_SECONDARY_TM_SET)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.RESET_SECONDARY_TM_SET, Info.RESET_SECONDARY_TM_SET)
|
||||
)
|
||||
node.add_child(CmdTreeNode(OpCode.FW_UPDATE_MAIN, Info.FW_UPDATE_MAIN))
|
||||
node.add_child(CmdTreeNode(OpCode.FW_UPDATE_BACKUP, Info.FW_UPDATE_BACKUP))
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.SELECT_TARGET_FIRMWARE_MAIN, Info.SELECT_TARGET_FIRMWARE_MAIN
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.SELECT_TARGET_FIRMWARE_BACKUP, Info.SELECT_TARGET_FIRMWARE_BACKUP
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT,
|
||||
Info.SELECT_TARGET_FIRMWARE_MAIN_PERSISTENT,
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(
|
||||
OpCode.SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT,
|
||||
Info.SELECT_TARGET_FIRMWARE_BACKUP_PERSISTENT,
|
||||
)
|
||||
)
|
||||
node.add_child(
|
||||
CmdTreeNode(OpCode.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
|
||||
)
|
||||
for op_code, info in combined_dict.items():
|
||||
node.add_child(CmdTreeNode(op_code, info))
|
||||
return node
|
||||
|
@ -59,7 +59,7 @@ CTN = CmdTreeNode
|
||||
|
||||
|
||||
def create_heater_node() -> CmdTreeNode:
|
||||
node = CmdTreeNode("heater", "Heater Device", hide_children_which_are_leaves=True)
|
||||
node = CmdTreeNode("heaters", "Heater Device", hide_children_which_are_leaves=True)
|
||||
node.add_child(CTN(OpCode.HEATER_CMD, Info.HEATER_CMD))
|
||||
node.add_child(CTN(OpCode.HEATER_HEALTHY_CMD, Info.HEATER_HEALTHY_CMD))
|
||||
node.add_child(CTN(OpCode.HEATER_EXT_CTRL, Info.HEATER_EXT_CTRL))
|
||||
|
@ -1,6 +1,7 @@
|
||||
import enum
|
||||
import struct
|
||||
import logging
|
||||
from datetime import datetime
|
||||
import datetime
|
||||
|
||||
from spacepackets.ecss import PusTelecommand, PusService
|
||||
|
||||
@ -8,28 +9,34 @@ from tmtccmd.tmtc import DefaultPusQueueHelper
|
||||
from tmtccmd.config import CmdTreeNode
|
||||
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Subservice(enum.IntEnum):
|
||||
SET_TIME = 128
|
||||
DUMP_TIME = 129
|
||||
RELATIVE_TIMESHIFT = 130
|
||||
|
||||
|
||||
class CmdStr:
|
||||
SET_CURRENT_TIME = "set_curr_time"
|
||||
RELATIVE_TIMESHIFT = "relative_timeshift"
|
||||
DUMP_TIME = "dump_time"
|
||||
|
||||
|
||||
class Info:
|
||||
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||||
RELATIVE_TIMESHIFT = "Shift time with a relative offset"
|
||||
DUMP_TIME = "Dump system time as event"
|
||||
|
||||
|
||||
def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
if cmd_str == CmdStr.SET_CURRENT_TIME:
|
||||
current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||||
current_time_ascii = current_time.encode("ascii")
|
||||
logging.getLogger(__name__).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(
|
||||
@ -38,6 +45,17 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
|
||||
app_data=current_time_ascii,
|
||||
)
|
||||
)
|
||||
elif cmd_str == CmdStr.RELATIVE_TIMESHIFT:
|
||||
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,
|
||||
)
|
||||
)
|
||||
elif cmd_str == CmdStr.DUMP_TIME:
|
||||
q.add_log_cmd(Info.DUMP_TIME)
|
||||
q.add_pus_tc(
|
||||
@ -51,4 +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))
|
||||
return time_node
|
||||
|
Reference in New Issue
Block a user