diff --git a/.gitignore b/.gitignore
index 0e1a63e..47b4b46 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ __pycache__
log
/gps_log.txt
/config/*.json
+tmtc_conf.json
diff --git a/.run/Service 17.run.xml b/.run/Service 17.run.xml
new file mode 100644
index 0000000..db07be1
--- /dev/null
+++ b/.run/Service 17.run.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/tmtcc_Service_17.run.xml b/.run/tmtcc_Service_17.run.xml
index 01536e7..65ae35b 100644
--- a/.run/tmtcc_Service_17.run.xml
+++ b/.run/tmtcc_Service_17.run.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..5a00ec9
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,33 @@
+Change Log
+=======
+
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](http://keepachangelog.com/).
+
+The [milestone](https://egit.irs.uni-stuttgart.de/eive/eive-obsw/milestones)
+list yields a list of all related PRs for each release.
+
+# [unreleased]
+
+# [v1.11.0]
+
+- Add `setup.cfg` and `setup.py` file, allowing package installation
+- New ploc commands
+- Removed commands related to obsolete ploc updater component
+- Adds `tmtcloop.py`, which allows receiving TMs continously while being able to send TCs at will.
+- Added more RW HK handling and RW Assembly commands
+- Pack additional parameter which identifiers whether heater is commanded externally or internally
+ PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/67
+
+## Added
+
+- Helper printout for heater commands
+
+# [v1.10.0 and before]
+
+- Add additional heater commands to command health states
+- Extended heater commands for more informative output which component is heated
+
+See [milestones](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/milestones)
+and [releases](https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/releases)
\ No newline at end of file
diff --git a/README.md b/README.md
index d0d50c4..6b72ac8 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,92 @@
# TMTC Commander EIVE
+This application can be used to test the EIVE On-Board Software. Furthermore, it can
+also be used to retrieve all sorts of telemetry data like housekeeping data.
+
+It is recommended to use this application with a virtual environment.
+The [virtual environemnt](#venv) chapter describes how to set one up. The [requirements](#reqs)
+describes how to install all required packages.
+
+The configuration file can currently be found at `tmtc_conf.json`. It caches settings
+like the default communication interface or parameters like the TCP port when using the TCP
+communication interface.
+
+# Examples
+
+Assuming you are running in a [virtual environment](#venv) and all [package requirements](#reqs)
+were installed properly.
+
+Run CLI mode
+
+```sh
+./tmtccli.py
+```
+
+Run GUI mode
+
+```sh
+./tmtcgui.py
+```
+
+# Set up virtual environment
+
+## Linux
+
+1. Create virtual environment
+
+ ```sh
+ python3 -m venv venv
+ ```
+
+2. Activate virtual environment
+
+ ```sh
+ . venv/bin/activate
+ ```
+
+## Windows
+
+1. Create virtual environment
+
+ ```sh
+ py -m venv venv
+ ```
+
+2. Activate virtual environment
+
+ ```sh
+ venv\Scripts\activate.bat
+ ```
+
+# Install requirements
+
+There are two ways to install the requirements. One is to install the primary dependency
+`tmtccmd` interactively. This is the recommended way
+
+Assuming you are running in a virtual environment:
+
+1. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
+
+ ```sh
+ cd tmtccmd
+ pip install -e .[gui]
+ ```
+
+2. You can also install the `spacepackets` package locally/interactively
+ Normally, it will be installed as a `tmtccmd` dependency.
+
+ ```sh
+ cd spacepackets
+ pip install -e .
+ ```
+
+Alternatively you can also install the packages from PyPI completely, but the risk of
+incompatibilities will be high there
+
+```sh
+pip install -r requirements.txt
+```
+
# Run Linter
Can be used to quickly check validity of script. Install `flake8` first
@@ -20,47 +107,10 @@ and then run the `lint.py` script
./lint.py
```
-# Set up virtual environment
+# Run Auto-Formatter
-## Linux
-
-1. Create virtual environment
+This repo is auto-formatted using `black`. Assuming `black` is installed, you can simply run
```sh
-python3 -m venv .
+black .
```
-
-2. Activate virtual environment
-
-```sh
-./Scripts/activate
-```
-
-3. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
-
-```sh
-cd tmtccmd
-python3 -m pip install -e .[gui]
-```
-
-## Windows
-
-1. Create virtual environment
-
-```sh
-py -m venv .
-```
-
-2. Activate virtual environment
-
-```sh
-Scripts\activate.bat
-```
-
-3. Install `tmtccmd` for virtual environment. `-e` for interactive installation.
-
-```sh
-cd tmtccmd
-py -m pip install -e .[gui]
-```
-
diff --git a/config/__init__.py b/config/__init__.py
index e69de29..2e43775 100644
--- a/config/__init__.py
+++ b/config/__init__.py
@@ -0,0 +1,6 @@
+SW_NAME = "eive"
+VERSION_MAJOR = 1
+VERSION_MINOR = 11
+VERSION_SUBMINOR = 0
+
+__version__ = "1.11.0"
diff --git a/config/definitions.py b/config/definitions.py
index 20aa498..0445033 100644
--- a/config/definitions.py
+++ b/config/definitions.py
@@ -8,6 +8,7 @@ import enum
PUS_APID = 0x65
+SPACE_PACKET_IDS = (0x08 << 8 | PUS_APID,)
class CustomServiceList(enum.Enum):
@@ -27,12 +28,12 @@ class CustomServiceList(enum.Enum):
PCDU = "pcdu"
PL_PCDU = "plpcdu"
SA_DEPLYOMENT = "sa_depl"
- REACTION_WHEEL_1 = "reaction_wheel_1"
- REACTION_WHEEL_2 = "reaction_wheel_2"
- REACTION_WHEEL_3 = "reaction_wheel_3"
- REACTION_WHEEL_4 = "reaction_wheel_4"
+ REACTION_WHEEL_1 = "rw-1"
+ REACTION_WHEEL_2 = "rw-2"
+ REACTION_WHEEL_3 = "rw-3"
+ REACTION_WHEEL_4 = "rw-4"
+ RW_ASSEMBLY = "rw-ass"
RAD_SENSOR = "rad_sensor"
- PLOC_UPDATER = "ploc_updater"
GPS_0 = "gps0"
GPS_1 = "gps1"
PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
diff --git a/config/events.csv b/config/events.csv
index ccab2e4..c16f83f 100644
--- a/config/events.csv
+++ b/config/events.csv
@@ -78,13 +78,17 @@
9700;0x25e4;TEST;INFO;;fsfw/src/fsfw/pus/Service17Test.h
10600;0x2968;CHANGE_OF_SETUP_PARAMETER;LOW;;fsfw/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h
11300;0x2c24;SWITCH_CMD_SENT;INFO;Indicates that a FSFW object requested setting a switch P1: 1 if on was requested, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
-11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a swithc state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
+11301;0x2c25;SWITCH_HAS_CHANGED;INFO;Indicated that a switch state has changed P1: New switch state, 1 for on, 0 for off | P2: Switch Index;mission/devices/devicedefinitions/powerDefinitions.h
11302;0x2c26;SWITCHING_Q7S_DENIED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
+11303;0x2c27;FDIR_REACTION_IGNORED;MEDIUM;;mission/devices/devicedefinitions/powerDefinitions.h
11400;0x2c88;GPIO_PULL_HIGH_FAILED;LOW;;mission/devices/HeaterHandler.h
11401;0x2c89;GPIO_PULL_LOW_FAILED;LOW;;mission/devices/HeaterHandler.h
-11402;0x2c8a;SWITCH_ALREADY_ON;LOW;;mission/devices/HeaterHandler.h
-11403;0x2c8b;SWITCH_ALREADY_OFF;LOW;;mission/devices/HeaterHandler.h
-11404;0x2c8c;MAIN_SWITCH_TIMEOUT;LOW;;mission/devices/HeaterHandler.h
+11402;0x2c8a;HEATER_WENT_ON;INFO;;mission/devices/HeaterHandler.h
+11403;0x2c8b;HEATER_WENT_OFF;INFO;;mission/devices/HeaterHandler.h
+11404;0x2c8c;SWITCH_ALREADY_ON;LOW;;mission/devices/HeaterHandler.h
+11405;0x2c8d;SWITCH_ALREADY_OFF;LOW;;mission/devices/HeaterHandler.h
+11406;0x2c8e;MAIN_SWITCH_TIMEOUT;MEDIUM;;mission/devices/HeaterHandler.h
+11407;0x2c8f;FAULTY_HEATER_WAS_ON;LOW;;mission/devices/HeaterHandler.h
11500;0x2cec;MAIN_SWITCH_ON_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11501;0x2ced;MAIN_SWITCH_OFF_TIMEOUT;LOW;;mission/devices/SolarArrayDeploymentHandler.h
11502;0x2cee;DEPLOYMENT_FAILED;HIGH;;mission/devices/SolarArrayDeploymentHandler.h
@@ -94,7 +98,7 @@
11602;0x2d52;ACK_FAILURE;LOW;PLOC receive acknowledgment failure report P1: Command Id which leads the acknowledgment failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h
11603;0x2d53;EXE_FAILURE;LOW;PLOC receive execution failure report P1: Command Id which leads the execution failure report P2: The status field inserted by the MPSoC into the data field;linux/devices/ploc/PlocMPSoCHandler.h
11604;0x2d54;MPSOC_HANDLER_CRC_FAILURE;LOW;PLOC reply has invalid crc;linux/devices/ploc/PlocMPSoCHandler.h
-11605;0x2d55;MPSOC_HANDLER_SEQ_CNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHandler.h
+11605;0x2d55;MPSOC_HANDLER_SEQUENCE_COUNT_MISMATCH;LOW;Packet sequence count in received space packet does not match expected count P1: Expected sequence count P2: Received sequence count;linux/devices/ploc/PlocMPSoCHandler.h
11606;0x2d56;MPSOC_SHUTDOWN_FAILED;HIGH;Supervisor fails to shutdown MPSoC. Requires to power off the PLOC and thus also to shutdown the supervisor.;linux/devices/ploc/PlocMPSoCHandler.h
11701;0x2db5;SELF_TEST_I2C_FAILURE;LOW;Get self test result returns I2C failure P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11702;0x2db6;SELF_TEST_SPI_FAILURE;LOW;Get self test result returns SPI failure. This concerns the MTM connectivity. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
@@ -104,14 +108,15 @@
11706;0x2dba;SELF_TEST_MTM_RANGE_FAILURE;LOW;Get self test result returns failure that MTM values were outside of the expected range. P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11707;0x2dbb;SELF_TEST_COIL_CURRENT_FAILURE;LOW;Get self test result returns failure indicating that the coil current was outside of the expected range P1: Indicates on which axis the failure occurred. 0 -> INIT, 1 -> +X, 2 -> -X, 3 -> +Y, 4 -> -Y, 5 -> +Z, 6 -> -Z, 7 -> FINA;mission/devices/IMTQHandler.h
11708;0x2dbc;INVALID_ERROR_BYTE;LOW;Received invalid error byte. This indicates an error of the communication link between IMTQ and OBC.;mission/devices/IMTQHandler.h
-11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/RwHandler.h
+11801;0x2e19;ERROR_STATE;HIGH;Reaction wheel signals an error state;mission/devices/devicedefinitions/RwDefinitions.h
+11802;0x2e1a;RESET_OCCURED;LOW;;mission/devices/devicedefinitions/RwDefinitions.h
11901;0x2e7d;BOOTING_FIRMWARE_FAILED;LOW;Failed to boot firmware;linux/devices/startracker/StarTrackerHandler.h
11902;0x2e7e;BOOTING_BOOTLOADER_FAILED;LOW;Failed to boot star tracker into bootloader mode;linux/devices/startracker/StarTrackerHandler.h
12001;0x2ee1;SUPV_MEMORY_READ_RPT_CRC_FAILURE;LOW;PLOC supervisor crc failure in telemetry packet;linux/devices/ploc/PlocSupervisorHandler.h
12002;0x2ee2;SUPV_ACK_FAILURE;LOW;PLOC supervisor received acknowledgment failure report;linux/devices/ploc/PlocSupervisorHandler.h
-12003;0x2ee3;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report;linux/devices/ploc/PlocSupervisorHandler.h
+12003;0x2ee3;SUPV_EXE_FAILURE;LOW;PLOC received execution failure report P1: ID of command for which the execution failed P2: Status code sent by the supervisor handler;linux/devices/ploc/PlocSupervisorHandler.h
12004;0x2ee4;SUPV_CRC_FAILURE_EVENT;LOW;PLOC supervisor reply has invalid crc;linux/devices/ploc/PlocSupervisorHandler.h
-12005;0x2ee5;SUPV_HELPER_EXECUTING;LOW;Supervisor helper currently executing a command;linux/devices/ploc/PlocSupervisorHandler.h
+12005;0x2ee5;SUPV_MPSOC_SHUWDOWN_BUILD_FAILED;LOW;Failed to build the command to shutdown the MPSoC;linux/devices/ploc/PlocSupervisorHandler.h
12100;0x2f44;SANITIZATION_FAILED;LOW;;bsp_q7s/memory/SdCardManager.h
12101;0x2f45;MOUNTED_SD_CARD;INFO;;bsp_q7s/memory/SdCardManager.h
12300;0x300c;SEND_MRAM_DUMP_FAILED;LOW;Failed to send mram dump command to supervisor handler P1: Return value of commandAction function P2: Start address of MRAM to dump with this command;linux/devices/ploc/PlocMemoryDumper.h
@@ -187,8 +192,13 @@
13609;0x3529;SUPV_MISSING_ACK;LOW;Did not receive acknowledgement report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/devices/ploc/PlocSupvHelper.h
13610;0x352a;SUPV_MISSING_EXE;LOW;Supervisor did not receive execution report P1: Number of bytes missing P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
13611;0x352b;SUPV_ACK_FAILURE_REPORT;LOW;Supervisor received acknowledgment failure report P1: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
-13612;0x352c;SUPV_EXE_FAILURE_REPORT;LOW;Supervisor received execution failure report P1: Internal state of supervisor;linux/devices/ploc/PlocSupvHelper.h
+13612;0x352c;SUPV_EXE_FAILURE_REPORT;LOW;Execution report failure P1:;linux/devices/ploc/PlocSupvHelper.h
13613;0x352d;SUPV_ACK_INVALID_APID;LOW;Supervisor expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
13614;0x352e;SUPV_EXE_INVALID_APID;LOW;Supervisor helper expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of supervisor helper;linux/devices/ploc/PlocSupvHelper.h
13615;0x352f;ACK_RECEPTION_FAILURE;LOW;Failed to receive acknowledgment report P1: Return value P2: Apid of command for which the reception of the acknowledgment report failed;linux/devices/ploc/PlocSupvHelper.h
13616;0x3530;EXE_RECEPTION_FAILURE;LOW;Failed to receive execution report P1: Return value P2: Apid of command for which the reception of the execution report failed;linux/devices/ploc/PlocSupvHelper.h
+13617;0x3531;WRITE_MEMORY_FAILED;LOW;Update procedure failed when sending packet with number P1 P1: Packet number for which the memory write command fails;linux/devices/ploc/PlocSupvHelper.h
+13700;0x3584;ALLOC_FAILURE;MEDIUM;;bsp_q7s/core/CoreController.h
+13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
+13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
+13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
diff --git a/config/hook_implementations.py b/config/hook_implementations.py
index 400672e..bf6a715 100644
--- a/config/hook_implementations.py
+++ b/config/hook_implementations.py
@@ -1,18 +1,18 @@
from typing import Union
+from config.definitions import SPACE_PACKET_IDS
from tmtccmd.config.definitions import (
ServiceOpCodeDictT,
)
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.utility.retval import RetvalDictT
-from tmtccmd.pus.obj_id import ObjectIdDictT
+from tmtccmd.utility.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.config.globals import OpCodeDictKeys
-from config.definitions import CustomServiceList
from config.retvals import get_retval_dict
+from pus_tc.cmd_definitions import get_eive_service_op_code_dict
class EiveHookObject(TmTcHookBase):
@@ -20,11 +20,7 @@ class EiveHookObject(TmTcHookBase):
super().__init__(json_cfg_path=json_cfg_path)
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
- from tmtccmd.config.globals import get_default_service_op_code_dict
-
- service_op_code_dict = get_default_service_op_code_dict()
- get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
- return service_op_code_dict
+ return get_eive_service_op_code_dict()
def assign_communication_interface(
self, com_if_key: str
@@ -34,7 +30,7 @@ class EiveHookObject(TmTcHookBase):
return create_communication_interface_default(
com_if_key=com_if_key,
json_cfg_path=self.json_cfg_path,
- space_packet_ids=(0x0865,),
+ space_packet_ids=SPACE_PACKET_IDS,
)
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
@@ -56,294 +52,3 @@ class EiveHookObject(TmTcHookBase):
def get_retval_dict(self) -> RetvalDictT:
return get_retval_dict()
-
-
-def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
- from pus_tc.cmd_definitions import (
- add_bpx_cmd_definitions,
- add_core_controller_definitions,
- add_pcdu_cmds,
- add_pl_pcdu_cmds,
- add_imtq_cmds,
- add_rw_cmds,
- add_rad_sens_cmds,
- add_ploc_mpsoc_cmds,
- add_ploc_supv_cmds,
- add_system_cmds,
- add_time_cmds,
- add_proc_cmds,
- )
- from pus_tc.devs.gps import GpsOpCodes
-
- add_bpx_cmd_definitions(cmd_dict=service_op_code_dict)
- add_core_controller_definitions(cmd_dict=service_op_code_dict)
- add_pl_pcdu_cmds(cmd_dict=service_op_code_dict)
- add_pcdu_cmds(cmd_dict=service_op_code_dict)
- add_imtq_cmds(cmd_dict=service_op_code_dict)
- add_rad_sens_cmds(cmd_dict=service_op_code_dict)
- add_rw_cmds(cmd_dict=service_op_code_dict)
- 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)
- add_proc_cmds(cmd_dict=service_op_code_dict)
-
- op_code_dict = {
- GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0})
- }
- service_tuple = ("GPS 0", op_code_dict)
- service_op_code_dict[CustomServiceList.GPS_0.value] = service_tuple
- service_op_code_dict[CustomServiceList.GPS_1.value] = service_tuple
-
- op_code_dict = {
- "0": ("ACU: Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "51": ("ACU: Print channel statistics", {OpCodeDictKeys.TIMEOUT: 2.0}),
- }
- service_tuple = ("ACU Devices", op_code_dict)
- service_op_code_dict[CustomServiceList.ACU.value] = service_tuple
-
- op_code_dict = {
- "0": ("TMP1075 Tests", {OpCodeDictKeys.TIMEOUT: 2.2}),
- }
- service_tuple = ("TMP1075 1", op_code_dict)
- service_op_code_dict[CustomServiceList.TMP1075_1.value] = service_tuple
- service_tuple = ("TMP1075 2", op_code_dict)
- service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tuple
-
- op_code_dict_srv_heater = {
- "0": ("Heater Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
- }
- service_heater_tuple = ("Heater Device", op_code_dict_srv_heater)
-
- op_code_dict_srv_star_tracker = {
- "0": (
- "Star Tracker: Mode On, Submode Bootloader",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "1": ("Star Tracker: Mode On, Submode Firmware", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "2": ("Star Tracker: Mode Normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "3": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "4": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "5": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 5.0}),
- "6": (
- "Star Tracker: Switch to bootloader program",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "7": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "8": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "9": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "10": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "11": (
- "Star Tracker: Set subscription parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "12": (
- "Star Tracker: Boot image (requires bootloader mode)",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "13": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "14": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "15": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "16": ("Star Tracker: Download image", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "17": ("Star Tracker: Set limit parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "18": ("Star Tracker: Set tracking parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "19": ("Star Tracker: Set mounting parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "20": ("Star Tracker: Set camera parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "22": (
- "Star Tracker: Set centroiding parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "23": ("Star Tracker: Set LISA parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "24": ("Star Tracker: Set matching parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "25": (
- "Star Tracker: Set validation parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "26": ("Star Tracker: Set algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "27": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "28": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "30": (
- "Star Tracker: Set name of download image",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "31": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "32": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "33": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "35": ("Star Tracker: Flash read", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "36": ("Star Tracker: Set flash read filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "37": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "49": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "50": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "51": (
- "Star Tracker: Set image processor parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "52": (
- "Star Tracker: (EGSE only) Load camera ground config ",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "53": (
- "Star Tracker: (EGSE only) Load camera flight config",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "54": (
- "Star Tracker: Request log level parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "55": (
- "Star Tracker: Request mounting parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "56": (
- "Star Tracker: Request image processor parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "57": (
- "Star Tracker: Request centroiding parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "58": ("Star Tracker: Request lisa parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "59": (
- "Star Tracker: Request matching parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "60": (
- "Star Tracker: Request tracking parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "61": (
- "Star Tracker: Request validation parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "62": ("Star Tracker: Request algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "63": (
- "Star Tracker: Request subscription parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "64": (
- "Star Tracker: Request log subscription parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "65": (
- "Star Tracker: Request debug camera parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "66": ("Star Tracker: Set log level parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "67": (
- "Star Tracker: Set log subscription parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "68": (
- "Star Tracker: Set debug camera parameters",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "69": ("Star Tracker: Firmware update", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "70": (
- "Star Tracker: Disable timestamp generation",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "71": (
- "Star Tracker: Enable timestamp generation",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- }
- service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
-
- op_code_dict_srv_ccsds_handler = {
- "0": ("CCSDS Handler: Set low rate", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "1": ("CCSDS Handler: Set high rate", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "2": ("CCSDS Handler: Enable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "3": ("CCSDS Handler: Disable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "4": ("CCSDS Handler: Set arbitrary bitrate", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "5": (
- "CCSDS Handler: Enable tx clock manipulator",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "6": (
- "CCSDS Handler: Disable tx clock manipulator",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "7": (
- "CCSDS Handler: Update tx data on rising edge",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "8": (
- "CCSDS Handler: Update tx data on falling edge",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- }
- service_ccsds_handler_tuple = ("CCSDS Handler", op_code_dict_srv_ccsds_handler)
-
- op_code_dict_srv_pdec_handler = {
- "0": ("PDEC Handler: Print CLCW", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "1": ("PDEC Handler: Print PDEC monitor", {OpCodeDictKeys.TIMEOUT: 2.0}),
- }
- service_pdec_handler_tuple = ("PDEC Handler", op_code_dict_srv_pdec_handler)
-
- op_code_dict_srv_syrlinks_handler = {
- "0": ("Syrlinks Handler: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "1": ("Syrlinks Handler: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "2": ("Syrlinks Handler: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "3": ("Syrlinks Handler: Set TX standby", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "4": ("Syrlinks Handler: Set TX modulation", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "5": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "6": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "7": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "8": (
- "Syrlinks Handler: Read TX AGC value high byte ",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "9": (
- "Syrlinks Handler: Read TX AGC value low byte ",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "12": (
- "Syrlinks Handler: Write LCL config",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "13": (
- "Syrlinks Handler: Read RX status registers",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "14": (
- "Syrlinks Handler: Read LCL config register",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "15": (
- "Syrlinks Handler: Set waveform OQPSK",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "16": (
- "Syrlinks Handler: Set waveform BPSK",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "17": (
- "Syrlinks Handler: Set second config",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "18": (
- "Syrlinks Handler: Enable debug output",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- "19": (
- "Syrlinks Handler: Disable debug output",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- }
- service_syrlinks_handler_tuple = (
- "Syrlinks Handler",
- op_code_dict_srv_syrlinks_handler,
- )
- service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
- service_op_code_dict[
- CustomServiceList.STAR_TRACKER.value
- ] = service_star_tracker_tuple
- service_op_code_dict[
- CustomServiceList.CCSDS_HANDLER.value
- ] = service_ccsds_handler_tuple
- service_op_code_dict[
- CustomServiceList.PDEC_HANDLER.value
- ] = service_pdec_handler_tuple
- service_op_code_dict[
- CustomServiceList.SYRLINKS.value
- ] = service_syrlinks_handler_tuple
diff --git a/config/object_ids.py b/config/object_ids.py
index c1b4236..7242c20 100644
--- a/config/object_ids.py
+++ b/config/object_ids.py
@@ -4,7 +4,7 @@
it to your needs.
"""
import os.path
-from tmtccmd.pus.obj_id import ObjectIdDictT
+from tmtccmd.utility.obj_id import ObjectIdDictT
from tmtccmd.fsfw import parse_fsfw_objects_csv
from tmtccmd.logging import get_console_logger
@@ -61,16 +61,26 @@ PDEC_HANDLER_ID = bytes([0x50, 0x00, 0x07, 0x00])
STAR_TRACKER_ID = bytes([0x44, 0x13, 0x00, 0x1])
RAD_SENSOR_ID = bytes([0x44, 0x32, 0x00, 0xA5])
PLOC_SUPV_ID = bytes([0x44, 0x33, 0x00, 0x16])
-PLOC_UPDATER_ID = bytes([0x44, 0x33, 0x00, 0x00])
PLOC_MEMORY_DUMPER_ID = bytes([0x44, 0x33, 0x00, 0x01])
STR_IMG_HELPER_ID = bytes([0x44, 0x33, 0x00, 0x02])
PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
PL_PCDU_ID = bytes([0x44, 0x30, 0x00, 0x00])
+# Other
+HEATER_0_OBC_BRD = bytes([0x60, 0x00, 0x00, 0x00])
+HEATER_1_PLOC_PROC_BRD = bytes([0x60, 0x00, 0x00, 0x01])
+HEATER_2_ACS_BRD = bytes([0x60, 0x00, 0x00, 0x02])
+HEATER_3_PCDU_BRD = bytes([0x60, 0x00, 0x00, 0x03])
+HEATER_4_CAMERA = bytes([0x60, 0x00, 0x00, 0x04])
+HEATER_5_STR = bytes([0x60, 0x00, 0x00, 0x05])
+HEATER_6_DRO = bytes([0x60, 0x00, 0x00, 0x06])
+HEATER_7_HPA = bytes([0x60, 0x00, 0x00, 0x07])
+
# System and Assembly Objects
ACS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x01])
SUS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x02])
TCS_BOARD_ASS_ID = bytes([0x73, 0x00, 0x00, 0x03])
+RW_ASSEMBLY = bytes([0x73, 0x00, 0x00, 0x04])
def get_object_ids() -> ObjectIdDictT:
diff --git a/config/objects.csv b/config/objects.csv
index 98b1453..432a50b 100644
--- a/config/objects.csv
+++ b/config/objects.csv
@@ -4,18 +4,18 @@
0x43400001;THERMAL_CONTROLLER
0x44120006;MGM_0_LIS3_HANDLER
0x44120010;GYRO_0_ADIS_HANDLER
-0x44120032;SUS_0
-0x44120033;SUS_1
-0x44120034;SUS_2
-0x44120035;SUS_3
-0x44120036;SUS_4
-0x44120037;SUS_5
-0x44120038;SUS_6
-0x44120039;SUS_7
-0x44120040;SUS_8
-0x44120041;SUS_9
-0x44120042;SUS_10
-0x44120043;SUS_11
+0x44120032;SUS_0_N_LOC_XFYFZM_PT_XF
+0x44120033;SUS_1_N_LOC_XBYFZM_PT_XB
+0x44120034;SUS_2_N_LOC_XFYBZB_PT_YB
+0x44120035;SUS_3_N_LOC_XFYBZF_PT_YF
+0x44120036;SUS_4_N_LOC_XMYFZF_PT_ZF
+0x44120037;SUS_5_N_LOC_XFYMZB_PT_ZB
+0x44120038;SUS_6_R_LOC_XFYBZM_PT_XF
+0x44120039;SUS_7_R_LOC_XBYBZM_PT_XB
+0x44120040;SUS_8_R_LOC_XBYBZB_PT_YB
+0x44120041;SUS_9_R_LOC_XBYBZB_PT_YF
+0x44120042;SUS_10_N_LOC_XMYBZF_PT_ZF
+0x44120043;SUS_11_R_LOC_XBYMZB_PT_ZB
0x44120047;RW1
0x44120107;MGM_1_RM3100_HANDLER
0x44120111;GYRO_1_L3G_HANDLER
@@ -40,6 +40,8 @@
0x44330001;PLOC_MEMORY_DUMPER
0x44330002;STR_HELPER
0x44330003;PLOC_MPSOC_HELPER
+0x44330004;AXI_PTME_CONFIG
+0x44330005;PTME_CONFIG
0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER
@@ -47,26 +49,27 @@
0x444100A4;HEATER_HANDLER
0x44420004;TMP1075_HANDLER_1
0x44420005;TMP1075_HANDLER_2
-0x44420016;RTD_IC_3
-0x44420017;RTD_IC_4
-0x44420018;RTD_IC_5
-0x44420019;RTD_IC_6
-0x44420020;RTD_IC_7
-0x44420021;RTD_IC_8
-0x44420022;RTD_IC_9
-0x44420023;RTD_IC_10
-0x44420024;RTD_IC_11
-0x44420025;RTD_IC_12
-0x44420026;RTD_IC_13
-0x44420027;RTD_IC_14
-0x44420028;RTD_IC_15
-0x44420029;RTD_IC_16
-0x44420030;RTD_IC_17
-0x44420031;RTD_IC_18
+0x44420016;RTD_0_IC3_PLOC_HEATSPREADER
+0x44420017;RTD_1_IC4_PLOC_MISSIONBOARD
+0x44420018;RTD_2_IC5_4K_CAMERA
+0x44420019;RTD_3_IC6_DAC_HEATSPREADER
+0x44420020;RTD_4_IC7_STARTRACKER
+0x44420021;RTD_5_IC8_RW1_MX_MY
+0x44420022;RTD_6_IC9_DRO
+0x44420023;RTD_7_IC10_SCEX
+0x44420024;RTD_8_IC11_X8
+0x44420025;RTD_9_IC12_HPA
+0x44420026;RTD_10_IC13_PL_TX
+0x44420027;RTD_11_IC14_MPA
+0x44420028;RTD_12_IC15_ACU
+0x44420029;RTD_13_IC16_PLPCDU_HEATSPREADER
+0x44420030;RTD_14_IC17_TCS_BOARD
+0x44420031;RTD_15_IC18_IMTQ
0x445300A3;SYRLINKS_HK_HANDLER
0x49000000;ARDUINO_COM_IF
0x49010005;GPIO_IF
-0x49020004;SPI_COM_IF
+0x49020004;SPI_MAIN_COM_IF
+0x49020005;SPI_RW_COM_IF
0x49030003;UART_COM_IF
0x49040002;I2C_COM_IF
0x49050001;CSP_COM_IF
@@ -108,9 +111,18 @@
0x5400CAFE;DUMMY_INTERFACE
0x54123456;LIBGPIOD_TEST
0x54694269;TEST_TASK
+0x60000000;HEATER_0_PLOC_PROC_BRD
+0x60000001;HEATER_1_PCDU_BRD
+0x60000002;HEATER_2_ACS_BRD
+0x60000003;HEATER_3_OBC_BRD
+0x60000004;HEATER_4_CAMERA
+0x60000005;HEATER_5_STR
+0x60000006;HEATER_6_DRO
+0x60000007;HEATER_7_HPA
0x73000001;ACS_BOARD_ASS
0x73000002;SUS_BOARD_ASS
0x73000003;TCS_BOARD_ASS
+0x73000004;RW_ASS
0x73000100;TM_FUNNEL
0x73500000;CCSDS_IP_CORE_BRIDGE
0xFFFFFFFF;NO_OBJECT
diff --git a/config/returnvalues.csv b/config/returnvalues.csv
index da26342..b25649f 100644
--- a/config/returnvalues.csv
+++ b/config/returnvalues.csv
@@ -60,6 +60,8 @@
0x4603; HGIO_GpioTypeFailure;;3;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h;HAL_GPIO
0x4604; HGIO_GpioInvalidInstance;;4;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h;HAL_GPIO
0x4605; HGIO_GpioDuplicateDetected;;5;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h;HAL_GPIO
+0x4606; HGIO_GpioInitFailed;;6;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h;HAL_GPIO
+0x4607; HGIO_GpioGetValueFailed;;7;fsfw/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h;HAL_GPIO
0x4200; UXOS_ExecutionFinished;Execution of the current command has finished;0;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h;LINUX_OSAL
0x4201; UXOS_CommandPending;Command is pending. This will also be returned if the user tries to load another command but a command is still pending;1;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h;LINUX_OSAL
0x4202; UXOS_BytesRead;Some bytes have been read from the executing process;2;fsfw/hal/src/fsfw_hal/linux/CommandExecutor.h;LINUX_OSAL
diff --git a/config/version.py b/config/version.py
deleted file mode 100644
index 56db5af..0000000
--- a/config/version.py
+++ /dev/null
@@ -1,6 +0,0 @@
-SW_NAME = "eive"
-VERSION_MAJOR = 1
-VERSION_MINOR = 9
-VERSION_SUBMINOR = 0
-
-__version__ = "1.9.0"
diff --git a/gomspace/gomspace_common.py b/gomspace/gomspace_common.py
index c8741c1..aff5d20 100644
--- a/gomspace/gomspace_common.py
+++ b/gomspace/gomspace_common.py
@@ -8,7 +8,7 @@
"""
import enum
-from tmtccmd.tc.service_8_functional_cmd import generate_action_command
+from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.definitions import PusTelecommand
diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py
index a9e4387..ad4c3f3 100644
--- a/pus_tc/cmd_definitions.py
+++ b/pus_tc/cmd_definitions.py
@@ -1,3 +1,4 @@
+from pus_tc.devs.gps import GpsOpCodes
from tmtccmd.config import (
add_op_code_entry,
add_service_op_code_entry,
@@ -6,9 +7,288 @@ from tmtccmd.config import (
OpCodeDictKeys,
)
from config.definitions import CustomServiceList
+from pus_tc.devs.heater import add_heater_cmds
+from pus_tc.devs.reaction_wheels import add_rw_cmds
from pus_tc.devs.bpx_batt import BpxOpCodes
+def get_eive_service_op_code_dict() -> ServiceOpCodeDictT:
+ from tmtccmd.config.globals import get_default_service_op_code_dict
+
+ service_op_code_dict = get_default_service_op_code_dict()
+ add_bpx_cmd_definitions(cmd_dict=service_op_code_dict)
+ add_core_controller_definitions(cmd_dict=service_op_code_dict)
+ add_pl_pcdu_cmds(cmd_dict=service_op_code_dict)
+ add_pcdu_cmds(cmd_dict=service_op_code_dict)
+ add_imtq_cmds(cmd_dict=service_op_code_dict)
+ add_rad_sens_cmds(cmd_dict=service_op_code_dict)
+ add_rw_cmds(cmd_dict=service_op_code_dict)
+ 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)
+ add_syrlinks_cmds(cmd_dict=service_op_code_dict)
+ add_gps_cmds(cmd_dict=service_op_code_dict)
+ add_str_cmds(cmd_dict=service_op_code_dict)
+ add_ccsds_cmds(cmd_dict=service_op_code_dict)
+ add_pdec_cmds(cmd_dict=service_op_code_dict)
+ add_heater_cmds(cmd_dict=service_op_code_dict)
+ add_tmp_sens_cmds(cmd_dict=service_op_code_dict)
+ add_proc_cmds(cmd_dict=service_op_code_dict)
+ return service_op_code_dict
+
+
+def add_tmp_sens_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict = {
+ "0": ("TMP1075 Tests", {OpCodeDictKeys.TIMEOUT: 2.2}),
+ }
+ service_tuple = ("TMP1075 1", op_code_dict)
+ cmd_dict[CustomServiceList.TMP1075_1.value] = service_tuple
+ service_tuple = ("TMP1075 2", op_code_dict)
+ cmd_dict[CustomServiceList.TMP1075_2.value] = service_tuple
+
+
+def add_pdec_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict_srv_pdec_handler = {
+ "0": ("PDEC Handler: Print CLCW", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "1": ("PDEC Handler: Print PDEC monitor", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ }
+ service_pdec_handler_tuple = ("PDEC Handler", op_code_dict_srv_pdec_handler)
+ cmd_dict[CustomServiceList.PDEC_HANDLER.value] = service_pdec_handler_tuple
+
+
+def add_ccsds_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict_srv_ccsds_handler = {
+ "0": ("CCSDS Handler: Set low rate", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "1": ("CCSDS Handler: Set high rate", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "2": ("CCSDS Handler: Enable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "3": ("CCSDS Handler: Disable transmitter", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "4": ("CCSDS Handler: Set arbitrary bitrate", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "5": (
+ "CCSDS Handler: Enable tx clock manipulator",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "6": (
+ "CCSDS Handler: Disable tx clock manipulator",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "7": (
+ "CCSDS Handler: Update tx data on rising edge",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "8": (
+ "CCSDS Handler: Update tx data on falling edge",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ }
+ service_ccsds_handler_tuple = ("CCSDS Handler", op_code_dict_srv_ccsds_handler)
+ cmd_dict[CustomServiceList.CCSDS_HANDLER.value] = service_ccsds_handler_tuple
+
+
+def add_gps_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict = {
+ GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0})
+ }
+ service_tuple = ("GPS 0", op_code_dict)
+ cmd_dict[CustomServiceList.GPS_0.value] = service_tuple
+ cmd_dict[CustomServiceList.GPS_1.value] = service_tuple
+
+
+def add_str_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict_srv_star_tracker = {
+ "0": (
+ "Star Tracker: Mode On, Submode Bootloader",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "1": ("Star Tracker: Mode On, Submode Firmware", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "2": ("Star Tracker: Mode Normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "3": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "4": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "5": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 5.0}),
+ "6": (
+ "Star Tracker: Switch to bootloader program",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "7": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "8": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "9": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "10": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "11": (
+ "Star Tracker: Set subscription parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "12": (
+ "Star Tracker: Boot image (requires bootloader mode)",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "13": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "14": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "15": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "16": ("Star Tracker: Download image", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "17": ("Star Tracker: Set limit parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "18": ("Star Tracker: Set tracking parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "19": ("Star Tracker: Set mounting parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "20": ("Star Tracker: Set camera parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "22": (
+ "Star Tracker: Set centroiding parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "23": ("Star Tracker: Set LISA parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "24": ("Star Tracker: Set matching parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "25": (
+ "Star Tracker: Set validation parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "26": ("Star Tracker: Set algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "27": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "28": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "30": (
+ "Star Tracker: Set name of download image",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "31": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "32": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "33": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "35": ("Star Tracker: Flash read", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "36": ("Star Tracker: Set flash read filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "37": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "49": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "50": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "51": (
+ "Star Tracker: Set image processor parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "52": (
+ "Star Tracker: (EGSE only) Load camera ground config ",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "53": (
+ "Star Tracker: (EGSE only) Load camera flight config",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "54": (
+ "Star Tracker: Request log level parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "55": (
+ "Star Tracker: Request mounting parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "56": (
+ "Star Tracker: Request image processor parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "57": (
+ "Star Tracker: Request centroiding parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "58": ("Star Tracker: Request lisa parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "59": (
+ "Star Tracker: Request matching parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "60": (
+ "Star Tracker: Request tracking parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "61": (
+ "Star Tracker: Request validation parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "62": ("Star Tracker: Request algo parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "63": (
+ "Star Tracker: Request subscription parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "64": (
+ "Star Tracker: Request log subscription parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "65": (
+ "Star Tracker: Request debug camera parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "66": ("Star Tracker: Set log level parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "67": (
+ "Star Tracker: Set log subscription parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "68": (
+ "Star Tracker: Set debug camera parameters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "69": ("Star Tracker: Firmware update", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "70": (
+ "Star Tracker: Disable timestamp generation",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "71": (
+ "Star Tracker: Enable timestamp generation",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ }
+ service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
+ cmd_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
+
+
+def add_syrlinks_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict_srv_syrlinks_handler = {
+ "0": ("Syrlinks Handler: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "1": ("Syrlinks Handler: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "2": ("Syrlinks Handler: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "3": ("Syrlinks Handler: Set TX standby", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "4": ("Syrlinks Handler: Set TX modulation", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "5": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "6": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "7": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "8": (
+ "Syrlinks Handler: Read TX AGC value high byte ",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "9": (
+ "Syrlinks Handler: Read TX AGC value low byte ",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "12": (
+ "Syrlinks Handler: Write LCL config",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "13": (
+ "Syrlinks Handler: Read RX status registers",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "14": (
+ "Syrlinks Handler: Read LCL config register",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "15": (
+ "Syrlinks Handler: Set waveform OQPSK",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "16": (
+ "Syrlinks Handler: Set waveform BPSK",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "17": (
+ "Syrlinks Handler: Set second config",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "18": (
+ "Syrlinks Handler: Enable debug output",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "19": (
+ "Syrlinks Handler: Disable debug output",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ }
+ service_syrlinks_handler_tuple = (
+ "Syrlinks Handler",
+ op_code_dict_srv_syrlinks_handler,
+ )
+ cmd_dict[CustomServiceList.SYRLINKS.value] = service_syrlinks_handler_tuple
+
+
def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
@@ -471,6 +751,12 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
info="PDU2 Device",
op_code_entry=op_code_dict,
)
+ op_code_dict = {
+ "0": ("ACU: Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "51": ("ACU: Print channel statistics", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ }
+ service_tuple = ("ACU Devices", op_code_dict)
+ cmd_dict[CustomServiceList.ACU.value] = service_tuple
def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT):
@@ -489,25 +775,6 @@ def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT):
cmd_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
-def add_rw_cmds(cmd_dict: ServiceOpCodeDictT):
- op_code_dict_srv_rw = {
- "0": ("Reaction Wheel: Run all commands", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "1": ("Reaction Wheel: Set speed", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "5": (
- "Reaction Wheel: Send get-telemetry-command",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
- }
- service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw)
- cmd_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple
- cmd_dict[CustomServiceList.REACTION_WHEEL_2.value] = service_rw_tuple
- cmd_dict[CustomServiceList.REACTION_WHEEL_3.value] = service_rw_tuple
- cmd_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple
-
-
def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict_srv_rad_sensor = {
"0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
@@ -541,6 +808,8 @@ def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT):
"14": ("Ploc MPSoC: Mode replay", {OpCodeDictKeys.TIMEOUT: 2.0}),
"15": ("Ploc MPSoC: Mode idle", {OpCodeDictKeys.TIMEOUT: 2.0}),
"16": ("Ploc MPSoC: Tc cam command send", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "17": ("Ploc MPSoC: Set UART TX tristate", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "18": ("Ploc MPSoC: Relesase UART TX", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_mpsoc_tuple = ("Ploc MPSoC", op_code_dict_srv_ploc_mpsoc)
cmd_dict[CustomServiceList.PLOC_MPSOC.value] = service_ploc_mpsoc_tuple
@@ -560,7 +829,6 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
"1": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("PLOC Supervisor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("PLOC Supervisor: Get HK Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": (
@@ -576,18 +844,9 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
"PLOC Supervisor: Request boot status report",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
- "14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "16": (
- "PLOC Supervisor: Watchdog Configure Timeout",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
"17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
"18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
"20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}),
"23": (
"PLOC Supervisor: Set ADC enabled channels",
{OpCodeDictKeys.TIMEOUT: 2.0},
@@ -602,14 +861,8 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "28": (
- "PLOC Supervisor: Enable/Disable NVM0/1/3",
- {OpCodeDictKeys.TIMEOUT: 2.0},
- ),
"30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}),
"35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
"36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
"37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}),
@@ -625,21 +878,32 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
"PLOC Supervisor: Factory reset clear circular entries",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
- "41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}),
"42": ("PLOC Supervisor: Perform update", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "43": ("PLOC Supervisor: Terminate supervisor process", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "43": (
+ "PLOC Supervisor: Terminate supervisor process",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
"44": ("PLOC Supervisor: Start MPSoC quiet", {OpCodeDictKeys.TIMEOUT: 2.0}),
"45": ("PLOC Supervisor: Set shutdown timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
"46": ("PLOC Supervisor: Factory flash", {OpCodeDictKeys.TIMEOUT: 2.0}),
"47": ("PLOC Supervisor: Enable auto TM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"48": ("PLOC Supervisor: Disable auto TM", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "49": ("PLOC Supervisor: Enable ADC monitor task", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "50": ("PLOC Supervisor: Disable ADC monitor task", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "51": ("PLOC Supervisor: Logging request event buffers", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "52": ("PLOC Supervisor: Logging clear counters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "51": (
+ "PLOC Supervisor: Logging request event buffers",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
+ "52": (
+ "PLOC Supervisor: Logging clear counters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
"53": ("PLOC Supervisor: Logging set topic", {OpCodeDictKeys.TIMEOUT: 2.0}),
- "54": ("PLOC Supervisor: Logging request counters", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "54": (
+ "PLOC Supervisor: Logging request counters",
+ {OpCodeDictKeys.TIMEOUT: 2.0},
+ ),
"55": ("PLOC Supervisor: Request ADC Report", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "56": ("PLOC Supervisor: Reset PL", {OpCodeDictKeys.TIMEOUT: 2.0}),
+ "57": ("PLOC Supervisor: Enable NVMs", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)
@@ -677,9 +941,7 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT):
{OpCodeDictKeys.TIMEOUT: 2.0},
),
}
- service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater)
cmd_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
- cmd_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple
cmd_dict[
CustomServiceList.PLOC_MEMORY_DUMPER.value
] = service_ploc_memory_dumper_tuple
diff --git a/pus_tc/devs/bpx_batt.py b/pus_tc/devs/bpx_batt.py
index a9f6311..3073327 100644
--- a/pus_tc/devs/bpx_batt.py
+++ b/pus_tc/devs/bpx_batt.py
@@ -1,7 +1,7 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from config.object_ids import BPX_HANDLER_ID
-from tmtccmd.tc.service_8_functional_cmd import generate_action_command
-from tmtccmd.tc.service_3_housekeeping import generate_one_hk_command, make_sid
+from tmtccmd.tc.pus_8_funccmd import generate_action_command
+from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
class BpxSetIds:
diff --git a/pus_tc/devs/gps.py b/pus_tc/devs/gps.py
index 5297530..d0f3f21 100644
--- a/pus_tc/devs/gps.py
+++ b/pus_tc/devs/gps.py
@@ -2,7 +2,7 @@ import enum
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_8_functional_cmd import generate_action_command
+from tmtccmd.tc.pus_8_funccmd import generate_action_command
from config.object_ids import GPS_HANDLER_1_ID, GPS_HANDLER_0_ID
diff --git a/pus_tc/devs/heater.py b/pus_tc/devs/heater.py
index e04b5b0..4dc9ef5 100644
--- a/pus_tc/devs/heater.py
+++ b/pus_tc/devs/heater.py
@@ -1,59 +1,224 @@
# -*- coding: utf-8 -*-
-"""
-@file tmtcc_tc_heater.py
-@brief Command sequence to test the HeaterHandler
+"""Command sequence to test the HeaterHandler
@author J. Meier
@date 30.01.2021
"""
-from tmtccmd.config.definitions import QueueCommands
+import enum
+
+from config.definitions import CustomServiceList
+from config.object_ids import get_object_ids
+from tmtccmd.utility.obj_id import ObjectId
+from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
+from tmtccmd.tc.pus_201_fsfw_health import (
+ pack_set_health_cmd_data,
+ FsfwHealth,
+ Subservices,
+)
+from tmtccmd.tc.pus_8_funccmd import generate_action_command
+from tmtccmd.config.globals import add_service_op_code_entry, add_op_code_entry
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
class SwitchNumbers:
- HEATER_0 = 0
- HEATER_1 = 1
- HEATER_2 = 2
- HEATER_3 = 3
- HEATER_4 = 4
- HEATER_5 = 5
- HEATER_6 = 6
- HEATER_7 = 7
+ HEATER_0_OBC_BRD = 0
+ HEATER_1_PLOC_PROC_BRD = 1
+ HEATER_2_ACS_BRD = 2
+ HEATER_3_PCDU_PDU = 3
+ HEATER_4_CAMERA = 4
+ HEATER_5_STR = 5
+ HEATER_6_DRO = 6
+ HEATER_7_HPA = 7
NUMBER_OF_SWITCHES = 8
-class ActionIds:
- SWITCH_HEATER = bytearray([0x0, 0x0, 0x0, 0x0])
+class OpCodes:
+ HEATER_CMD = ["0", "switch-cmd"]
+ HEATER_EXT_CTRL = ["1", "set-ext-ctrl"]
+ HEATER_FAULTY_CMD = ["2", "set-faulty"]
+ HEATER_HEALTHY_CMD = ["3", "set-healthy"]
-def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
- tc_queue.appendleft((QueueCommands.PRINT, "Testing Heater Switching"))
+class Info:
+ HEATER_CMD = "Heater Switch Command"
+ HEATER_EXT_CTRL = "Set to external control"
+ HEATER_FAULTY_CMD = "Set to faulty"
+ HEATER_HEALTHY_CMD = "Set to healthy"
- heater_number = int(input("Type number of heater to switch [0-7]: "))
- if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0:
- print("Invalid heater switch number")
- return
- action = int(input("Turn switch on or off? (0 - off, 1 - on): "))
- if action != 0 and action != 1:
- print("Invalid action defined. Must be 0 (off) or 1 (on")
- debug_string = "Switching heater " + str(heater_number)
- tc_queue.appendleft((QueueCommands.PRINT, debug_string))
- command = pack_switch_heater_command(object_id, heater_number, action)
- command = PusTelecommand(service=8, subservice=128, ssc=300, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
+
+# Needed in OBSW to differentiate between external and internal heater commands
+COMMAND_SOURCE_PARAM_EXTERNAL = 1
+
+
+class ActionIds(enum.IntEnum):
+ SWITCH_HEATER = 0
+
+
+def add_heater_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict = dict()
+ add_op_code_entry(
+ op_code_dict=op_code_dict, keys=OpCodes.HEATER_CMD, info=Info.HEATER_CMD
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict,
+ keys=OpCodes.HEATER_HEALTHY_CMD,
+ info=Info.HEATER_HEALTHY_CMD,
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict,
+ keys=OpCodes.HEATER_EXT_CTRL,
+ info=Info.HEATER_EXT_CTRL,
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict,
+ keys=OpCodes.HEATER_FAULTY_CMD,
+ info=Info.HEATER_FAULTY_CMD,
+ )
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.HEATER.value,
+ info="Heater Device",
+ op_code_entry=op_code_dict,
+ )
+
+
+def pack_heater_cmds(object_id: bytearray, op_code: str, tc_queue: TcQueueT):
+ if op_code in OpCodes.HEATER_CMD:
+ tc_queue.appendleft((QueueCommands.PRINT, "Heater Switching"))
+ heater_number = prompt_heater()
+ while True:
+ action = input("Turn switch on or off? (0 - off, 1 - on): ")
+ if not action.isdigit():
+ print("Switch action not valid")
+ continue
+ action = int(action)
+ if action != 0 and action != 1:
+ print("Invalid action defined. Must be 0 (off) or 1 (on")
+ continue
+ break
+ if action == 1:
+ act_str = "on"
+ else:
+ act_str = "off"
+ debug_string = f"Switching heater {heater_number} {act_str}"
+ tc_queue.appendleft((QueueCommands.PRINT, debug_string))
+ command = pack_switch_heater_command(object_id, heater_number, action)
+ tc_queue.appendleft(command.pack_command_tuple())
+ if op_code in OpCodes.HEATER_EXT_CTRL:
+ heater_number = prompt_heater()
+ obj_id = heater_idx_to_obj(heater_number)
+ health_cmd(
+ tc_queue=tc_queue,
+ object_id=obj_id,
+ health=FsfwHealth.EXTERNAL_CTRL,
+ health_str="External Control",
+ heater_idx=heater_number,
+ )
+ if op_code in OpCodes.HEATER_FAULTY_CMD:
+ heater_number = prompt_heater()
+ obj_id = heater_idx_to_obj(heater_number)
+ health_cmd(
+ tc_queue=tc_queue,
+ object_id=obj_id,
+ health=FsfwHealth.FAULTY,
+ health_str="Faulty",
+ heater_idx=heater_number,
+ )
+ if op_code in OpCodes.HEATER_HEALTHY_CMD:
+ heater_number = prompt_heater()
+ obj_id = heater_idx_to_obj(heater_number)
+ health_cmd(
+ tc_queue=tc_queue,
+ object_id=obj_id,
+ health=FsfwHealth.HEALTHY,
+ health_str="Healthy",
+ heater_idx=heater_number,
+ )
+
+
+def heater_idx_to_obj(heater: int) -> ObjectId:
+ from config.object_ids import (
+ HEATER_0_OBC_BRD,
+ HEATER_1_PLOC_PROC_BRD,
+ HEATER_2_ACS_BRD,
+ HEATER_3_PCDU_BRD,
+ HEATER_4_CAMERA,
+ HEATER_5_STR,
+ HEATER_6_DRO,
+ HEATER_7_HPA,
+ )
+
+ obj_id_array = [
+ HEATER_0_OBC_BRD,
+ HEATER_1_PLOC_PROC_BRD,
+ HEATER_2_ACS_BRD,
+ HEATER_3_PCDU_BRD,
+ HEATER_4_CAMERA,
+ HEATER_5_STR,
+ HEATER_6_DRO,
+ HEATER_7_HPA,
+ ]
+ obj_dict = get_object_ids()
+ obj_id_obj = obj_dict.get(obj_id_array[heater])
+ if obj_id_obj is None:
+ return ObjectId.from_bytes(obj_id_array[heater])
+ return obj_id_obj
+
+
+def prompt_heater() -> int:
+ while True:
+ print("HEATER 0 | PLOC PROC Board")
+ print("HEATER 1 | PCDU Board")
+ print("HEATER 2 | ACS Board")
+ print("HEATER 3 | OBC Board")
+ print("HEATER 4 | CAMERA")
+ print("HEATER 5 | STR")
+ print("HEATER 6 | DRO")
+ print("HEATER 7 | HPA")
+ heater_number = input("Type number of heater to switch [0-7]: ")
+ if not heater_number.isdigit():
+ print("Heater number not a digit")
+ continue
+ heater_number = int(heater_number)
+ if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0:
+ print("Invalid heater switch number")
+ continue
+ break
+ return heater_number
+
+
+def health_cmd(
+ tc_queue: TcQueueT,
+ heater_idx: int,
+ object_id: ObjectId,
+ health: FsfwHealth,
+ health_str: str,
+):
+ tc_queue.appendleft(
+ (
+ QueueCommands.PRINT,
+ f"Setting Heater {heater_idx} {object_id} to {health_str}",
+ )
+ )
+ app_data = pack_set_health_cmd_data(object_id=object_id.as_bytes, health=health)
+ cmd = PusTelecommand(
+ service=201, subservice=Subservices.TC_SET_HEALTH, app_data=app_data
+ )
+ tc_queue.appendleft(cmd.pack_command_tuple())
def pack_switch_heater_command(
- object_id: bytearray, switch_nr: int, switch_action: int
-) -> bytearray:
- """Function to generate the command switch a heater
- @param object_id The object id of the HeaterHandler object.
- @param switch_nr The switch number identifying the heater to switch
- @param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.
+ object_id: bytes, switch_nr: int, switch_action: int
+) -> PusTelecommand:
+ """Function to generate a heater switch command.
+ :param object_id: The object id of the HeaterHandler object.
+ :param switch_nr: The switch number identifying the heater to switch
+ :param switch_action: Action to perform. 0 - Sets switch off, 1 - Sets switch on.
"""
- action_id = ActionIds.SWITCH_HEATER
command = bytearray()
- command += object_id + action_id
command.append(switch_nr)
command.append(switch_action)
- return command
+ command.append(COMMAND_SOURCE_PARAM_EXTERNAL)
+ return generate_action_command(
+ object_id=object_id, action_id=ActionIds.SWITCH_HEATER, app_data=command
+ )
diff --git a/pus_tc/devs/imtq.py b/pus_tc/devs/imtq.py
index 2ef75a8..7c1f136 100644
--- a/pus_tc/devs/imtq.py
+++ b/pus_tc/devs/imtq.py
@@ -9,7 +9,7 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
-from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
+from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
class ImtqSetIds:
diff --git a/pus_tc/devs/p60dock.py b/pus_tc/devs/p60dock.py
index dbdc59a..03bbd5b 100644
--- a/pus_tc/devs/p60dock.py
+++ b/pus_tc/devs/p60dock.py
@@ -7,7 +7,7 @@
"""
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
-from tmtccmd.tc.service_3_housekeeping import (
+from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
make_sid,
generate_one_diag_command,
diff --git a/pus_tc/devs/pdu1.py b/pus_tc/devs/pdu1.py
index 2028639..08ddbd9 100644
--- a/pus_tc/devs/pdu1.py
+++ b/pus_tc/devs/pdu1.py
@@ -5,7 +5,7 @@
"""
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
-from tmtccmd.tc.service_3_housekeeping import (
+from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
make_sid,
generate_one_diag_command,
diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py
index c4e3623..12c1636 100644
--- a/pus_tc/devs/pdu2.py
+++ b/pus_tc/devs/pdu2.py
@@ -8,7 +8,7 @@
"""
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
-from tmtccmd.tc.service_3_housekeeping import (
+from tmtccmd.tc.pus_3_fsfw_hk import (
generate_one_hk_command,
generate_one_diag_command,
make_sid,
diff --git a/pus_tc/devs/ploc_mpsoc.py b/pus_tc/devs/ploc_mpsoc.py
index 9a39acb..c285680 100644
--- a/pus_tc/devs/ploc_mpsoc.py
+++ b/pus_tc/devs/ploc_mpsoc.py
@@ -14,7 +14,7 @@ from tmtccmd.logging import get_console_logger
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
from utility.input_helper import InputHelper
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
LOGGER = get_console_logger()
@@ -53,14 +53,17 @@ class CommandIds(enum.IntEnum):
TC_MODE_REPLAY = 16
TC_CAM_CMD_SEND = 17
TC_MODE_IDLE = 18
+ SET_UART_TX_TRISTATE = 20
+ RELEASE_UART_TX = 21
class MemAddresses(enum.IntEnum):
DEADBEEF = 0x40000004
-class PlocReplyIds:
- tm_mem_read_report = 6
+class PlocReplyIds(enum.IntEnum):
+ TM_MEM_READ_RPT = 6
+ TM_CAM_CMD_RPT = 19
def pack_ploc_mpsoc_commands(
@@ -172,9 +175,23 @@ def pack_ploc_mpsoc_commands(
elif op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Tc cam command send"))
cam_cmd = input("Specify cam command string: ")
- command = object_id + struct.pack("!I", CommandIds.TC_CAM_CMD_SEND) + bytearray(cam_cmd, 'utf-8')
+ command = (
+ object_id
+ + struct.pack("!I", CommandIds.TC_CAM_CMD_SEND)
+ + bytearray(cam_cmd, "utf-8")
+ )
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
+ elif op_code == "17":
+ tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set UART TX tristate"))
+ command = object_id + struct.pack("!I", CommandIds.SET_UART_TX_TRISTATE)
+ command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
+ tc_queue.appendleft(command.pack_command_tuple())
+ elif op_code == "18":
+ tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Release UART TX"))
+ command = object_id + struct.pack("!I", CommandIds.RELEASE_UART_TX)
+ command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
+ tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
diff --git a/pus_tc/devs/ploc_supervisor.py b/pus_tc/devs/ploc_supervisor.py
index 6e8effb..c6fcd56 100644
--- a/pus_tc/devs/ploc_supervisor.py
+++ b/pus_tc/devs/ploc_supervisor.py
@@ -12,7 +12,7 @@ from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.logging import get_console_logger
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from utility.input_helper import InputHelper
LOGGER = get_console_logger()
@@ -32,6 +32,18 @@ MANUAL_INPUT = "1"
update_file_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"],
+ "3": [
+ "/mnt/sd0/ploc/supervisor/update-large.bin",
+ "/mnt/sd0/ploc/supervisor/update-large.bin",
+ ],
+ "4": [
+ "/mnt/sd0/ploc/supervisor/update-small.bin",
+ "/mnt/sd0/ploc/supervisor/update-small.bin",
+ ],
+ "5": [
+ "/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
+ "/mnt/sd0/ploc/supervisor/mpsoc-uart-working.bin",
+ ],
}
event_buffer_path_dict = {
@@ -42,7 +54,6 @@ event_buffer_path_dict = {
class SupvActionIds:
HK_REPORT = 1
- RESTART_MPSOC = 2
START_MPSOC = 3
SHUTWOWN_MPSOC = 4
SEL_MPSOC_BOOT_IMAGE = 5
@@ -53,27 +64,19 @@ class SupvActionIds:
DISABLE_HK = 10
GET_BOOT_STATUS_REPORT = 11
UPDATE_AVAILABLE = 12
- WATCHDOGS_ENABLE = 13
- WATCHDOGS_CONFIG_TIMEOUT = 14
ENABLE_LATCHUP_ALERT = 15
DISABLE_LATCHUP_ALERT = 16
- AUTO_CALIBRATE_ALERT = 17
SET_ALERT_LIMIT = 18
- SET_ALERT_IRQ_FILTER = 19
SET_ADC_SWEEP_PERIOD = 20
SET_ADC_ENABLED_CHANNELS = 21
SET_ADC_WINDOW_AND_STRIDE = 22
SET_ADC_THRESHOLD = 23
GET_LATCHUP_STATUS_REPORT = 24
COPY_ADC_DATA_TO_MRAM = 25
- ENABLE_NVMS = 26
SELECT_NVM = 27
RUN_AUTO_EM_TESTS = 28
WIPE_MRAM = 29
DUMP_MRAM = 30
- SET_DBG_VERBOSITY = 31
- CAN_LOOPBACK_TEST = 32
- PRINT_CPU_STATS = 33
SET_GPIO = 34
READ_GPIO = 35
RESTART_SUPERVISOR = 36
@@ -89,12 +92,12 @@ class SupvActionIds:
TERMINATE_SUPV_HELPER = 49
ENABLE_AUTO_TM = 50
DISABLE_AUTO_TM = 51
- ENABLE_ADC_MONITOR_TASK = 52
- DISABLE_ADC_MONITOR_TASK = 53
LOGGING_REQUEST_EVENT_BUFFERS = 54
LOGGING_CLEAR_COUNTERS = 55
LOGGING_SET_TOPIC = 56
REQUEST_ADC_REPORT = 57
+ RESET_PL = 58
+ ENABLE_NVMS = 59
class SupvHkIds:
@@ -131,11 +134,6 @@ def pack_ploc_supv_commands(
command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "4":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart MPSoC"))
- command = object_id + struct.pack("!I", SupvActionIds.RESTART_MPSOC)
- command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC"))
command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC)
@@ -150,18 +148,18 @@ def pack_ploc_supv_commands(
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image")
)
- mem = int(input("MEM (NVM0 - 0 or NVM1 - 1):"))
- bp0 = int(input("BP0 (0 or 1):"))
- bp1 = int(input("BP1 (0 or 1):"))
- bp2 = int(input("BP2 (0 or 1):"))
+ mem = int(input("MEM (NVM0 - 0 or NVM1 - 1): "))
+ bp0 = int(input("BP0 (0 or 1): "))
+ bp1 = int(input("BP1 (0 or 1): "))
+ bp2 = int(input("BP2 (0 or 1): "))
command = pack_sel_boot_image_cmd(object_id, mem, bp0, bp1, bp2)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "8":
tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries: ")
+ (QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries")
)
- restart_tries = int(input("Set maximum restart tries:"))
+ restart_tries = int(input("Specify maximum restart tries: "))
command = (
object_id
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
@@ -183,7 +181,7 @@ def pack_ploc_supv_commands(
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
- boot_timeout = int(input("Specify boot timeout [ms]:"))
+ boot_timeout = int(input("Specify boot timeout [ms]: "))
command = (
object_id
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
@@ -203,23 +201,6 @@ def pack_ploc_supv_commands(
command = object_id + struct.pack("!I", SupvActionIds.GET_BOOT_STATUS_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "14":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update available"))
- command = pack_update_available_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "15":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Watchdogs Enable"))
- command = pack_watchdogs_enable_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "16":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Watchdog configure timeout")
- )
- command = pack_watchdog_config_timeout_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "17":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert")
@@ -234,32 +215,11 @@ def pack_ploc_supv_commands(
command = pack_lachtup_alert_cmd(object_id, False)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "19":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Auto calibrate alert")
- )
- command = pack_auto_calibrate_alert_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "20":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set alert limit"))
command = pack_set_alert_limit_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "21":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Set alert irq filter")
- )
- command = pack_set_alert_irq_filter_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "22":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Set ADC sweep period")
- )
- command = pack_set_adc_sweep_period_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "23":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels")
@@ -293,13 +253,6 @@ def pack_ploc_supv_commands(
command = object_id + struct.pack("!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "28":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Enalbe/Disable NVMs")
- )
- command = pack_enable_nvms_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "30":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Run auto EM tests"))
command = pack_auto_em_tests_cmd(object_id)
@@ -310,18 +263,6 @@ def pack_ploc_supv_commands(
command = pack_mram_wipe_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "33":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Print CPU stats"))
- command = pack_print_cpu_stats_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "34":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity")
- )
- command = pack_set_debug_verbosity_cmd(object_id)
- command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "35":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set GPIO command"))
command = pack_set_gpio_cmd(object_id)
@@ -336,25 +277,21 @@ def pack_ploc_supv_commands(
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")
)
- command = command = object_id + struct.pack(
- "!I", SupvActionIds.RESTART_SUPERVISOR
- )
+ command = object_id + struct.pack("!I", SupvActionIds.RESTART_SUPERVISOR)
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "38":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")
)
- command = command = object_id + struct.pack(
- "!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
- )
+ command = object_id + struct.pack("!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "39":
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries")
)
- command = command = object_id + struct.pack(
+ command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
@@ -366,87 +303,62 @@ def pack_ploc_supv_commands(
"PLOC Supervisor: Factory reset clear circular entries",
)
)
- command = command = object_id + struct.pack(
+ command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
)
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "41":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: CAN loopback test"))
- command = command = object_id + struct.pack(
- "!I", SupvActionIds.CAN_LOOPBACK_TEST
- )
- command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "42":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Perform update"))
command = pack_update_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "43":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Terminate supervisor process"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.TERMINATE_SUPV_HELPER
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Terminate supervisor process")
)
+ command = object_id + struct.pack("!I", SupvActionIds.TERMINATE_SUPV_HELPER)
command = PusTelecommand(service=8, subservice=128, ssc=58, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "44":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC quiet"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.START_MPSOC_QUIET
- )
+ command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC_QUIET)
command = PusTelecommand(service=8, subservice=128, ssc=59, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "45":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set shutdown timeout"))
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Set shutdown timeout")
+ )
command = pack_set_shutdown_timeout_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "46":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory flash"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.FACTORY_FLASH
- )
+ command = object_id + struct.pack("!I", SupvActionIds.FACTORY_FLASH)
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "47":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable auto TM"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.ENABLE_AUTO_TM
- )
+ command = object_id + struct.pack("!I", SupvActionIds.ENABLE_AUTO_TM)
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "48":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable auto TM"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.DISABLE_AUTO_TM
- )
+ command = object_id + struct.pack("!I", SupvActionIds.DISABLE_AUTO_TM)
command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "49":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable ADC monitor task"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.ENABLE_ADC_MONITOR_TASK
- )
- command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- elif op_code == "50":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable ADC monitor task"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.DISABLE_ADC_MONITOR_TASK
- )
- command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "51":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request event buffers"))
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Logging request event buffers")
+ )
command = pack_logging_buffer_request(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "52":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging clear counters"))
- command = object_id + struct.pack(
- "!I", SupvActionIds.LOGGING_CLEAR_COUNTERS
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Logging clear counters")
)
+ command = object_id + struct.pack("!I", SupvActionIds.LOGGING_CLEAR_COUNTERS)
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "53":
@@ -455,15 +367,36 @@ def pack_ploc_supv_commands(
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "54":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request counters"))
- command = object_id + struct.pack('!I', SupvActionIds.LOGGING_REQUEST_COUNTERS)
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Logging request counters")
+ )
+ command = object_id + struct.pack("!I", SupvActionIds.LOGGING_REQUEST_COUNTERS)
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "55":
- tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request ADC report"))
- command = object_id + struct.pack('!I', SupvActionIds.REQUEST_ADC_REPORT)
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, "PLOC Supervisor: Request ADC report")
+ )
+ command = object_id + struct.pack("!I", SupvActionIds.REQUEST_ADC_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
+ elif op_code == "56":
+ tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset PL"))
+ command = object_id + struct.pack("!I", SupvActionIds.RESET_PL)
+ command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
+ tc_queue.appendleft(command.pack_command_tuple())
+ elif op_code == "57":
+ tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable NVMs"))
+ nvm01 = int(input("Enable (1) or disable(0) NVM 0 and 1: "))
+ nvm3 = int(input("Enable (1) or disable(0) NVM 3: "))
+ command = (
+ object_id
+ + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
+ + struct.pack("B", nvm01)
+ + struct.pack("B", nvm3)
+ )
+ command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
+ tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
@@ -478,7 +411,6 @@ def pack_sel_boot_image_cmd(
@param bp1 Partition pin 1
@param bp2 Partition pin 2
"""
- command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
command = command + struct.pack("!B", mem)
command = command + struct.pack("!B", bp0)
@@ -497,7 +429,6 @@ def pack_update_available_cmd(object_id: bytearray) -> bytearray:
image_size = 222
image_crc = 0x0
number_of_packets = 150
- command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
command = command + struct.pack("!B", image_select)
command = command + struct.pack("!B", image_partition)
@@ -560,7 +491,7 @@ def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
@param object_id The object id of the PLOC supervisor handler.
"""
latchup_id = get_latchup_id()
- mg = int(input("Specify MG:"))
+ mg = int(input("Specify MG: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.AUTO_CALIBRATE_ALERT)
command = command + struct.pack("!B", latchup_id)
@@ -581,7 +512,7 @@ def get_latchup_id() -> int:
key_string = key.ljust(key_column_width)
description_string = latchup_id_dict[key].ljust(description_column_width)
print(f"{key_string} | {description_string}")
- return int(input("Specify latchup ID:"))
+ return int(input("Specify latchup ID: "))
def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
@@ -590,7 +521,7 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
@param object_id The object id of the PLOC supervisor handler.
"""
latchup_id = get_latchup_id()
- dutycycle = int(input("Specify dutycycle:"))
+ dutycycle = int(input("Specify dutycycle: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
command = command + struct.pack("!B", latchup_id)
@@ -598,49 +529,20 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
return command
-def pack_set_alert_irq_filter_cmd(object_id: bytearray) -> bytearray:
- """
- @brief This function packs the command to configure the latchup alert irq filter.
- @param object_id The object id of the PLOC supervisor handler.
- """
- latchup_id = get_latchup_id()
- tp = int(input("Specify filter type (TP):"))
- div = int(input("Specify clock divider (DIV):"))
- command = bytearray()
- command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_IRQ_FILTER)
- command = command + struct.pack("!B", latchup_id)
- command = command + struct.pack("!B", tp)
- command = command + struct.pack("!B", div)
- return command
-
-
-def pack_set_adc_sweep_period_cmd(object_id: bytearray) -> bytearray:
- """
- @brief This function packs the command to set the limit of a latchup alert.
- @param object_id The object id of the PLOC supervisor handler.
- """
- sweep_period = int(input("Specify sweep period (min 21 us):"))
- command = bytearray()
- command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_SWEEP_PERIOD)
- command = command + struct.pack("!I", sweep_period)
- return command
-
-
def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray:
"""
@brief This function packs the command to enable or disable channels of the ADC.
@param object_id The object id of the PLOC supervisor handler.
"""
- ch = int(input("Specify ch:"))
- command = bytearray()
- command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
- command = command + struct.pack("!H", ch)
- return command
+ ch = int(input("Specify ch: 0x"), 16)
+ cmd = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
+ cmd = cmd + struct.pack("!H", ch)
+ return cmd
def pack_set_adc_window_and_stride_cmd(object_id: bytearray) -> bytearray:
- window_size = int(input("Specify window size:"))
- striding_step_size = int(input("Specify striding step size:"))
+ window_size = int(input("Specify window size: "))
+ striding_step_size = int(input("Specify striding step size: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
command = command + struct.pack("!H", window_size)
@@ -649,25 +551,15 @@ def pack_set_adc_window_and_stride_cmd(object_id: bytearray) -> bytearray:
def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray:
- threshold = int(input("Specify threshold:"))
+ threshold = int(input("Specify threshold: "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
command = command + struct.pack("!I", threshold)
return command
-def pack_enable_nvms_cmd(object_id: bytearray) -> bytearray:
- n01 = int(input("NVM0/1 (0 - off, 1 - on):"))
- n3 = int(input("NVM3 (0 - off, 1 - on):"))
- command = bytearray()
- command = object_id + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
- command = command + struct.pack("!B", n01)
- command = command + struct.pack("!B", n3)
- return command
-
-
def pack_select_nvm_cmd(object_id: bytearray) -> bytearray:
- mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1):"))
+ mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1): "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
command = command + struct.pack("!B", mem)
@@ -675,7 +567,7 @@ def pack_select_nvm_cmd(object_id: bytearray) -> bytearray:
def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray:
- test = int(input("Specify test (1 - complete, 2 - short):"))
+ test = int(input("Specify test (1 - complete, 2 - short): "))
command = bytearray()
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
command = command + struct.pack("!B", test)
@@ -692,85 +584,43 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray:
return command
-def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray:
- en = 1
- command = bytearray()
- command = object_id + struct.pack("!I", SupvActionIds.PRINT_CPU_STATS)
- command = command + struct.pack("!B", en)
- return command
-
-
-def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray:
- command = bytearray()
- verbosity = get_debug_verbosity()
- command = object_id + struct.pack("!I", SupvActionIds.SET_DBG_VERBOSITY)
- command = command + struct.pack("!B", verbosity)
- return command
-
-
def pack_update_command(object_id: bytearray) -> bytearray:
command = bytearray()
memory_id = int(input("Specify memory ID: "))
start_address = int(input("Specify start address: 0x"), 16)
update_file = get_update_file()
command += object_id
- command += struct.pack('!I', SupvActionIds.PERFORM_UPDATE)
- command += bytearray(update_file, 'utf-8')
+ command += struct.pack("!I", SupvActionIds.PERFORM_UPDATE)
+ command += bytearray(update_file, "utf-8")
# Adding null terminator
- command += struct.pack('!B', 0)
- command += struct.pack('!B', memory_id)
- command += struct.pack('!I', start_address)
+ command += struct.pack("!B", 0)
+ command += struct.pack("!B", memory_id)
+ command += struct.pack("!I", start_address)
return command
def pack_set_shutdown_timeout_command(object_id: bytearray) -> bytearray:
command = bytearray()
command += object_id
- command += struct.pack('!I', SupvActionIds.SET_SHUTDOWN_TIMEOUT)
+ command += struct.pack("!I", SupvActionIds.SET_SHUTDOWN_TIMEOUT)
timeout = int(input("Specify shutdown timeout (ms): "))
- command += struct.pack('!I', timeout)
+ command += struct.pack("!I", timeout)
return command
def pack_logging_buffer_request(object_id: bytearray) -> bytearray:
command = bytearray()
command += object_id
- command += struct.pack('!I', SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
+ command += struct.pack("!I", SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
path = get_event_buffer_path()
- command += bytearray(path, 'utf-8')
+ command += bytearray(path, "utf-8")
return command
-def get_debug_verbosity() -> int:
- tries = 0
- while tries < 3:
- try:
- print("Debug verbosity options")
- verbosity_options_dict = {
- 0: "None",
- 1: "Error",
- 2: "Warn",
- 3: "Info",
- }
- print("{:<6} | {}".format("Key", "Description"))
- for entry in verbosity_options_dict.items():
- print("{:<6} | {}".format(entry[0], entry[1]))
- verbosity = int(input("Specify verbosity key: "))
- if verbosity > len(verbosity_options_dict) - 1:
- raise ValueError
- return verbosity
- except ValueError:
- LOGGER.warning("Invalid verbosity key specified")
- tries = tries + 1
- LOGGER.error("get_debug_verbosity: Exceeded max tries to input verbosity key")
- quit()
-
-
def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
- port = int(input("Specify port: "))
- pin = int(input("Specify pin: "))
- val = int(input("Specify val: "))
- command = bytearray()
+ port = int(input("Specify port: 0x"), 16)
+ pin = int(input("Specify pin: 0x"), 16)
+ val = int(input("Specify val: 0x"), 16)
command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin)
@@ -779,9 +629,8 @@ def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
- port = int(input("Specify port: "))
- pin = int(input("Specify pin: "))
- command = bytearray()
+ port = int(input("Specify port: 0x"), 16)
+ pin = int(input("Specify pin: 0x"), 16)
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin)
@@ -789,9 +638,9 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
def pack_logging_set_topic(objetc_id: bytearray) -> bytearray:
- command = objetc_id + struct.pack('!I', SupvActionIds.LOGGING_SET_TOPIC)
+ command = objetc_id + struct.pack("!I", SupvActionIds.LOGGING_SET_TOPIC)
tpc = int(input("Specify logging topic: "))
- command += struct.pack('!B', tpc)
+ command += struct.pack("!B", tpc)
return command
diff --git a/pus_tc/devs/ploc_upater.py b/pus_tc/devs/ploc_upater.py
deleted file mode 100644
index 6b49275..0000000
--- a/pus_tc/devs/ploc_upater.py
+++ /dev/null
@@ -1,148 +0,0 @@
-# -*- coding: utf-8 -*-
-"""
-@file ploc_udpater.py
-@brief Commands to initiate update transfer to ploc supervisor. This only updates the software of the MPSoC, it is not
- possible to update the software of the supervisor.
- The supervisor is programmed by Thales.
-@author J. Meier
-@date 10.07.2021
-"""
-import struct
-
-from tmtccmd.config.definitions import QueueCommands
-
-from tmtccmd.tc.packer import TcQueueT
-from spacepackets.ecss.tc import PusTelecommand
-
-
-latchup_id_dict = {
- "0": "0.85V",
- "1": "1.8V",
- "2": "MISC",
- "3": "3.3V",
- "4": "NVM_4XO",
- "5": "MISSION",
- "6": "SAFECOTS",
-}
-
-
-class UpdaterActionIds:
- UPDATE_A_UBOOT = 0
- UPDATE_A_BITSTREAM = 1
- UPDATE_A_LINUX = 2
- UPDATE_A_APP_SW = 3
- UPDATE_B_UBOOT = 4
- UPDATE_B_BITSTREAM = 5
- UPDATE_B_LINUX = 6
- UPDATE_B_LINUX = 7
-
-
-class ImagePathDefs:
- imageAuboot = "/mnt/sd0/ploc/updateAuboot.bin"
- imageAbitsream = "/mnt/sd0/ploc/updateAbitstream.bin"
- imageAlinux = "/mnt/sd0/ploc/updateAlinux.bin"
- imageAappsw = "/mnt/sd0/ploc/updateAappsw.bin"
- imageBuboot = "/mnt/sd0/ploc/updateBuboot.bin"
- imageBbitsream = "/mnt/sd0/ploc/updateBbitstream.bin"
- imageBlinux = "/mnt/sd0/ploc/updateBlinux.bin"
- imageBappsw = "/mnt/sd0/ploc/updateBappsw.bin"
-
-
-def pack_ploc_updater_test_into(
- object_id: bytearray, tc_queue: TcQueueT, op_code: str
-) -> TcQueueT:
- tc_queue.appendleft(
- (
- QueueCommands.PRINT,
- "Testing PLOC updater with object id: 0x" + object_id.hex(),
- )
- )
-
- if op_code == "0":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_A_UBOOT)
- + bytearray(ImagePathDefs.imageAuboot, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "1":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_A_BITSTREAM)
- + bytearray(ImagePathDefs.imageAbitsream, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "2":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_A_LINUX)
- + bytearray(ImagePathDefs.imageAlinux, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "3":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_A_APP_SW)
- + bytearray(ImagePathDefs.imageAappsw, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "4":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_B_UBOOT)
- + bytearray(ImagePathDefs.imageBuboot, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "5":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_B_BITSTREAM)
- + bytearray(ImagePathDefs.imageBbitsream, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "6":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_B_LINUX)
- + bytearray(ImagePathDefs.imageBlinux, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "7":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")
- )
- command = (
- object_id
- + struct.pack("!I", UpdaterActionIds.UPDATE_B_APP_SW)
- + bytearray(ImagePathDefs.imageBappsw, "utf-8")
- )
- command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
- tc_queue.appendleft(command.pack_command_tuple())
diff --git a/pus_tc/devs/plpcdu.py b/pus_tc/devs/plpcdu.py
index dd6f027..28775d0 100644
--- a/pus_tc/devs/plpcdu.py
+++ b/pus_tc/devs/plpcdu.py
@@ -3,8 +3,8 @@ from typing import Optional
from tmtccmd.config import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices
-from tmtccmd.tc.service_20_parameter import (
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
+from tmtccmd.tc.pus_20_params import (
pack_scalar_double_param_app_data,
pack_fsfw_load_param_cmd,
pack_boolean_parameter_app_data,
@@ -234,6 +234,6 @@ def pack_pl_pcdu_mode_cmd(tc_queue: TcQueueT, info: str, mode: Modes, submode: i
)
mode_data = pack_mode_data(object_id=PL_PCDU_ID, mode=mode, submode=submode)
mode_cmd = PusTelecommand(
- service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data
+ service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
)
tc_queue.appendleft(mode_cmd.pack_command_tuple())
diff --git a/pus_tc/devs/rad_sensor.py b/pus_tc/devs/rad_sensor.py
index cd66930..8fe63b4 100644
--- a/pus_tc/devs/rad_sensor.py
+++ b/pus_tc/devs/rad_sensor.py
@@ -11,7 +11,7 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
-from pus_tc.service_200_mode import pack_mode_data
+from pus_tc.service_200_mode import pack_mode_data, Modes
class CommandIds:
@@ -31,19 +31,19 @@ def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode on"))
- mode_data = pack_mode_data(object_id, 1, 0)
+ mode_data = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode normal"))
- mode_data = pack_mode_data(object_id, 2, 0)
+ mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off"))
- mode_data = pack_mode_data(object_id, 0, 0)
+ mode_data = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
diff --git a/pus_tc/devs/reaction_wheels.py b/pus_tc/devs/reaction_wheels.py
index e23dab0..a74e27c 100644
--- a/pus_tc/devs/reaction_wheels.py
+++ b/pus_tc/devs/reaction_wheels.py
@@ -1,21 +1,58 @@
# -*- coding: utf-8 -*-
-"""
-@file reaction_wheels.py
+"""reaction_wheels.py
@brief Tests for the reaction wheel handler
@author J. Meier
@date 20.06.2021
"""
import struct
-from tmtccmd.config.definitions import QueueCommands
-
+from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
+from tmtccmd.tc.pus_3_fsfw_hk import (
+ generate_one_hk_command,
+ generate_one_diag_command,
+ make_sid,
+)
+from tmtccmd.config.globals import add_op_code_entry, add_service_op_code_entry
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
-from pus_tc.service_200_mode import pack_mode_data
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
+from config.definitions import CustomServiceList
+
+
+class OpCodesDevs:
+ SPEED = ["0", "speed"]
+ ON = ["1", "on"]
+ NML = ["2", "nml"]
+ OFF = ["3", "off"]
+ GET_STATUS = ["4", "status"]
+ GET_TM = ["5", "tm"]
+
+
+class InfoDevs:
+ SPEED = "Set speed"
+ ON = "Set On"
+ NML = "Set Normal"
+ OFF = "Set Off"
+ GET_STATUS = "Get Status HK"
+ GET_TM = "Get TM HK"
+
+
+class OpCodesAss:
+ ON = ["0", "on"]
+ NML = ["1", "nml"]
+ OFF = ["2", "off"]
+
+
+class InfoAss:
+ ON = "Mode On: 3/4 RWs min. on"
+ NML = "Mode Normal: 3/4 RWs min. normal"
+ OFF = "Mode Off: All RWs off"
class RwSetIds:
STATUS_SET_ID = 4
TEMPERATURE_SET_ID = 8
+ LAST_RESET = 2
+ TM_SET = 9
class RwCommandIds:
@@ -38,66 +75,138 @@ class RampTime:
MS_1000 = 1000
-def pack_single_rw_test_into(
- object_id: bytearray, tc_queue: TcQueueT, op_code: str
-) -> TcQueueT:
- tc_queue.appendleft(
- (
- QueueCommands.PRINT,
- "Testing reaction wheel handler with object id: 0x" + object_id.hex(),
- )
+def add_rw_cmds(cmd_dict: ServiceOpCodeDictT):
+ op_code_dict = dict()
+ add_op_code_entry(
+ op_code_dict=op_code_dict, info=InfoDevs.SPEED, keys=OpCodesDevs.SPEED
+ )
+ add_op_code_entry(op_code_dict=op_code_dict, info=InfoDevs.ON, keys=OpCodesDevs.ON)
+ add_op_code_entry(
+ op_code_dict=op_code_dict, info=InfoDevs.OFF, keys=OpCodesDevs.OFF
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict, info=InfoDevs.NML, keys=OpCodesDevs.NML
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict, info=InfoDevs.GET_STATUS, keys=OpCodesDevs.GET_STATUS
+ )
+ add_op_code_entry(
+ op_code_dict=op_code_dict, info=InfoDevs.GET_TM, keys=OpCodesDevs.GET_TM
+ )
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.REACTION_WHEEL_1.value,
+ op_code_entry=op_code_dict,
+ info="Reaction Wheel 1",
+ )
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.REACTION_WHEEL_2.value,
+ op_code_entry=op_code_dict,
+ info="Reaction Wheel 2",
+ )
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.REACTION_WHEEL_3.value,
+ op_code_entry=op_code_dict,
+ info="Reaction Wheel 3",
+ )
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.REACTION_WHEEL_4.value,
+ op_code_entry=op_code_dict,
+ info="Reaction Wheel 4",
+ )
+ op_code_dict = dict()
+ add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.ON, keys=OpCodesAss.ON)
+ add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.NML, keys=OpCodesAss.NML)
+ add_op_code_entry(op_code_dict=op_code_dict, info=InfoAss.OFF, keys=OpCodesAss.OFF)
+ add_service_op_code_entry(
+ srv_op_code_dict=cmd_dict,
+ name=CustomServiceList.RW_ASSEMBLY.value,
+ op_code_entry=op_code_dict,
+ info="Reaction Wheel Assembly",
)
- if op_code == "0" or op_code == "1":
+
+def pack_single_rw_test_into(
+ object_id: bytes, rw_idx: int, tc_queue: TcQueueT, op_code: str
+) -> TcQueueT:
+ if op_code in OpCodesDevs.SPEED:
speed = int(input("Specify speed [0.1 RPM]: "))
ramp_time = int(input("Specify ramp time [ms]: "))
- tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Set speed"))
+ tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.SPEED}"))
command = pack_set_speed_command(object_id, speed, ramp_time)
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "2":
- tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Switch to mode on"))
- mode_data = pack_mode_data(object_id, 1, 0)
+ if op_code in OpCodesDevs.ON:
+ tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.ON}"))
+ mode_data = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "3":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "Reaction Wheel: Switch to mode normal")
- )
- mode_data = pack_mode_data(object_id, 2, 0)
+ if op_code in OpCodesDevs.NML:
+ tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.NML}"))
+ mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "4":
- tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Switch to mode off"))
- mode_data = pack_mode_data(object_id, 0, 0)
+ if op_code in OpCodesDevs.OFF:
+ tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.OFF}"))
+ mode_data = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=43, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
- if op_code == "5":
- tc_queue.appendleft(
- (QueueCommands.PRINT, "Reaction Wheel: Send get-telemetry-command")
+ if op_code in OpCodesDevs.GET_TM:
+ tc_queue.appendleft((QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.GET_TM}"))
+ command = generate_one_hk_command(
+ sid=make_sid(object_id=object_id, set_id=RwSetIds.TM_SET), ssc=0
+ )
+ tc_queue.appendleft(command.pack_command_tuple())
+ if op_code in OpCodesDevs.GET_STATUS:
+ tc_queue.appendleft(
+ (QueueCommands.PRINT, f"RW {rw_idx}: {InfoDevs.GET_STATUS}")
+ )
+ command = generate_one_diag_command(
+ sid=make_sid(object_id=object_id, set_id=RwSetIds.STATUS_SET_ID), ssc=0
)
- command = object_id + RwCommandIds.GET_TM
- command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
-def pack_set_speed_command(
- object_id: bytearray, speed: int, ramp_time: int
-) -> bytearray:
+def pack_rw_ass_cmds(tc_queue: TcQueueT, object_id: bytes, op_code: str):
+ if op_code in OpCodesAss.OFF:
+ data = pack_mode_data(object_id=object_id, mode=Modes.OFF, submode=0)
+ cmd = PusTelecommand(
+ service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
+ )
+ tc_queue.appendleft(cmd.pack_command_tuple())
+ if op_code in OpCodesAss.ON:
+ data = pack_mode_data(object_id=object_id, mode=Modes.ON, submode=0)
+ cmd = PusTelecommand(
+ service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
+ )
+ tc_queue.appendleft(cmd.pack_command_tuple())
+ if op_code in OpCodesAss.NML:
+ data = pack_mode_data(object_id=object_id, mode=Modes.NORMAL, submode=0)
+ cmd = PusTelecommand(
+ service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=data
+ )
+ tc_queue.appendleft(cmd.pack_command_tuple())
+
+
+def pack_set_speed_command(object_id: bytes, speed: int, ramp_time: int) -> bytearray:
"""With this function a command is packed to set the speed of a reaction wheel
- @param object_id The object id of the reaction wheel handler.
- @param speed Valid speeds are [-65000, -1000] and [1000, 65000]. Values are specified in 0.1 * RPM
- @param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are
- 10 - 10000 ms
+ :param object_id: The object id of the reaction wheel handler.
+ :param speed: Valid speeds are [-65000, -1000] and [1000, 65000]. Values are
+ specified in 0.1 * RPM
+ :param ramp_time: The time after which the reaction wheel will reached the commanded speed.
+ Valid times are 10 - 10000 ms
"""
command_id = RwCommandIds.SET_SPEED
command = bytearray()
- command = object_id + command_id
+ command += object_id + command_id
command = command + struct.pack("!i", speed)
command = command + ramp_time.to_bytes(length=2, byteorder="big")
return command
diff --git a/pus_tc/devs/star_tracker.py b/pus_tc/devs/star_tracker.py
index f8df76d..73bbc37 100644
--- a/pus_tc/devs/star_tracker.py
+++ b/pus_tc/devs/star_tracker.py
@@ -11,7 +11,7 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from tmtccmd.logging import get_console_logger
from utility.input_helper import InputHelper
diff --git a/pus_tc/devs/syrlinks_hk_handler.py b/pus_tc/devs/syrlinks_hk_handler.py
index b5f3099..48adbcd 100644
--- a/pus_tc/devs/syrlinks_hk_handler.py
+++ b/pus_tc/devs/syrlinks_hk_handler.py
@@ -8,9 +8,9 @@
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
+from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from spacepackets.ecss.tc import PusTelecommand
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
import struct
@@ -64,17 +64,17 @@ def pack_syrlinks_command(
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode standby"))
- command = object_id + struct.pack('!I', CommandIds.SET_TX_MODE_STANDBY)
+ command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_STANDBY)
command = PusTelecommand(service=8, subservice=128, ssc=10, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode modulation"))
- command = object_id + struct.pack('!I', CommandIds.SET_TX_MODE_MODULATION)
+ command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_MODULATION)
command = PusTelecommand(service=8, subservice=128, ssc=11, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "syrlinks: Set TX mode CW"))
- command = object_id + struct.pack('!I', CommandIds.SET_TX_MODE_CW)
+ command = object_id + struct.pack("!I", CommandIds.SET_TX_MODE_CW)
command = PusTelecommand(service=8, subservice=128, ssc=12, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
@@ -89,26 +89,26 @@ def pack_syrlinks_command(
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX status"))
- command = object_id + struct.pack('!I', CommandIds.READ_TX_STATUS)
+ command = object_id + struct.pack("!I", CommandIds.READ_TX_STATUS)
command = PusTelecommand(service=8, subservice=128, ssc=13, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX waveform"))
- command = object_id + struct.pack('!I', CommandIds.READ_TX_WAVEFORM)
+ command = object_id + struct.pack("!I", CommandIds.READ_TX_WAVEFORM)
command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "10":
tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte")
)
- command = object_id + struct.pack('!I', CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE)
+ command = object_id + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE)
command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11":
tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte")
)
- command = object_id + struct.pack('!I', CommandIds.READ_TX_AGC_VALUE_LOW_BYTE)
+ command = object_id + struct.pack("!I", CommandIds.READ_TX_AGC_VALUE_LOW_BYTE)
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12":
diff --git a/pus_tc/service_200_mode.py b/pus_tc/service_200_mode.py
index 08faad4..1f046e7 100644
--- a/pus_tc/service_200_mode.py
+++ b/pus_tc/service_200_mode.py
@@ -8,7 +8,7 @@
from tmtccmd.config.definitions import QueueCommands
from spacepackets.ecss.tc import PusTelecommand
from tmtccmd.tc.packer import TcQueueT
-from tmtccmd.tc.service_200_mode import pack_mode_data
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes
from config.object_ids import TEST_DEVICE_ID
TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
@@ -20,23 +20,22 @@ def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT:
obj_id = TEST_DEVICE_OBJ_ID
# Set On Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode On"))
- mode_data = pack_mode_data(obj_id, 1, 0)
+ mode_data = pack_mode_data(obj_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Normal mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Normal"))
- mode_data = pack_mode_data(obj_id, 2, 0)
+ mode_data = pack_mode_data(obj_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Raw Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Raw"))
- mode_data = pack_mode_data(obj_id, 3, 0)
+ mode_data = pack_mode_data(obj_id, Modes.RAW, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
# Set Off Mode
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode Off"))
- mode_data = pack_mode_data(obj_id, 0, 0)
+ mode_data = pack_mode_data(obj_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
- tc_queue.appendleft((QueueCommands.EXPORT_LOG, "log/tmtc_log_service200.txt"))
return tc_queue
diff --git a/pus_tc/system/acs.py b/pus_tc/system/acs.py
index 109a8e7..ea97734 100644
--- a/pus_tc/system/acs.py
+++ b/pus_tc/system/acs.py
@@ -1,6 +1,6 @@
import enum
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_200_mode import Modes
+from tmtccmd.tc.pus_200_fsfw_modes import Modes
from config.object_ids import ACS_BOARD_ASS_ID, SUS_BOARD_ASS_ID
from .common import command_assembly
diff --git a/pus_tc/system/common.py b/pus_tc/system/common.py
index a37412a..55ae7b3 100644
--- a/pus_tc/system/common.py
+++ b/pus_tc/system/common.py
@@ -1,6 +1,6 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from spacepackets.ecss.tc import PusTelecommand
-from tmtccmd.tc.service_200_mode import pack_mode_data, Modes, Subservices
+from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
def command_assembly(
@@ -13,6 +13,6 @@ def command_assembly(
submode=submode,
)
cmd = PusTelecommand(
- service=200, subservice=Subservices.COMMAND_MODE_COMMAND, app_data=mode_data
+ service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
)
tc_queue.appendleft(cmd.pack_command_tuple())
diff --git a/pus_tc/system/core.py b/pus_tc/system/core.py
index 132ab8a..a4e5c6e 100644
--- a/pus_tc/system/core.py
+++ b/pus_tc/system/core.py
@@ -2,9 +2,9 @@ import enum
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_8_functional_cmd import generate_action_command
+from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.logging import get_console_logger
-from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
+from tmtccmd.tc.pus_3_fsfw_hk import make_sid, generate_one_hk_command
from config.object_ids import CORE_CONTROLLER_ID
LOGGER = get_console_logger()
diff --git a/pus_tc/system/tcs.py b/pus_tc/system/tcs.py
index fda1a76..5b98ddc 100644
--- a/pus_tc/system/tcs.py
+++ b/pus_tc/system/tcs.py
@@ -1,5 +1,5 @@
from tmtccmd.tc.definitions import TcQueueT, QueueCommands
-from tmtccmd.tc.service_200_mode import Modes
+from tmtccmd.tc.pus_200_fsfw_modes import Modes
from .common import command_assembly
from config.object_ids import TCS_BOARD_ASS_ID
diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py
index cb370cb..bc2c486 100644
--- a/pus_tc/tc_packer_hook.py
+++ b/pus_tc/tc_packer_hook.py
@@ -7,12 +7,12 @@ from typing import Union
from spacepackets.ecss import PusTelecommand
from tmtccmd.com_if.com_interface_base import CommunicationInterface
-from tmtccmd.config.definitions import CoreServiceList
+from tmtccmd.config.definitions import CoreServiceList, QueueCommands
from tmtccmd.logging import get_console_logger
from tmtccmd.logging.pus import log_raw_pus_tc
from tmtccmd.tc.definitions import TcQueueT
-from tmtccmd.tc.service_5_event import pack_generic_service5_test_into
-from tmtccmd.pus.service_17_test import pack_service_17_ping_command
+from tmtccmd.tc.pus_5_event import pack_generic_service5_test_into
+from tmtccmd.pus.pus_17_test import pack_service_17_ping_command
from tmtccmd.logging import get_current_time_string
from pus_tc.service_200_mode import pack_service200_test_into
@@ -26,10 +26,9 @@ from pus_tc.devs.imtq import pack_imtq_test_into
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
from pus_tc.devs.ploc_mpsoc import pack_ploc_mpsoc_commands
from pus_tc.devs.ploc_supervisor import pack_ploc_supv_commands
-from pus_tc.devs.heater import pack_heater_test_into
-from pus_tc.devs.reaction_wheels import pack_single_rw_test_into
+from pus_tc.devs.heater import pack_heater_cmds
+from pus_tc.devs.reaction_wheels import pack_single_rw_test_into, pack_rw_ass_cmds
from pus_tc.devs.rad_sensor import pack_rad_sensor_test_into
-from pus_tc.devs.ploc_upater import pack_ploc_updater_test_into
from pus_tc.devs.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
from pus_tc.devs.ccsds_handler import pack_ccsds_handler_test
from pus_tc.system.core import pack_core_commands
@@ -59,7 +58,6 @@ from config.object_ids import (
RW4_ID,
RAD_SENSOR_ID,
PLOC_SUPV_ID,
- PLOC_UPDATER_ID,
STAR_TRACKER_ID,
PLOC_MEMORY_DUMPER_ID,
GPS_HANDLER_0_ID,
@@ -69,6 +67,7 @@ from config.object_ids import (
STR_IMG_HELPER_ID,
SYRLINKS_HANDLER_ID,
SOLAR_ARRAY_DEPLOYMENT_ID,
+ RW_ASSEMBLY,
)
@@ -76,18 +75,23 @@ LOGGER = get_console_logger()
def pre_tc_send_cb(
- packet: bytes,
+ queue_entry: Union[bytes, QueueCommands],
com_if: CommunicationInterface,
- pus_info: Union[PusTelecommand, any],
+ queue_info: Union[PusTelecommand, any],
file_logger: logging.Logger,
):
- log_raw_pus_tc(
- packet=packet, srv_subservice=(pus_info.service, pus_info.subservice)
- )
- tc_info_string = f"Sent {pus_info}"
- LOGGER.info(tc_info_string)
- file_logger.info(f"{get_current_time_string(True)}: {tc_info_string}")
- com_if.send(data=packet)
+ if isinstance(queue_entry, bytes) or isinstance(queue_entry, bytearray):
+ log_raw_pus_tc(
+ packet=queue_entry,
+ srv_subservice=(queue_info.service, queue_info.subservice),
+ )
+ tc_info_string = f"Sent {queue_info}"
+ LOGGER.info(tc_info_string)
+ file_logger.info(f"{get_current_time_string(True)}: {tc_info_string}")
+ com_if.send(data=queue_entry)
+ elif isinstance(queue_entry, QueueCommands):
+ if queue_entry == QueueCommands.PRINT:
+ file_logger.info(queue_info)
def pack_service_queue_user(
@@ -135,7 +139,9 @@ def pack_service_queue_user(
)
if service == CustomServiceList.HEATER.value:
object_id = HEATER_ID
- return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
+ return pack_heater_cmds(
+ object_id=object_id, tc_queue=service_queue, op_code=op_code
+ )
if service == CustomServiceList.IMTQ.value:
object_id = IMTQ_HANDLER_ID
return pack_imtq_test_into(
@@ -147,24 +153,20 @@ def pack_service_queue_user(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_1.value:
- object_id = RW1_ID
return pack_single_rw_test_into(
- object_id=object_id, tc_queue=service_queue, op_code=op_code
+ object_id=RW1_ID, rw_idx=1, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_2.value:
- object_id = RW2_ID
return pack_single_rw_test_into(
- object_id=object_id, tc_queue=service_queue, op_code=op_code
+ object_id=RW2_ID, rw_idx=2, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_3.value:
- object_id = RW3_ID
return pack_single_rw_test_into(
- object_id=object_id, tc_queue=service_queue, op_code=op_code
+ object_id=RW3_ID, rw_idx=3, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_4.value:
- object_id = RW4_ID
return pack_single_rw_test_into(
- object_id=object_id, tc_queue=service_queue, op_code=op_code
+ object_id=RW4_ID, rw_idx=4, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.RAD_SENSOR.value:
object_id = RAD_SENSOR_ID
@@ -176,11 +178,6 @@ def pack_service_queue_user(
return pack_ploc_supv_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
- if service == CustomServiceList.PLOC_UPDATER.value:
- object_id = PLOC_UPDATER_ID
- return pack_ploc_updater_test_into(
- object_id=object_id, tc_queue=service_queue, op_code=op_code
- )
if service == CustomServiceList.STAR_TRACKER.value:
object_id = STAR_TRACKER_ID
return pack_star_tracker_commands(
@@ -236,6 +233,10 @@ def pack_service_queue_user(
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)
+ if service == CustomServiceList.RW_ASSEMBLY.value:
+ return pack_rw_ass_cmds(
+ tc_queue=service_queue, object_id=RW_ASSEMBLY, op_code=op_code
+ )
LOGGER.warning("Invalid Service !")
diff --git a/pus_tm/action_reply_handler.py b/pus_tm/action_reply_handler.py
index cee50e1..cd35815 100644
--- a/pus_tm/action_reply_handler.py
+++ b/pus_tm/action_reply_handler.py
@@ -20,7 +20,7 @@ def handle_action_reply(
"""
tm_packet = Service8FsfwTm.unpack(raw_telemetry=raw_tm)
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
- object_id = obj_id_dict.get(tm_packet.source_object_id)
+ object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
custom_data = tm_packet.custom_data
action_id = tm_packet.action_id
generic_print_str = printer.generic_action_packet_tm_print(
@@ -28,13 +28,13 @@ def handle_action_reply(
)
print(generic_print_str)
printer.file_logger.info(generic_print_str)
- if object_id == IMTQ_HANDLER_ID:
+ if object_id.as_bytes == IMTQ_HANDLER_ID:
return handle_imtq_replies(action_id, printer, custom_data)
- elif object_id == PLOC_MPSOC_ID:
+ elif object_id.as_bytes == PLOC_MPSOC_ID:
return handle_ploc_replies(action_id, printer, custom_data)
- elif object_id == PLOC_SUPV_ID:
+ elif object_id.as_bytes == PLOC_SUPV_ID:
return handle_supervisor_replies(action_id, printer, custom_data)
- elif object_id == STAR_TRACKER_ID:
+ elif object_id.as_bytes == STAR_TRACKER_ID:
return handle_startracker_replies(action_id, printer, custom_data)
@@ -58,7 +58,7 @@ def handle_imtq_replies(
def handle_ploc_replies(
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
):
- if action_id == PlocReplyIds.tm_mem_read_report:
+ if action_id == PlocReplyIds.TM_MEM_READ_RPT:
header_list = [
"PLOC Memory Address",
"PLOC Mem Len",
@@ -73,6 +73,16 @@ def handle_ploc_replies(
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
+ elif action_id == PlocReplyIds.TM_CAM_CMD_RPT:
+ header_list = ["Camera reply string", "ACK"]
+ content_list = [
+ custom_data[: len(custom_data) - 1].decode("utf-8"),
+ hex(custom_data[-1]),
+ ]
+ print(header_list)
+ print(content_list)
+ printer.file_logger.info(header_list)
+ printer.file_logger.info(content_list)
def handle_supervisor_replies(
@@ -86,6 +96,13 @@ def handle_supervisor_replies(
print(content_list)
printer.file_logger.info(header_list)
printer.file_logger.info(content_list)
+ elif action_id == SupvActionIds.READ_GPIO:
+ header_list = ["GPIO state"]
+ content_list = [struct.unpack("!H", custom_data[:2])[0]]
+ print(header_list)
+ print(content_list)
+ printer.file_logger.info(header_list)
+ printer.file_logger.info(content_list)
def handle_startracker_replies(
diff --git a/pus_tm/defs.py b/pus_tm/defs.py
new file mode 100644
index 0000000..218e2d0
--- /dev/null
+++ b/pus_tm/defs.py
@@ -0,0 +1,15 @@
+from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
+
+
+class PrintWrapper:
+ def __init__(self, printer: FsfwTmTcPrinter):
+ self.printer = printer
+
+ def dlog(self, string: str):
+ print(string)
+ self.printer.file_logger.info(string)
+
+
+def log_to_both(printer: FsfwTmTcPrinter, string: str):
+ print(string)
+ printer.file_logger.info(string)
diff --git a/pus_tm/devs/__init__.py b/pus_tm/devs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pus_tm/devs/reaction_wheels.py b/pus_tm/devs/reaction_wheels.py
new file mode 100644
index 0000000..e1e1c28
--- /dev/null
+++ b/pus_tm/devs/reaction_wheels.py
@@ -0,0 +1,124 @@
+import struct
+
+from pus_tm.defs import PrintWrapper, FsfwTmTcPrinter
+from tmtccmd.utility.obj_id import ObjectId
+
+
+def handle_rw_hk_data(
+ printer: FsfwTmTcPrinter, object_id: ObjectId, set_id: int, hk_data: bytes
+):
+ from pus_tc.devs.reaction_wheels import RwSetIds
+
+ pw = PrintWrapper(printer)
+ current_idx = 0
+ if set_id == RwSetIds.STATUS_SET_ID:
+ pw.dlog(
+ f"Received Status HK (ID {set_id}) from Reaction Wheel {object_id.name}"
+ )
+ fmt_str = "!IiiBB"
+ inc_len = struct.calcsize(fmt_str)
+ (temp, speed, ref_speed, state, clc_mode) = struct.unpack(
+ fmt_str, hk_data[current_idx : current_idx + inc_len]
+ )
+ current_idx += inc_len
+ speed_rpm = speed / 10.0
+ ref_speed_rpm = ref_speed / 10.0
+ pw.dlog(
+ f"Temperature {temp} C | Speed {speed_rpm} rpm | Reference Speed {ref_speed_rpm} rpm"
+ )
+ pw.dlog(
+ f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
+ f"4: Running, speed changing"
+ )
+ pw.dlog(
+ f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
+ f"1: High Current Mode (0.6 A)"
+ )
+ printer.print_validity_buffer(hk_data[current_idx:], 5)
+ if set_id == RwSetIds.LAST_RESET:
+ pw.dlog(
+ f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
+ )
+ fmt_str = "!BB"
+ inc_len = struct.calcsize(fmt_str)
+ (last_not_cleared_reset_status, current_reset_status) = struct.unpack(
+ fmt_str, hk_data[current_idx : current_idx + inc_len]
+ )
+ current_idx += inc_len
+ pw.dlog(
+ f"Last Non-Cleared (Cached) Reset Status {last_not_cleared_reset_status} | "
+ f"Current Reset Status {current_reset_status}"
+ )
+ if set_id == RwSetIds.TM_SET:
+ pw.dlog(f"Received TM HK (ID {set_id}) from Reaction Wheel {object_id.name}")
+ fmt_str = "!BiffBBiiIIIIIIIIIIIIIIII"
+ inc_len = struct.calcsize(fmt_str)
+ (
+ last_reset_status,
+ mcu_temp,
+ pressure_sens_temp,
+ pressure,
+ state,
+ clc_mode,
+ current_speed,
+ ref_speed,
+ num_invalid_crc_packets,
+ num_invalid_len_packets,
+ num_invalid_cmd_packets,
+ num_of_cmd_executed_requests,
+ num_of_cmd_replies,
+ uart_num_of_bytes_written,
+ uart_num_of_bytes_read,
+ uart_num_parity_errors,
+ uart_num_noise_errors,
+ uart_num_frame_errors,
+ uart_num_reg_overrun_errors,
+ uart_total_num_errors,
+ spi_num_bytes_written,
+ spi_num_bytes_read,
+ spi_num_reg_overrun_errors,
+ spi_total_num_errors,
+ ) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
+
+ pw.dlog(
+ f"MCU Temperature {mcu_temp} | Pressure Sensore Temperature {pressure_sens_temp} C"
+ )
+ pw.dlog(f"Last Reset Status {last_reset_status}")
+ pw.dlog(
+ f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
+ f"1: High Current Mode (0.6 A)"
+ )
+ pw.dlog(f"Speed {current_speed} rpm | Reference Speed {ref_speed} rpm")
+ pw.dlog(
+ f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
+ f"4: Running, speed changing"
+ )
+ pw.dlog(f"Number Of Invalid Packets:")
+ pw.dlog("CRC | Length | CMD")
+ pw.dlog(
+ f"{num_invalid_crc_packets} | {num_invalid_len_packets} | {num_invalid_cmd_packets}"
+ )
+ pw.dlog(
+ f"Num Of CMD Executed Requests {num_of_cmd_executed_requests} | "
+ f"Num of CMD Replies {num_of_cmd_replies}"
+ )
+ pw.dlog("UART COM information:")
+ pw.dlog(
+ f"NumBytesWritten | NumBytesRead | ParityErrs | NoiseErrs | FrameErrs | "
+ f"RegOverrunErrs | TotalErrs"
+ )
+ pw.dlog(
+ f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} | {uart_num_parity_errors} | "
+ f"{uart_num_noise_errors} | {uart_num_frame_errors} | {uart_num_reg_overrun_errors} | "
+ f"{uart_total_num_errors}"
+ )
+ pw.dlog("SPI COM Info:")
+ pw.dlog(f"NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs")
+ pw.dlog(
+ f"{spi_num_bytes_written} | {spi_num_bytes_read} | {spi_num_reg_overrun_errors} | "
+ f"{spi_total_num_errors}"
+ )
+ if current_idx > 0:
+ printer.print_validity_buffer(
+ validity_buffer=hk_data[current_idx:], num_vars=27
+ )
diff --git a/pus_tm/factory_hook.py b/pus_tm/factory_hook.py
index b5a318a..6fdca91 100644
--- a/pus_tm/factory_hook.py
+++ b/pus_tm/factory_hook.py
@@ -9,9 +9,9 @@ from tmtccmd.logging.pus import (
create_tmtc_logger,
)
-from tmtccmd.pus.service_17_test import Service17TMExtended
-from tmtccmd.tm.service_20_fsfw_parameters import Service20FsfwTm
-from tmtccmd.tm.service_200_fsfw_mode import Service200FsfwTm
+from tmtccmd.tm.pus_17_test import Service17TMExtended
+from tmtccmd.tm.pus_20_fsfw_parameters import Service20FsfwTm
+from tmtccmd.tm.pus_200_fsfw_modes import Service200FsfwTm
from tmtccmd.utility.tmtc_printer import PrintFormats, FsfwTmTcPrinter
from config.definitions import PUS_APID
@@ -41,7 +41,9 @@ def pus_factory_hook(raw_tm_packet: bytes):
subservice_type = raw_tm_packet[8]
file_logger = FSFW_PRINTER.file_logger
obj_id_dict = get_object_ids()
+ dedicated_handler = True
try:
+ tm_packet = None
if service_type == 1:
handle_service_1_packet(printer=FSFW_PRINTER, raw_tm=raw_tm_packet)
elif service_type == 3:
@@ -58,19 +60,22 @@ def pus_factory_hook(raw_tm_packet: bytes):
)
elif service_type == 17:
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
- FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
+ dedicated_handler = False
elif service_type == 20:
tm_packet = Service20FsfwTm.unpack(raw_telemetry=raw_tm_packet)
- FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
+ dedicated_handler = False
elif service_type == 200:
tm_packet = Service200FsfwTm.unpack(raw_telemetry=raw_tm_packet)
- FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
+ dedicated_handler = False
else:
LOGGER.info(
f"The service {service_type} is not implemented in Telemetry Factory"
)
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
tm_packet.print_source_data(PrintFormats.HEX)
+ dedicated_handler = True
+ if not dedicated_handler and tm_packet is not None:
+ FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
log_raw_pus_tm(
packet=raw_tm_packet, srv_subservice=(service_type, subservice_type)
)
diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py
index 0902f36..399ec5c 100644
--- a/pus_tm/hk_handling.py
+++ b/pus_tm/hk_handling.py
@@ -3,9 +3,8 @@ import struct
import os
import datetime
-from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from tmtccmd.config.definitions import HkReplyUnpacked
-from tmtccmd.tm.service_3_fsfw_housekeeping import (
+from tmtccmd.tm.pus_3_fsfw_hk import (
Service3Base,
HkContentType,
Service3FsfwTm,
@@ -15,9 +14,11 @@ from pus_tc.devs.bpx_batt import BpxSetIds
from pus_tc.devs.syrlinks_hk_handler import SetIds
from pus_tc.devs.p60dock import SetIds
from pus_tc.devs.imtq import ImtqSetIds
-from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
+from tmtccmd.utility.obj_id import ObjectId, ObjectIdDictT
import config.object_ids as obj_ids
+from pus_tm.devs.reaction_wheels import handle_rw_hk_data
+from pus_tm.defs import FsfwTmTcPrinter, log_to_both
LOGGER = get_console_logger()
@@ -55,40 +56,46 @@ def handle_regular_hk_print(
hk_packet: Service3Base,
hk_data: bytes,
):
- object_id = object_id.as_bytes
+ objb = object_id.as_bytes
set_id = hk_packet.set_id
"""This function is called when a Service 3 Housekeeping packet is received."""
- if object_id == obj_ids.SYRLINKS_HANDLER_ID:
+ if object_id in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
+ handle_rw_hk_data(printer, object_id, set_id, hk_data)
+ if objb == obj_ids.SYRLINKS_HANDLER_ID:
if set_id == SetIds.RX_REGISTERS_DATASET:
return handle_syrlinks_rx_registers_dataset(printer, hk_data)
elif set_id == SetIds.TX_REGISTERS_DATASET:
return handle_syrlinks_tx_registers_dataset(printer, hk_data)
else:
LOGGER.info("Service 3 TM: Syrlinks handler reply with unknown set id")
- elif object_id == obj_ids.IMTQ_HANDLER_ID:
+ if objb == obj_ids.IMTQ_HANDLER_ID:
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (
set_id <= ImtqSetIds.NEGATIVE_Z_TEST
):
return handle_self_test_data(printer, hk_data)
else:
LOGGER.info("Service 3 TM: Syrlinks handler reply with unknown set id")
- elif object_id == obj_ids.GPS_HANDLER_0_ID or object_id == obj_ids.GPS_HANDLER_1_ID:
+ if objb == obj_ids.GPS_HANDLER_0_ID or object_id == obj_ids.GPS_HANDLER_1_ID:
handle_gps_data(printer=printer, hk_data=hk_data)
- elif object_id == obj_ids.BPX_HANDLER_ID:
+ if objb == obj_ids.BPX_HANDLER_ID:
handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
- elif object_id == obj_ids.CORE_CONTROLLER_ID:
+ if objb == obj_ids.CORE_CONTROLLER_ID:
return handle_core_hk_data(printer=printer, hk_data=hk_data)
- elif object_id == obj_ids.PDU_1_HANDLER_ID:
+ if objb == obj_ids.PDU_1_HANDLER_ID:
return handle_pdu_data(
printer=printer, pdu_idx=1, set_id=set_id, hk_data=hk_data
)
- elif object_id == obj_ids.PDU_2_HANDLER_ID:
+ if objb == obj_ids.PDU_2_HANDLER_ID:
return handle_pdu_data(
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
)
- elif object_id == obj_ids.P60_DOCK_HANDLER:
+ if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
+ return handle_rw_hk_data(
+ printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data
+ )
+ if objb == obj_ids.P60_DOCK_HANDLER:
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
- elif object_id == obj_ids.PL_PCDU_ID:
+ if objb == obj_ids.PL_PCDU_ID:
log_to_both(printer, "Received PL PCDU HK data")
else:
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
@@ -700,8 +707,3 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
printer.print_validity_buffer(
validity_buffer=hk_data[current_idx:], num_vars=27
)
-
-
-def log_to_both(printer: FsfwTmTcPrinter, string: str):
- print(string)
- printer.file_logger.info(string)
diff --git a/pus_tm/verification_handler.py b/pus_tm/verification_handler.py
index 2047f1d..08c0099 100644
--- a/pus_tm/verification_handler.py
+++ b/pus_tm/verification_handler.py
@@ -1,8 +1,6 @@
-import logging
-from datetime import datetime
from typing import cast
-from tmtccmd.pus.service_1_verification import Service1TMExtended
+from tmtccmd.tm.pus_1_verification import Service1TMExtended
from tmtccmd.logging import get_console_logger
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from config.retvals import get_retval_dict
@@ -23,7 +21,7 @@ def handle_service_1_packet(printer: FsfwTmTcPrinter, raw_tm: bytes):
)
else:
retval_string = (
- f"Error Code information for code {srv1_packet.error_code}| "
+ f"Error Code information for code {srv1_packet.error_code} | "
f"Name: {retval_info.name} | Info: {retval_info.info}"
)
LOGGER.info(retval_string)
diff --git a/requirements.txt b/requirements.txt
index 7b75c9d..f444d16 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-tmtccmd>=2.0.1
+tmtccmd >= 2.2.1
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..c4fd97e
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,51 @@
+[metadata]
+name = tmtc
+description = TMTC Commander EIVE
+version = attr: config.__version__
+long_description = file: README.md
+long_description_content_type = text/markdown
+license = Apache-2.0
+author = Robin Mueller
+author_email = muellerr@irs.uni-stuttgart.de
+platform = any
+
+url = https://egit.irs.uni-stuttgart.de/eive/eive-tmtc
+classifiers =
+ Development Status :: 5 - Production/Stable
+ Intended Audience :: Developers
+ License :: OSI Approved :: Apache Software License
+ Natural Language :: English
+ Operating System :: POSIX
+ Operating System :: Microsoft :: Windows
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.8
+ Programming Language :: Python :: 3.9
+ Topic :: Communications
+ Topic :: Software Development :: Libraries
+ Topic :: Software Development :: Libraries :: Python Modules
+ Topic :: Scientific/Engineering
+
+[options]
+install_requires =
+ tmtccmd >= 2.2.1
+packages = find:
+python_requires = >=3.8
+
+[options.extras_require]
+mib =
+
+[flake8]
+max-line-length = 100
+ignore = D203, W503
+exclude =
+ .git,
+ __pycache__,
+ docs/conf.py,
+ old,
+ build,
+ dist,
+ venv
+max-complexity = 10
+extend-ignore =
+ # See https://github.com/PyCQA/pycodestyle/issues/373
+ E203,
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..77392bf
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+"""
+We do the package handling in the static setup.cfg but include an empty setup.py
+to allow editable installs https://packaging.python.org/tutorials/packaging-projects/
+and provide extensibility
+"""
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+setup()
diff --git a/spacepackets b/spacepackets
index 522b021..d0c3f4a 160000
--- a/spacepackets
+++ b/spacepackets
@@ -1 +1 @@
-Subproject commit 522b021ba5690f97a4b74ae8b110762a32eb9b19
+Subproject commit d0c3f4a802c3cddc5be2919af763b08fe6a6b05c
diff --git a/tmtcc.py b/tmtcc.py
new file mode 100644
index 0000000..e704716
--- /dev/null
+++ b/tmtcc.py
@@ -0,0 +1,65 @@
+import argparse
+import sys
+import traceback
+from typing import Optional
+
+try:
+ import spacepackets
+except ImportError as error:
+ print(error)
+ print("Python spacepackets module could not be imported")
+ print(
+ 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
+ )
+ sys.exit(1)
+
+try:
+ import tmtccmd.runner as tmtccmd
+ from tmtccmd.logging.pus import create_tmtc_logger
+ from tmtccmd.ccsds.handler import ApidHandler, CcsdsTmHandler
+ from tmtccmd.config import SetupArgs, default_json_path
+ from tmtccmd.config.args import (
+ create_default_args_parser,
+ add_default_tmtccmd_args,
+ parse_default_input_arguments,
+ )
+except ImportError as error:
+ run_tmtc_commander = None
+ initialize_tmtc_commander = None
+ tb = traceback.format_exc()
+ print(tb)
+ print("Python tmtccmd submodule could not be imported")
+ sys.exit(1)
+
+from config import __version__
+from config.definitions import PUS_APID
+from config.hook_implementations import EiveHookObject
+from pus_tm.factory_hook import ccsds_tm_handler
+from pus_tc.tc_packer_hook import pre_tc_send_cb
+
+
+def tmtcc_pre_args() -> EiveHookObject:
+ print(f"-- eive tmtc v{__version__} --")
+ print(f"-- spacepackets v{spacepackets.__version__} --")
+ tmtccmd.init_printout(False)
+ return EiveHookObject(json_cfg_path=default_json_path())
+
+
+def tmtcc_post_args(
+ hook_obj: EiveHookObject, use_gui: bool, args: Optional[argparse.Namespace]
+):
+ setup_args = SetupArgs(
+ hook_obj=hook_obj, use_gui=use_gui, apid=PUS_APID, cli_args=args
+ )
+ tmtc_file_logger = create_tmtc_logger()
+ apid_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
+ ccsds_handler = CcsdsTmHandler()
+ ccsds_handler.add_tm_handler(apid=PUS_APID, handler=apid_handler)
+ tmtccmd.setup(setup_args=setup_args)
+ tmtccmd.add_ccsds_handler(ccsds_handler)
+ tmtc_backend = tmtccmd.create_default_tmtc_backend(
+ setup_args=setup_args,
+ tm_handler=ccsds_handler,
+ )
+ tmtc_backend.usr_send_wrapper = (pre_tc_send_cb, tmtc_file_logger)
+ tmtccmd.run(tmtc_backend=tmtc_backend)
diff --git a/tmtccli.py b/tmtccli.py
index c80e4ac..29f3615 100755
--- a/tmtccli.py
+++ b/tmtccli.py
@@ -1,93 +1,20 @@
#!/usr/bin/env python3
-"""
-@brief TMTC Commander entry point for command line mode.
-@details
-This client was developed by KSat for the SOURCE project to test the on-board software but
-has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand)
-handling and testing via different communication interfaces. Currently, only the PUS standard is
-implemented as a packet standard.
-
-Run this file with the -h flag to display options.
-
-@license
-Copyright 2020 KSat e.V. Stuttgart
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- https://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-@author R. Mueller
-"""
-import sys
-import traceback
-
-try:
- import tmtccmd.runner as tmtccmd
- from tmtccmd.config import default_json_path, SetupArgs
- from tmtccmd.config.args import (
- create_default_args_parser,
- add_default_tmtccmd_args,
- parse_default_input_arguments,
- )
- from tmtccmd.ccsds.handler import CcsdsTmHandler, ApidHandler
- from tmtccmd.logging import init_console_logger
- from tmtccmd.logging.pus import create_tmtc_logger
-except ImportError as error:
- run_tmtc_commander = None
- initialize_tmtc_commander = None
- tb = traceback.format_exc()
- print(tb)
- print("Python tmtccmd submodule could not be imported")
- sys.exit(1)
-
-try:
- import spacepackets
-except ImportError as error:
- print(error)
- print("Python spacepackets module could not be imported")
- print(
- 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
- )
- sys.exit(1)
-
-from config.hook_implementations import EiveHookObject
-from config.version import __version__
-from config.definitions import PUS_APID
-from pus_tc.tc_packer_hook import pre_tc_send_cb
-from pus_tm.factory_hook import ccsds_tm_handler
+"""TMTC commander for EIVE"""
+from tmtcc import (
+ tmtcc_post_args,
+ tmtcc_pre_args,
+ create_default_args_parser,
+ add_default_tmtccmd_args,
+ parse_default_input_arguments,
+)
def main():
- print(f"-- eive tmtc version {__version__} --")
- print(f"-- spacepackets version {spacepackets.__version__} --")
- tmtccmd.init_printout(False)
- tmtc_file_logger = create_tmtc_logger()
- hook_obj = EiveHookObject(json_cfg_path=default_json_path())
+ hook_obj = tmtcc_pre_args()
arg_parser = create_default_args_parser()
add_default_tmtccmd_args(arg_parser)
args = parse_default_input_arguments(arg_parser, hook_obj)
- setup_args = SetupArgs(
- hook_obj=hook_obj, use_gui=False, apid=PUS_APID, cli_args=args
- )
- apid_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
- ccsds_handler = CcsdsTmHandler()
- ccsds_handler.add_tm_handler(apid=PUS_APID, handler=apid_handler)
- tmtccmd.setup(setup_args=setup_args)
- tmtccmd.add_ccsds_handler(ccsds_handler)
- tmtc_backend = tmtccmd.create_default_tmtc_backend(
- setup_args=setup_args,
- tm_handler=ccsds_handler,
- )
- tmtc_backend.usr_send_wrapper = (pre_tc_send_cb, tmtc_file_logger)
- tmtccmd.run(tmtc_backend=tmtc_backend)
+ tmtcc_post_args(hook_obj=hook_obj, use_gui=False, args=args)
if __name__ == "__main__":
diff --git a/tmtccmd b/tmtccmd
index 5d6db96..e81e6db 160000
--- a/tmtccmd
+++ b/tmtccmd
@@ -1 +1 @@
-Subproject commit 5d6db96ffccab2fb64670875bab81fdd1ddd3816
+Subproject commit e81e6dbd594c1cdf51cd355a724cbd267d9dee38
diff --git a/tmtcgui.py b/tmtcgui.py
index 16759bc..6c8a1fd 100755
--- a/tmtcgui.py
+++ b/tmtcgui.py
@@ -1,68 +1,11 @@
-#!/usr/bin/python3
-"""
-@brief TMTC Commander entry point for command line mode.
-@details
-This client was developed by KSat for the SOURCE project to test the on-board software but
-has evolved into a more generic tool for satellite developers to perform TMTC (Telemetry and Telecommand)
-handling and testing via different communication interfaces. Currently, only the PUS standard is
-implemented as a packet standard.
-
-Run this file with the -h flag to display options.
-
-@license
-Copyright 2020 KSat e.V. Stuttgart
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- https://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-@author R. Mueller
-"""
-import sys
-
-from config.hook_implementations import EiveHookObject
-from config.version import __version__
-from config.definitions import PUS_APID
-from pus_tm.factory_hook import ccsds_tm_handler
-
-try:
- from tmtccmd.runner import (
- init_tmtccmd,
- run_tmtccmd,
- add_ccsds_handler,
- )
- from tmtccmd.ccsds.handler import CcsdsTmHandler
- import spacepackets
-except ImportError as error:
- run_tmtc_commander = None
- initialize_tmtc_commander = None
- print(error)
- print("Python tmtccmd submodule could not be imported")
- print(
- 'Install with "cd tmtccmd && python3 -m pip install -e ." for interactive installation'
- )
- sys.exit(0)
+#!/usr/bin/env python3
+"""TMTC commander for EIVE"""
+from tmtcc import tmtcc_post_args, tmtcc_pre_args
def main():
- hook_obj = EiveHookObject()
- print(f"-- eive tmtc version {__version__}")
- print(f"-- spacepackets version {spacepackets.__version__} --")
- init_tmtccmd(hook_object=hook_obj)
- ccsds_handler = CcsdsTmHandler()
- ccsds_handler.add_tm_handler(
- apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
- )
- add_ccsds_handler(ccsds_handler)
- run_tmtccmd(use_gui=True)
+ hook_obj = tmtcc_pre_args()
+ tmtcc_post_args(hook_obj=hook_obj, use_gui=True, args=None)
if __name__ == "__main__":
diff --git a/tmtcloop.py b/tmtcloop.py
new file mode 100755
index 0000000..c48f436
--- /dev/null
+++ b/tmtcloop.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+"""EIVE TMTC Commander"""
+import sys
+import traceback
+
+try:
+ import tmtccmd.runner as tmtccmd
+ from tmtccmd.config import default_json_path, SetupArgs, CoreGlobalIds
+ from tmtccmd.config.definitions import CoreModeList
+ from tmtccmd.config.args import (
+ create_default_args_parser,
+ add_default_tmtccmd_args,
+ parse_default_input_arguments,
+ )
+ from tmtccmd.ccsds.handler import CcsdsTmHandler, ApidHandler
+ from tmtccmd.logging import get_console_logger
+ from tmtccmd.logging.pus import create_tmtc_logger
+except ImportError as error:
+ run_tmtc_commander = None
+ initialize_tmtc_commander = None
+ tb = traceback.format_exc()
+ print(tb)
+ print("Python tmtccmd submodule could not be imported")
+ sys.exit(1)
+
+try:
+ import spacepackets
+except ImportError as error:
+ print(error)
+ print("Python spacepackets module could not be imported")
+ print(
+ 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
+ )
+ sys.exit(1)
+
+from config.definitions import PUS_APID
+from pus_tc.tc_packer_hook import pre_tc_send_cb
+from pus_tm.factory_hook import ccsds_tm_handler
+from tmtcc import tmtcc_pre_args
+
+
+def main():
+ hook_obj = tmtcc_pre_args()
+ arg_parser = create_default_args_parser()
+ add_default_tmtccmd_args(arg_parser)
+ args = parse_default_input_arguments(arg_parser, hook_obj)
+ setup_args = SetupArgs(
+ hook_obj=hook_obj, use_gui=False, apid=PUS_APID, cli_args=args
+ )
+ apid_handler = ApidHandler(cb=ccsds_tm_handler, queue_len=50, user_args=None)
+ ccsds_handler = CcsdsTmHandler()
+ ccsds_handler.add_tm_handler(apid=PUS_APID, handler=apid_handler)
+ tmtccmd.setup(setup_args=setup_args)
+ tmtccmd.add_ccsds_handler(ccsds_handler)
+ tmtc_backend = tmtccmd.create_default_tmtc_backend(
+ setup_args=setup_args,
+ tm_handler=ccsds_handler,
+ )
+ tmtc_file_logger = create_tmtc_logger()
+ tmtc_backend.usr_send_wrapper = (pre_tc_send_cb, tmtc_file_logger)
+
+ tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
+
+ get_console_logger().info("Disabling console logger for continuous operation")
+ get_console_logger().disabled = True
+
+ tmtccmd.init_and_start_daemons(tmtc_backend=tmtc_backend)
+ tmtccmd.performOperation(tmtc_backend=tmtc_backend)
+
+ # remove cmdline args so that we can reuse code
+ sys.argv = sys.argv[:1]
+
+ while True:
+ args = parse_default_input_arguments(arg_parser, hook_obj)
+ setup_args = SetupArgs(
+ hook_obj=hook_obj, use_gui=False, apid=PUS_APID, cli_args=args
+ )
+ tmtccmd.setup(setup_args=setup_args)
+ tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
+
+ tmtccmd.performOperation(tmtc_backend=tmtc_backend)
+
+
+if __name__ == "__main__":
+ main()