New sus event #199
1
.flake8
1
.flake8
@ -7,6 +7,7 @@ exclude =
|
|||||||
.git,
|
.git,
|
||||||
__pycache__,
|
__pycache__,
|
||||||
docs/conf.py,
|
docs/conf.py,
|
||||||
|
deps
|
||||||
old,
|
old,
|
||||||
build,
|
build,
|
||||||
dist,
|
dist,
|
||||||
|
17
CHANGELOG.md
17
CHANGELOG.md
@ -10,9 +10,26 @@ list yields a list of all related PRs for each release.
|
|||||||
|
|
||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
# [v4.0.0] 2023-06-10
|
||||||
|
|
||||||
|
`tmtccmd` version: v5.0.0rc0
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Event handling for reboot counter events.
|
- Event handling for reboot counter events.
|
||||||
|
- Start adding new MPSoC commands, improve MPSoC commanding module a bit.
|
||||||
|
- Handling for PLOC MPSoC flash content report.
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Fix for PLOC power switching.
|
||||||
|
- Bump `tmtccmd` to v5.0.0rc0 for important bugfix in CFDP header.
|
||||||
|
|
||||||
|
# [v3.1.1] 2023-04-17
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- Update generated event file.
|
||||||
|
|
||||||
# [v3.1.0] 2023-04-16
|
# [v3.1.0] 2023-04-16
|
||||||
|
|
||||||
|
9
automation/Dockerfile
Normal file
9
automation/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
FROM python:3
|
||||||
|
|
||||||
|
RUN apt-get update
|
||||||
|
RUN apt-get --yes upgrade
|
||||||
|
#tzdata is a dependency, won't install otherwise
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
#pip needs a valid user to work
|
||||||
|
RUN adduser --uid 114 jenkins
|
14
automation/Jenkinsfile
vendored
Normal file
14
automation/Jenkinsfile
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
pipeline {
|
||||||
|
agent {
|
||||||
|
docker {
|
||||||
|
image 'eive-tmtc-ci:d2'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stages {
|
||||||
|
stage('Package') {
|
||||||
|
steps {
|
||||||
|
sh 'pip install .'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
__version__ = "3.1.0"
|
__version__ = "4.0.0"
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
SW_NAME = "eive-tmtc"
|
SW_NAME = "eive-tmtc"
|
||||||
VERSION_MAJOR = 3
|
VERSION_MAJOR = 4
|
||||||
VERSION_MINOR = 1
|
VERSION_MINOR = 0
|
||||||
VERSION_REVISION = 0
|
VERSION_REVISION = 0
|
||||||
|
|
||||||
EIVE_TMTC_ROOT = Path(__file__).parent
|
EIVE_TMTC_ROOT = Path(__file__).parent
|
||||||
|
@ -9,7 +9,6 @@ import enum
|
|||||||
from spacepackets import PacketType
|
from spacepackets import PacketType
|
||||||
from spacepackets.ccsds import PacketId
|
from spacepackets.ccsds import PacketId
|
||||||
from spacepackets.util import UnsignedByteField
|
from spacepackets.util import UnsignedByteField
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
PUS_APID = 0x65
|
PUS_APID = 0x65
|
||||||
|
@ -177,20 +177,24 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
|||||||
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/acs/StrComHandler.h
|
12515;0x30e3;STR_HELPER_FILE_NOT_EXISTS;LOW;Specified file does not exist P1: Internal state of str helper;linux/acs/StrComHandler.h
|
||||||
12516;0x30e4;STR_HELPER_SENDING_PACKET_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
12516;0x30e4;STR_HELPER_SENDING_PACKET_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
||||||
12517;0x30e5;STR_HELPER_REQUESTING_MSG_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
12517;0x30e5;STR_HELPER_REQUESTING_MSG_FAILED;LOW;No description;linux/acs/StrComHandler.h
|
||||||
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/payload/PlocMpsocHelper.h
|
12600;0x3138;MPSOC_FLASH_WRITE_FAILED;LOW;Flash write fails;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;LOW;Flash write successful;linux/payload/PlocMpsocHelper.h
|
12601;0x3139;MPSOC_FLASH_WRITE_SUCCESSFUL;INFO;Flash write successful;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/PlocMpsocHelper.h
|
12602;0x313a;MPSOC_SENDING_COMMAND_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12603;0x313b;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
|
12603;0x313b;MPSOC_HELPER_REQUESTING_REPLY_FAILED;LOW;Request receive message of communication interface failed P1: Return value returned by the communication interface requestReceiveMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12604;0x313c;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
|
12604;0x313c;MPSOC_HELPER_READING_REPLY_FAILED;LOW;Reading receive message of communication interface failed P1: Return value returned by the communication interface readingReceivedMessage function P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
|
12605;0x313d;MPSOC_MISSING_ACK;LOW;Did not receive acknowledgment report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocHelper.h
|
12606;0x313e;MPSOC_MISSING_EXE;LOW;Did not receive execution report P1: Number of bytes missing P2: Internal state of MPSoC helper;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
|
12607;0x313f;MPSOC_ACK_FAILURE_REPORT;LOW;Received acknowledgment failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
|
12608;0x3140;MPSOC_EXE_FAILURE_REPORT;LOW;Received execution failure report P1: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12609;0x3141;MPSOC_ACK_INVALID_APID;LOW;Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
|
12609;0x3141;MPSOC_ACK_INVALID_APID;LOW;Expected acknowledgment report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12610;0x3142;MPSOC_EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocHelper.h
|
12610;0x3142;MPSOC_EXE_INVALID_APID;LOW;Expected execution report but received space packet with other apid P1: Apid of received space packet P2: Internal state of MPSoC;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12611;0x3143;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocHelper.h
|
12611;0x3143;MPSOC_HELPER_SEQ_CNT_MISMATCH;LOW;Received sequence count does not match expected sequence count P1: Expected sequence count P2: Received sequence count;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/payload/PlocMpsocHelper.h
|
12612;0x3144;MPSOC_TM_SIZE_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/payload/PlocMpsocHelper.h
|
12613;0x3145;MPSOC_TM_CRC_MISSMATCH;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
|
12614;0x3146;MPSOC_FLASH_READ_PACKET_ERROR;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
|
12615;0x3147;MPSOC_FLASH_READ_FAILED;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
|
12616;0x3148;MPSOC_FLASH_READ_SUCCESSFUL;INFO;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
|
12617;0x3149;MPSOC_READ_TIMEOUT;LOW;No description;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
|
12700;0x319c;TRANSITION_BACK_TO_OFF;MEDIUM;Could not transition properly and went back to ALL OFF;mission/payload/PayloadPcduHandler.h
|
||||||
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
12701;0x319d;NEG_V_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||||
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
12702;0x319e;U_DRO_OUT_OF_BOUNDS;MEDIUM;P1: 0 -> too low, 1 -> too high P2: Float value;mission/payload/PayloadPcduHandler.h
|
||||||
@ -274,6 +278,7 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
|||||||
14105;0x3719;CAMERA_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
14105;0x3719;CAMERA_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||||
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
14106;0x371a;PCDU_SYSTEM_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||||
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
|
14107;0x371b;HEATER_NOT_OFF_FOR_OFF_MODE;MEDIUM;No description;mission/controller/tcsDefs.h
|
||||||
|
14108;0x371c;MGT_OVERHEATING;HIGH;No description;mission/controller/tcsDefs.h
|
||||||
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
|
14201;0x3779;TX_TIMER_EXPIRED;INFO;The transmit timer to protect the Syrlinks expired P1: The current timer value;mission/system/com/ComSubsystem.h
|
||||||
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/ComSubsystem.h
|
14202;0x377a;BIT_LOCK_TX_ON;INFO;Transmitter will be turned on due to detection of bitlock;mission/system/com/ComSubsystem.h
|
||||||
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h
|
14300;0x37dc;POSSIBLE_FILE_CORRUPTION;LOW;P1: Result code of TM packet parser. P2: Timestamp of possibly corrupt file as a unix timestamp.;mission/persistentTmStoreDefs.h
|
||||||
@ -289,3 +294,4 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
|
|||||||
14312;0x37e8;DUMP_MISC_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
14312;0x37e8;DUMP_MISC_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||||
14313;0x37e9;DUMP_HK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
14313;0x37e9;DUMP_HK_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||||
14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
14314;0x37ea;DUMP_CFDP_CANCELLED;LOW;P1: Number of dumped packets. P2: Total dumped bytes.;mission/persistentTmStoreDefs.h
|
||||||
|
14500;0x38a4;TEMPERATURE_IS_ALL_ONES;LOW;Possible indicator that the SUS device is glitchy;mission/acs/SusHandler.h
|
||||||
|
|
@ -8,7 +8,7 @@ import os.path
|
|||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from eive_tmtc import EIVE_TMTC_ROOT
|
from eive_tmtc import EIVE_TMTC_ROOT
|
||||||
from tmtccmd.util.obj_id import ObjectIdDictT, ObjectIdU32
|
from tmtccmd.util.obj_id import ObjectIdU32
|
||||||
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
from tmtccmd.fsfw import parse_fsfw_objects_csv
|
||||||
|
|
||||||
|
|
||||||
|
@ -478,8 +478,8 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
|
|||||||
0x53b6;STRH_StartrackerAlreadyBooted;Star tracker is already in firmware mode;182;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
0x53b6;STRH_StartrackerAlreadyBooted;Star tracker is already in firmware mode;182;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
||||||
0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
0x53b7;STRH_StartrackerNotRunningFirmware;Star tracker must be in firmware mode to run this command;183;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
||||||
0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
0x53b8;STRH_StartrackerNotRunningBootloader;Star tracker must be in bootloader mode to run this command;184;STR_HANDLER;mission/acs/str/StarTrackerHandler.h
|
||||||
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/payload/plocMpscoDefs.h
|
0x54e0;DWLPWRON_InvalidMode;Received command has invalid JESD mode (valid modes are 0 - 5);224;DWLPWRON_CMD;linux/payload/plocMpsocHelpers.h
|
||||||
0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/payload/plocMpscoDefs.h
|
0x54e1;DWLPWRON_InvalidLaneRate;Received command has invalid lane rate (valid lane rate are 0 - 9);225;DWLPWRON_CMD;linux/payload/plocMpsocHelpers.h
|
||||||
0x5700;PLSPVhLP_RequestDone;No description;0;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
0x5700;PLSPVhLP_RequestDone;No description;0;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
||||||
0x5701;PLSPVhLP_NoPacketFound;No description;1;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
0x5701;PLSPVhLP_NoPacketFound;No description;1;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
||||||
0x5702;PLSPVhLP_DecodeBufTooSmall;No description;2;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
0x5702;PLSPVhLP_DecodeBufTooSmall;No description;2;PLOC_SUPV_HELPER;linux/payload/PlocSupvUartMan.h
|
||||||
@ -543,7 +543,8 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
|
|||||||
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NvmParameterBase.h
|
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NvmParameterBase.h
|
||||||
0x64a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
|
0x64a0;FSHLP_SdNotMounted;SD card specified with path string not mounted;160;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
|
||||||
0x64a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
|
0x64a1;FSHLP_FileNotExists;Specified file does not exist on filesystem;161;FILE_SYSTEM_HELPER;bsp_q7s/fs/FilesystemHelper.h
|
||||||
0x65a0;PLMPHLP_FileClosedAccidentally;File accidentally close;160;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocHelper.h
|
0x65a0;PLMPHLP_FileWriteError;File error occured for file transfers from OBC to the MPSoC.;160;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
|
0x65a1;PLMPHLP_FileReadError;File error occured for file transfers from MPSoC to OBC.;161;PLOC_MPSOC_HELPER;linux/payload/PlocMpsocSpecialComHelper.h
|
||||||
0x66a0;SADPL_CommandNotSupported;No description;160;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
0x66a0;SADPL_CommandNotSupported;No description;160;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||||
0x66a1;SADPL_DeploymentAlreadyExecuting;No description;161;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
0x66a1;SADPL_DeploymentAlreadyExecuting;No description;161;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||||
0x66a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
0x66a2;SADPL_MainSwitchTimeoutFailure;No description;162;SA_DEPL_HANDLER;mission/SolarArrayDeploymentHandler.h
|
||||||
|
|
@ -60,3 +60,4 @@
|
|||||||
142;COM_SUBSYSTEM
|
142;COM_SUBSYSTEM
|
||||||
143;PERSISTENT_TM_STORE
|
143;PERSISTENT_TM_STORE
|
||||||
144;SYRLINKS_COM
|
144;SYRLINKS_COM
|
||||||
|
145;SUS_HANDLER
|
||||||
|
|
@ -74,7 +74,9 @@ def pack_get_param_command(
|
|||||||
memory_address: Union[int, bytes],
|
memory_address: Union[int, bytes],
|
||||||
parameter_size: int,
|
parameter_size: int,
|
||||||
) -> PusTelecommand:
|
) -> PusTelecommand:
|
||||||
"""Function to generate a command to retrieve parameters like the temperature from a gomspace device.
|
"""Function to generate a command to retrieve parameters like the temperature from a
|
||||||
|
gomspace device.
|
||||||
|
|
||||||
@param object_id: The object id of the gomspace device handler.
|
@param object_id: The object id of the gomspace device handler.
|
||||||
@param table_id: The table id of the gomspace device
|
@param table_id: The table id of the gomspace device
|
||||||
@param memory_address: Address offset within table of the value to read.
|
@param memory_address: Address offset within table of the value to read.
|
||||||
@ -218,9 +220,9 @@ def prompt_and_pack_set_integer_param_command(
|
|||||||
|
|
||||||
def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand:
|
def pack_ping_command(object_id: ObjectIdU32, data: bytearray) -> PusTelecommand:
|
||||||
""" " Function to generate the command to ping a gomspace device
|
""" " Function to generate the command to ping a gomspace device
|
||||||
@param object_id Object Id of the gomspace device handler.
|
:param object_id: Object Id of the gomspace device handler.
|
||||||
@param data Bytearray containing the bytes to send to the gomspace device. For now the on board software
|
:param data: Bytearray containing the bytes to send to the gomspace device. For now the on board
|
||||||
supports only the handling of up to 33 bytes.
|
software supports only the handling of up to 33 bytes.
|
||||||
@note The ping request sends the specified data to a gompsace device. These
|
@note The ping request sends the specified data to a gompsace device. These
|
||||||
data are simply copied by the device and then sent back.
|
data are simply copied by the device and then sent back.
|
||||||
"""
|
"""
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
from eive_tmtc.config.definitions import CustomServiceList
|
|
||||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry, CoreServiceList
|
||||||
from tmtccmd.config.tmtc import (
|
from tmtccmd.config.tmtc import (
|
||||||
tmtc_definitions_provider,
|
|
||||||
call_all_definitions_providers,
|
call_all_definitions_providers,
|
||||||
)
|
)
|
||||||
from tmtccmd.config.globals import get_default_tmtc_defs
|
from tmtccmd.config.globals import get_default_tmtc_defs
|
||||||
|
@ -29,7 +29,7 @@ from eive_tmtc.tmtc.acs.reaction_wheels import (
|
|||||||
pack_rw_ass_cmds,
|
pack_rw_ass_cmds,
|
||||||
)
|
)
|
||||||
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
from eive_tmtc.tmtc.payload.ploc_memory_dumper import pack_ploc_memory_dumper_cmd
|
||||||
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_test
|
from eive_tmtc.tmtc.com.ccsds_handler import pack_ccsds_handler_command
|
||||||
from eive_tmtc.tmtc.core import pack_core_commands
|
from eive_tmtc.tmtc.core import pack_core_commands
|
||||||
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
from eive_tmtc.tmtc.acs.star_tracker import pack_star_tracker_commands
|
||||||
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
from eive_tmtc.tmtc.com.syrlinks_handler import pack_syrlinks_command
|
||||||
@ -75,7 +75,7 @@ from tmtccmd.util import ObjectIdU32
|
|||||||
from eive_tmtc.utility.input_helper import InputHelper
|
from eive_tmtc.utility.input_helper import InputHelper
|
||||||
|
|
||||||
|
|
||||||
def handle_default_procedure(
|
def handle_default_procedure( # noqa C901: Complexity okay here.
|
||||||
tc_base: TcHandlerBase,
|
tc_base: TcHandlerBase,
|
||||||
info: DefaultProcedureInfo,
|
info: DefaultProcedureInfo,
|
||||||
queue_helper: DefaultPusQueueHelper,
|
queue_helper: DefaultPusQueueHelper,
|
||||||
@ -170,7 +170,7 @@ def handle_default_procedure(
|
|||||||
)
|
)
|
||||||
if service == CustomServiceList.CCSDS_HANDLER.value:
|
if service == CustomServiceList.CCSDS_HANDLER.value:
|
||||||
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
object_id = cast(ObjectIdU32, obj_id_man.get(CCSDS_HANDLER_ID))
|
||||||
return pack_ccsds_handler_test(
|
return pack_ccsds_handler_command(
|
||||||
object_id=object_id, q=queue_helper, op_code=op_code
|
object_id=object_id, q=queue_helper, op_code=op_code
|
||||||
)
|
)
|
||||||
if service == CustomServiceList.PDEC_HANDLER.value:
|
if service == CustomServiceList.PDEC_HANDLER.value:
|
||||||
|
@ -10,14 +10,11 @@ from PyQt5.QtWidgets import (
|
|||||||
|
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from tmtccmd.config import CoreModeList
|
|
||||||
from tmtccmd.core.globals_manager import get_global
|
|
||||||
|
|
||||||
|
|
||||||
class Parameter:
|
class Parameter:
|
||||||
def __init__(self, name: str, defaultValue: str, widget: QLineEdit):
|
def __init__(self, name: str, default_value: str, widget: QLineEdit):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.defaultValue = defaultValue
|
self.defaultValue = default_value
|
||||||
self.widget = widget
|
self.widget = widget
|
||||||
self.value = self.defaultValue
|
self.value = self.defaultValue
|
||||||
self.widget.setPlaceholderText(self.defaultValue)
|
self.widget.setPlaceholderText(self.defaultValue)
|
||||||
@ -34,9 +31,9 @@ class ParameterDialog(QDialog):
|
|||||||
|
|
||||||
self.setWindowTitle("Enter Parameters")
|
self.setWindowTitle("Enter Parameters")
|
||||||
|
|
||||||
Buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset
|
buttons = QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Reset
|
||||||
|
|
||||||
self.buttonBox = QDialogButtonBox(Buttons)
|
self.buttonBox = QDialogButtonBox(buttons)
|
||||||
self.buttonBox.accepted.connect(self.accept)
|
self.buttonBox.accepted.connect(self.accept)
|
||||||
self.buttonBox.rejected.connect(self.reject)
|
self.buttonBox.rejected.connect(self.reject)
|
||||||
self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self._reset)
|
self.buttonBox.button(QDialogButtonBox.Reset).clicked.connect(self._reset)
|
||||||
@ -54,14 +51,14 @@ class ParameterDialog(QDialog):
|
|||||||
|
|
||||||
self.parameters = {}
|
self.parameters = {}
|
||||||
|
|
||||||
def addParameter(self, name: str, defaultValue: str):
|
def add_parameter(self, name: str, default_value: str):
|
||||||
row = self.groupLayout.rowCount() + 1
|
row = self.groupLayout.rowCount() + 1
|
||||||
description = QLabel(name)
|
description = QLabel(name)
|
||||||
self.groupLayout.addWidget(description, row, 0)
|
self.groupLayout.addWidget(description, row, 0)
|
||||||
valueWidget = QLineEdit()
|
value_widget = QLineEdit()
|
||||||
self.groupLayout.addWidget(valueWidget, row, 1)
|
self.groupLayout.addWidget(value_widget, row, 1)
|
||||||
|
|
||||||
parameter = Parameter(name, defaultValue, valueWidget)
|
parameter = Parameter(name, default_value, value_widget)
|
||||||
|
|
||||||
self.parameters[name] = parameter
|
self.parameters[name] = parameter
|
||||||
|
|
||||||
@ -69,10 +66,10 @@ class ParameterDialog(QDialog):
|
|||||||
for value in self.parameters.values():
|
for value in self.parameters.values():
|
||||||
value.reset()
|
value.reset()
|
||||||
|
|
||||||
def getParameters(self):
|
def get_parameters(self):
|
||||||
output = {}
|
output = {}
|
||||||
for key, parameter in self.parameters.items():
|
for key, parameter in self.parameters.items():
|
||||||
if parameter.widget != None:
|
if parameter.widget is not None:
|
||||||
if parameter.widget.text() != "":
|
if parameter.widget.text() != "":
|
||||||
parameter.value = parameter.widget.text()
|
parameter.value = parameter.widget.text()
|
||||||
output[key] = parameter.value
|
output[key] = parameter.value
|
||||||
@ -103,9 +100,9 @@ def prompt_parameters_cli(param_list) -> dict:
|
|||||||
def _gui_prompt(param_list) -> dict:
|
def _gui_prompt(param_list) -> dict:
|
||||||
dialog = ParameterDialog()
|
dialog = ParameterDialog()
|
||||||
for parameter in param_list:
|
for parameter in param_list:
|
||||||
dialog.addParameter(parameter["name"], parameter["defaultValue"])
|
dialog.add_parameter(parameter["name"], parameter["defaultValue"])
|
||||||
dialog.exec_()
|
dialog.exec_()
|
||||||
return dialog.getParameters()
|
return dialog.get_parameters()
|
||||||
|
|
||||||
|
|
||||||
def _cli_prompt(param_list) -> dict:
|
def _cli_prompt(param_list) -> dict:
|
||||||
|
@ -1 +0,0 @@
|
|||||||
|
|
@ -86,9 +86,8 @@ def pack_cmd_ctrl_to_nml(
|
|||||||
def get_object_from_op_code(op_code: str):
|
def get_object_from_op_code(op_code: str):
|
||||||
try:
|
try:
|
||||||
return bytes.fromhex(op_code)
|
return bytes.fromhex(op_code)
|
||||||
except:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if op_code in OpCode.THERMAL_CONTROLLER:
|
if op_code in OpCode.THERMAL_CONTROLLER:
|
||||||
return obj_ids.THERMAL_CONTROLLER_ID
|
return obj_ids.THERMAL_CONTROLLER_ID
|
||||||
if op_code in OpCode.CORE_CONTROLLER:
|
if op_code in OpCode.CORE_CONTROLLER:
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import struct
|
||||||
import time
|
import time
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import get_object_ids
|
from eive_tmtc.config.object_ids import get_object_ids
|
||||||
|
from spacepackets.ecss import PusTelecommand
|
||||||
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
|
|
||||||
@ -14,7 +16,6 @@ from tmtccmd.pus.s11_tc_sched import (
|
|||||||
create_enable_tc_sched_cmd,
|
create_enable_tc_sched_cmd,
|
||||||
create_reset_tc_sched_cmd,
|
create_reset_tc_sched_cmd,
|
||||||
)
|
)
|
||||||
from tmtccmd.tc.pus_3_fsfw_hk import *
|
|
||||||
|
|
||||||
import eive_tmtc.config.object_ids as oids
|
import eive_tmtc.config.object_ids as oids
|
||||||
from eive_tmtc.tmtc.tcs.brd_assy import OpCodeAssy as TcsOpCodes
|
from eive_tmtc.tmtc.tcs.brd_assy import OpCodeAssy as TcsOpCodes
|
||||||
@ -49,6 +50,11 @@ from eive_tmtc.tmtc.acs.gyros import (
|
|||||||
L3gGyroSetId as L3gGyroSetIds_1_3,
|
L3gGyroSetId as L3gGyroSetIds_1_3,
|
||||||
)
|
)
|
||||||
from eive_tmtc.tmtc.acs.gps import SetId as GpsSetIds
|
from eive_tmtc.tmtc.acs.gps import SetId as GpsSetIds
|
||||||
|
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||||
|
make_sid,
|
||||||
|
disable_periodic_hk_command,
|
||||||
|
create_enable_periodic_hk_command_with_interval,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
@ -154,7 +160,7 @@ def add_proc_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def pack_generic_hk_listening_cmds(
|
def pack_generic_hk_listening_cmds( # noqa C901: Complexity okay here.
|
||||||
q: DefaultPusQueueHelper,
|
q: DefaultPusQueueHelper,
|
||||||
proc_key: str,
|
proc_key: str,
|
||||||
sid_list: list[bytearray],
|
sid_list: list[bytearray],
|
||||||
@ -222,7 +228,9 @@ def pack_generic_hk_listening_cmds(
|
|||||||
diag_list.clear()
|
diag_list.clear()
|
||||||
|
|
||||||
|
|
||||||
def pack_proc_commands(q: DefaultPusQueueHelper, op_code: str):
|
def pack_proc_commands( # noqa C901: Complexity is okay here.
|
||||||
|
q: DefaultPusQueueHelper, op_code: str
|
||||||
|
): # noqa C901: Complexity okay here.
|
||||||
sid_list = []
|
sid_list = []
|
||||||
obj_id_dict = get_object_ids()
|
obj_id_dict = get_object_ids()
|
||||||
if op_code in OpCode.RESET_SCHED:
|
if op_code in OpCode.RESET_SCHED:
|
||||||
@ -733,7 +741,7 @@ def enable_listen_to_hk_for_x_seconds(
|
|||||||
interval_seconds: float,
|
interval_seconds: float,
|
||||||
):
|
):
|
||||||
q.add_log_cmd(f"Enabling periodic HK for {device}")
|
q.add_log_cmd(f"Enabling periodic HK for {device}")
|
||||||
cmd_tuple = enable_periodic_hk_command_with_interval(
|
cmd_tuple = create_enable_periodic_hk_command_with_interval(
|
||||||
diag=diag, sid=sid, interval_seconds=interval_seconds
|
diag=diag, sid=sid, interval_seconds=interval_seconds
|
||||||
)
|
)
|
||||||
for cmd in cmd_tuple:
|
for cmd in cmd_tuple:
|
||||||
|
@ -1,15 +1,27 @@
|
|||||||
|
import logging
|
||||||
import struct
|
import struct
|
||||||
from eive_tmtc.config.object_ids import *
|
from eive_tmtc.config.object_ids import (
|
||||||
|
ACU_HANDLER_ID,
|
||||||
|
PDU_1_HANDLER_ID,
|
||||||
|
PDU_2_HANDLER_ID,
|
||||||
|
IMTQ_HANDLER_ID,
|
||||||
|
PLOC_MPSOC_ID,
|
||||||
|
PLOC_SUPV_ID,
|
||||||
|
CORE_CONTROLLER_ID,
|
||||||
|
STAR_TRACKER_ID,
|
||||||
|
P60_DOCK_HANDLER,
|
||||||
|
)
|
||||||
from eive_tmtc.tmtc.acs.imtq import ImtqActionId
|
from eive_tmtc.tmtc.acs.imtq import ImtqActionId
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from eive_tmtc.tmtc.core import handle_core_ctrl_action_replies
|
from eive_tmtc.tmtc.core import handle_core_ctrl_action_replies
|
||||||
from eive_tmtc.tmtc.payload.ploc_mpsoc import PlocReplyIds
|
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_mpsoc_data_reply
|
||||||
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
from eive_tmtc.tmtc.payload.ploc_supervisor import SupvActionId
|
||||||
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
|
from eive_tmtc.tmtc.acs.star_tracker import StarTrackerActionId
|
||||||
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
from eive_tmtc.tmtc.power.tm import handle_get_param_data_reply
|
||||||
from tmtccmd.tm import Service8FsfwTm
|
from tmtccmd.tm import Service8FsfwTm
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||||
|
from tmtccmd.util import ObjectIdDictT
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -23,9 +35,8 @@ def handle_action_reply(
|
|||||||
tm_packet = Service8FsfwTm.unpack(
|
tm_packet = Service8FsfwTm.unpack(
|
||||||
raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty()
|
raw_telemetry=raw_tm, time_reader=CdsShortTimestamp.empty()
|
||||||
)
|
)
|
||||||
printer.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
|
||||||
object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
|
object_id = obj_id_dict.get(tm_packet.source_object_id_as_bytes)
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer.file_logger)
|
||||||
custom_data = tm_packet.custom_data
|
custom_data = tm_packet.custom_data
|
||||||
action_id = tm_packet.action_id
|
action_id = tm_packet.action_id
|
||||||
generic_print_str = printer.generic_action_packet_tm_print(
|
generic_print_str = printer.generic_action_packet_tm_print(
|
||||||
@ -33,15 +44,15 @@ def handle_action_reply(
|
|||||||
)
|
)
|
||||||
pw.dlog(generic_print_str)
|
pw.dlog(generic_print_str)
|
||||||
if object_id.as_bytes == IMTQ_HANDLER_ID:
|
if object_id.as_bytes == IMTQ_HANDLER_ID:
|
||||||
return handle_imtq_replies(action_id, printer, custom_data)
|
return handle_imtq_replies(action_id, pw, custom_data)
|
||||||
elif object_id.as_bytes == PLOC_MPSOC_ID:
|
elif object_id.as_bytes == PLOC_MPSOC_ID:
|
||||||
return handle_ploc_replies(action_id, printer, custom_data)
|
return handle_mpsoc_data_reply(action_id, pw, custom_data)
|
||||||
elif object_id.as_bytes == PLOC_SUPV_ID:
|
elif object_id.as_bytes == PLOC_SUPV_ID:
|
||||||
return handle_supervisor_replies(action_id, printer, custom_data)
|
return handle_supervisor_replies(action_id, pw, custom_data)
|
||||||
elif object_id.as_bytes == CORE_CONTROLLER_ID:
|
elif object_id.as_bytes == CORE_CONTROLLER_ID:
|
||||||
return handle_core_ctrl_action_replies(action_id, printer, custom_data)
|
return handle_core_ctrl_action_replies(action_id, pw, custom_data)
|
||||||
elif object_id.as_bytes == STAR_TRACKER_ID:
|
elif object_id.as_bytes == STAR_TRACKER_ID:
|
||||||
return handle_startracker_replies(action_id, printer, custom_data)
|
return handle_startracker_replies(action_id, pw, custom_data)
|
||||||
elif object_id.as_bytes in [
|
elif object_id.as_bytes in [
|
||||||
ACU_HANDLER_ID,
|
ACU_HANDLER_ID,
|
||||||
PDU_1_HANDLER_ID,
|
PDU_1_HANDLER_ID,
|
||||||
@ -54,9 +65,7 @@ def handle_action_reply(
|
|||||||
pw.dlog(f"Raw Data: {tm_packet.custom_data.hex(sep=',')}")
|
pw.dlog(f"Raw Data: {tm_packet.custom_data.hex(sep=',')}")
|
||||||
|
|
||||||
|
|
||||||
def handle_imtq_replies(
|
def handle_imtq_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
|
||||||
):
|
|
||||||
if action_id == struct.unpack("!I", ImtqActionId.get_commanded_dipole)[0]:
|
if action_id == struct.unpack("!I", ImtqActionId.get_commanded_dipole)[0]:
|
||||||
header_list = [
|
header_list = [
|
||||||
"Commanded X-Dipole",
|
"Commanded X-Dipole",
|
||||||
@ -65,63 +74,25 @@ def handle_imtq_replies(
|
|||||||
]
|
]
|
||||||
[x_dipole, y_dipole, z_dipole] = struct.unpack("!HHH", custom_data[0:6])
|
[x_dipole, y_dipole, z_dipole] = struct.unpack("!HHH", custom_data[0:6])
|
||||||
content_list = [x_dipole, y_dipole, z_dipole]
|
content_list = [x_dipole, y_dipole, z_dipole]
|
||||||
print(header_list)
|
pw.dlog(f"{header_list}")
|
||||||
print(content_list)
|
pw.dlog(f"{content_list}")
|
||||||
printer.file_logger.info(header_list)
|
|
||||||
printer.file_logger.info(content_list)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_ploc_replies(
|
def handle_supervisor_replies(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
|
||||||
):
|
|
||||||
if action_id == PlocReplyIds.TM_MEM_READ_RPT:
|
|
||||||
header_list = [
|
|
||||||
"PLOC Memory Address",
|
|
||||||
"PLOC Mem Len",
|
|
||||||
"PLOC Read Memory Data",
|
|
||||||
]
|
|
||||||
content_list = [
|
|
||||||
"0x" + custom_data[:4].hex(),
|
|
||||||
struct.unpack("!H", custom_data[4:6])[0],
|
|
||||||
"0x" + custom_data[6:10].hex(),
|
|
||||||
]
|
|
||||||
print(header_list)
|
|
||||||
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(
|
|
||||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
|
||||||
):
|
|
||||||
if action_id == SupvActionId.DUMP_MRAM:
|
if action_id == SupvActionId.DUMP_MRAM:
|
||||||
header_list = ["MRAM Dump"]
|
header_list = ["MRAM Dump"]
|
||||||
content_list = [custom_data[: len(custom_data)]]
|
content_list = [custom_data[: len(custom_data)]]
|
||||||
print(header_list)
|
pw.dlog(f"{header_list}")
|
||||||
print(content_list)
|
pw.dlog(f"{content_list}")
|
||||||
printer.file_logger.info(header_list)
|
|
||||||
printer.file_logger.info(content_list)
|
|
||||||
elif action_id == SupvActionId.READ_GPIO:
|
elif action_id == SupvActionId.READ_GPIO:
|
||||||
header_list = ["GPIO state"]
|
header_list = ["GPIO state"]
|
||||||
content_list = [struct.unpack("!H", custom_data[:2])[0]]
|
content_list = [struct.unpack("!H", custom_data[:2])[0]]
|
||||||
print(header_list)
|
pw.dlog(f"{header_list}")
|
||||||
print(content_list)
|
pw.dlog(f"{content_list}")
|
||||||
printer.file_logger.info(header_list)
|
|
||||||
printer.file_logger.info(content_list)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_startracker_replies(
|
def handle_startracker_replies(
|
||||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytearray
|
action_id: int, pw: PrintWrapper, custom_data: bytearray
|
||||||
):
|
):
|
||||||
if action_id == StarTrackerActionId.CHECKSUM:
|
if action_id == StarTrackerActionId.CHECKSUM:
|
||||||
if len(custom_data) != 5:
|
if len(custom_data) != 5:
|
||||||
@ -133,7 +104,5 @@ def handle_startracker_replies(
|
|||||||
print(custom_data[4])
|
print(custom_data[4])
|
||||||
checksum_valid_flag = custom_data[4] >> 8
|
checksum_valid_flag = custom_data[4] >> 8
|
||||||
content_list = ["0x" + custom_data[:4].hex(), checksum_valid_flag]
|
content_list = ["0x" + custom_data[:4].hex(), checksum_valid_flag]
|
||||||
print(header_list)
|
pw.dlog(f"{header_list}")
|
||||||
print(content_list)
|
pw.dlog(f"{content_list}")
|
||||||
printer.file_logger.info(header_list)
|
|
||||||
printer.file_logger.info(content_list)
|
|
||||||
|
@ -1,19 +1,27 @@
|
|||||||
import logging
|
import logging
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class PrintWrapper:
|
class PrintWrapper:
|
||||||
def __init__(self, printer: FsfwTmTcPrinter):
|
def __init__(self, file_logger: Optional[logging.Logger]):
|
||||||
self.printer = printer
|
self.file_logger = file_logger
|
||||||
|
|
||||||
def dlog(self, string: str):
|
def dlog(self, string: str):
|
||||||
print(string)
|
print(string)
|
||||||
self.printer.file_logger.info(string)
|
if self.file_logger:
|
||||||
|
self.file_logger.info(string)
|
||||||
|
|
||||||
|
def wlog(self, logger: logging.Logger, string: str):
|
||||||
|
logger.warning(string)
|
||||||
|
if self.file_logger:
|
||||||
|
self.file_logger.warning(string)
|
||||||
|
|
||||||
def ilog(self, logger: logging.Logger, string: str):
|
def ilog(self, logger: logging.Logger, string: str):
|
||||||
logger.info(string)
|
logger.info(string)
|
||||||
self.printer.file_logger.info(string)
|
if self.file_logger:
|
||||||
|
self.file_logger.info(string)
|
||||||
|
|
||||||
|
|
||||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import struct
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from eive_tmtc.config.events import get_event_dict
|
from eive_tmtc.config.events import get_event_dict
|
||||||
@ -12,15 +11,15 @@ from tmtccmd.tc.pus_200_fsfw_mode import Mode
|
|||||||
from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth
|
from tmtccmd.tc.pus_201_fsfw_health import FsfwHealth
|
||||||
|
|
||||||
from tmtccmd.tm import Service5Tm
|
from tmtccmd.tm import Service5Tm
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
|
||||||
from tmtccmd.fsfw import EventInfo
|
from tmtccmd.fsfw import EventInfo
|
||||||
from spacepackets.ccsds.time import CdsShortTimestamp
|
from spacepackets.ccsds.time import CdsShortTimestamp
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
def handle_event_packet( # noqa C901: Complexity okay here
|
||||||
pw = PrintWrapper(printer)
|
raw_tm: bytes, pw: PrintWrapper
|
||||||
|
): # noqa C901: Complexity okay here
|
||||||
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
tm = Service5Tm.unpack(data=raw_tm, time_reader=CdsShortTimestamp.empty())
|
||||||
event_dict = get_event_dict()
|
event_dict = get_event_dict()
|
||||||
event_def = tm.event_definition
|
event_def = tm.event_definition
|
||||||
@ -36,9 +35,12 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
obj_name = event_def.reporter_id.hex(sep=",")
|
obj_name = event_def.reporter_id.hex(sep=",")
|
||||||
else:
|
else:
|
||||||
obj_name = obj_id_obj.name
|
obj_name = obj_id_obj.name
|
||||||
generic_event_string = f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x}) at {tm.time_provider.as_date_time()}"
|
generic_event_string = (
|
||||||
|
f"Object {obj_name} generated Event {info.name} (ID: {event_def.event_id:#04x}) "
|
||||||
|
f"at {tm.time_provider.as_date_time()}"
|
||||||
|
)
|
||||||
_LOGGER.info(generic_event_string)
|
_LOGGER.info(generic_event_string)
|
||||||
pw.printer.file_logger.info(
|
pw.file_logger.info(
|
||||||
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
f"{datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||||
)
|
)
|
||||||
specific_handler = False
|
specific_handler = False
|
||||||
@ -51,8 +53,8 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
||||||
additional_event_info = f"Additional info: {info.info}"
|
additional_event_info = f"Additional info: {info.info}"
|
||||||
context = (
|
context = (
|
||||||
f"Progress Percent: {event_def.param1 >> 24 & 0xff} | Sequence Count: {event_def.param1 & 0xffff} "
|
f"Progress Percent: {event_def.param1 >> 24 & 0xff} | "
|
||||||
f"| Bytes Written: {event_def.param2}"
|
f"Sequence Count: {event_def.param1 & 0xffff} | Bytes Written: {event_def.param2}"
|
||||||
)
|
)
|
||||||
pw.dlog(additional_event_info)
|
pw.dlog(additional_event_info)
|
||||||
pw.dlog(context)
|
pw.dlog(context)
|
||||||
@ -78,7 +80,8 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
elif event_def.param1 == Mode.RAW:
|
elif event_def.param1 == Mode.RAW:
|
||||||
mode_name = "Raw"
|
mode_name = "Raw"
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"Mode Number {event_def.param1}, Mode Name {mode_name}, Submode: {event_def.param2}"
|
f"Mode Number {event_def.param1}, Mode Name {mode_name}, "
|
||||||
|
f"Submode: {event_def.param2}"
|
||||||
)
|
)
|
||||||
if info.name == "INDIVIDUAL_BOOT_COUNTS":
|
if info.name == "INDIVIDUAL_BOOT_COUNTS":
|
||||||
boot_count_00 = (event_def.param1 >> 16) & 0xFFFF
|
boot_count_00 = (event_def.param1 >> 16) & 0xFFFF
|
||||||
@ -129,7 +132,10 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
submode = event_def.param2
|
submode = event_def.param2
|
||||||
pw.dlog(f"Mode Number {mode}, Submode: {submode}")
|
pw.dlog(f"Mode Number {mode}, Submode: {submode}")
|
||||||
if not specific_handler:
|
if not specific_handler:
|
||||||
additional_event_info = f"Additional info: {info.info} | P1: {event_def.param1} | P2: {event_def.param2}"
|
additional_event_info = (
|
||||||
|
f"Additional info: {info.info} | P1: {event_def.param1} | "
|
||||||
|
f"P2: {event_def.param2}"
|
||||||
|
)
|
||||||
pw.dlog(additional_event_info)
|
pw.dlog(additional_event_info)
|
||||||
if not specific_handler:
|
if not specific_handler:
|
||||||
# printer.handle_long_tm_print(packet_if=tm.pus_tm, info_if=tm.pus_tm)
|
# printer.handle_long_tm_print(packet_if=tm.pus_tm, info_if=tm.pus_tm)
|
||||||
|
@ -13,7 +13,7 @@ from tmtccmd.tm import Service20FsfwTm, Service200FsfwTm
|
|||||||
from tmtccmd.tm.pus_20_fsfw_param import Service20ParamDumpWrapper
|
from tmtccmd.tm.pus_20_fsfw_param import Service20ParamDumpWrapper
|
||||||
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
|
||||||
from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice
|
from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
from .defs import PrintWrapper
|
from .defs import PrintWrapper
|
||||||
|
|
||||||
from .event_handler import handle_event_packet
|
from .event_handler import handle_event_packet
|
||||||
@ -24,7 +24,7 @@ from .action_reply_handler import handle_action_reply
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def pus_factory_hook(
|
def pus_factory_hook( # noqa C901 : Complexity okay here
|
||||||
packet: bytes,
|
packet: bytes,
|
||||||
verif_wrapper: VerificationWrapper,
|
verif_wrapper: VerificationWrapper,
|
||||||
printer: FsfwTmTcPrinter,
|
printer: FsfwTmTcPrinter,
|
||||||
@ -35,20 +35,21 @@ def pus_factory_hook(
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
tm_packet = PusTelemetry.unpack(packet, CdsShortTimestamp.empty())
|
||||||
except ValueError:
|
except ValueError as value_error:
|
||||||
|
_LOGGER.warning(f"{value_error}")
|
||||||
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
_LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||||
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
_LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||||
return
|
return
|
||||||
service = tm_packet.service
|
service = tm_packet.service
|
||||||
obj_id_dict = get_object_ids()
|
obj_id_dict = get_object_ids()
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer.file_logger)
|
||||||
dedicated_handler = True
|
dedicated_handler = True
|
||||||
if service == 1:
|
if service == 1:
|
||||||
handle_service_1_fsfw_packet(wrapper=verif_wrapper, raw_tm=packet)
|
handle_service_1_fsfw_packet(wrapper=verif_wrapper, raw_tm=packet)
|
||||||
elif service == 3:
|
elif service == 3:
|
||||||
handle_hk_packet(printer=printer, raw_tm=packet, obj_id_dict=obj_id_dict)
|
handle_hk_packet(printer=printer, raw_tm=packet, obj_id_dict=obj_id_dict)
|
||||||
elif service == 5:
|
elif service == 5:
|
||||||
handle_event_packet(raw_tm=packet, printer=printer)
|
handle_event_packet(raw_tm=packet, pw=pw)
|
||||||
elif service == 8:
|
elif service == 8:
|
||||||
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
handle_action_reply(raw_tm=packet, printer=printer, obj_id_dict=obj_id_dict)
|
||||||
elif service == 17:
|
elif service == 17:
|
||||||
@ -77,7 +78,7 @@ def pus_factory_hook(
|
|||||||
elif isinstance(scalar_param, float):
|
elif isinstance(scalar_param, float):
|
||||||
pw.dlog(f"Scalar floating point parameter: {scalar_param}")
|
pw.dlog(f"Scalar floating point parameter: {scalar_param}")
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
pw.dlog("received {e} trying to parse scalar parameter")
|
pw.dlog(f"received {e} trying to parse scalar parameter")
|
||||||
else:
|
else:
|
||||||
# TODO: Could improve display further by actually displaying a matrix as a
|
# TODO: Could improve display further by actually displaying a matrix as a
|
||||||
# matrix using row and column information
|
# matrix using row and column information
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"""HK Handling for EIVE OBSW"""
|
"""HK Handling for EIVE OBSW"""
|
||||||
import datetime
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
# from pus_tm.tcp_server_objects import TCP_SEVER_SENSOR_TEMPERATURES
|
||||||
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
from eive_tmtc.tmtc.acs.acs_ctrl import handle_acs_ctrl_hk_data
|
||||||
|
from eive_tmtc.tmtc.payload.ploc_mpsoc import handle_ploc_mpsoc_hk_data
|
||||||
from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk
|
from eive_tmtc.tmtc.tcs.rtd import RTD_NAMES, handle_rtd_hk
|
||||||
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
|
from eive_tmtc.tmtc.acs.star_tracker import handle_str_hk_data
|
||||||
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
|
from eive_tmtc.tmtc.power.plpcdu import handle_plpcdu_hk
|
||||||
@ -33,7 +33,7 @@ from eive_tmtc.tmtc.power.tm import (
|
|||||||
from eive_tmtc.tmtc.acs.imtq import (
|
from eive_tmtc.tmtc.acs.imtq import (
|
||||||
handle_imtq_hk,
|
handle_imtq_hk,
|
||||||
)
|
)
|
||||||
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter
|
from eive_tmtc.pus_tm.defs import FsfwTmTcPrinter, PrintWrapper
|
||||||
from eive_tmtc.tmtc.core import handle_core_hk_data
|
from eive_tmtc.tmtc.core import handle_core_hk_data
|
||||||
from eive_tmtc.tmtc.acs.mgms import handle_mgm_hk_data
|
from eive_tmtc.tmtc.acs.mgms import handle_mgm_hk_data
|
||||||
import eive_tmtc.config.object_ids as obj_ids
|
import eive_tmtc.config.object_ids as obj_ids
|
||||||
@ -84,7 +84,7 @@ def handle_hk_packet(
|
|||||||
_LOGGER.warning("HK definitions printout not implemented yet")
|
_LOGGER.warning("HK definitions printout not implemented yet")
|
||||||
|
|
||||||
|
|
||||||
def handle_regular_hk_print(
|
def handle_regular_hk_print( # noqa C901: Complexity okay here
|
||||||
printer: FsfwTmTcPrinter,
|
printer: FsfwTmTcPrinter,
|
||||||
object_id: ObjectIdU32,
|
object_id: ObjectIdU32,
|
||||||
hk_packet: Service3Base,
|
hk_packet: Service3Base,
|
||||||
@ -94,36 +94,35 @@ def handle_regular_hk_print(
|
|||||||
objb = object_id.as_bytes
|
objb = object_id.as_bytes
|
||||||
set_id = hk_packet.set_id
|
set_id = hk_packet.set_id
|
||||||
packet_dt = tm.time_provider.as_date_time()
|
packet_dt = tm.time_provider.as_date_time()
|
||||||
|
pw = PrintWrapper(printer.file_logger)
|
||||||
"""This function is called when a Service 3 Housekeeping packet is received."""
|
"""This function is called when a Service 3 Housekeeping packet is received."""
|
||||||
if objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
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, object_id, set_id, hk_data)
|
return handle_rw_hk_data(pw, object_id, set_id, hk_data)
|
||||||
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
elif objb == obj_ids.SYRLINKS_HANDLER_ID:
|
||||||
return handle_syrlinks_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
return handle_syrlinks_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
elif objb == obj_ids.IMTQ_HANDLER_ID:
|
||||||
return handle_imtq_hk(printer=printer, hk_data=hk_data, set_id=set_id)
|
return handle_imtq_hk(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb == obj_ids.GPS_CONTROLLER:
|
elif objb == obj_ids.GPS_CONTROLLER:
|
||||||
return handle_gps_data(printer=printer, hk_data=hk_data)
|
return handle_gps_data(pw=pw, hk_data=hk_data)
|
||||||
elif objb == obj_ids.PCDU_HANDLER_ID:
|
elif objb == obj_ids.PCDU_HANDLER_ID:
|
||||||
return handle_pcdu_hk(printer=printer, set_id=set_id, hk_data=hk_data)
|
return handle_pcdu_hk(pw=pw, set_id=set_id, hk_data=hk_data)
|
||||||
elif objb == obj_ids.BPX_HANDLER_ID:
|
elif objb == obj_ids.BPX_HANDLER_ID:
|
||||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
|
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, pw=pw)
|
||||||
elif objb == obj_ids.CORE_CONTROLLER_ID:
|
elif objb == obj_ids.CORE_CONTROLLER_ID:
|
||||||
return handle_core_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
return handle_core_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb == obj_ids.PDU_1_HANDLER_ID:
|
elif objb == obj_ids.PDU_1_HANDLER_ID:
|
||||||
return handle_pdu_data(
|
return handle_pdu_data(pw=pw, pdu_idx=1, set_id=set_id, hk_data=hk_data)
|
||||||
printer=printer, pdu_idx=1, set_id=set_id, hk_data=hk_data
|
|
||||||
)
|
|
||||||
elif objb == obj_ids.PDU_2_HANDLER_ID:
|
elif objb == obj_ids.PDU_2_HANDLER_ID:
|
||||||
return handle_pdu_data(
|
return handle_pdu_data(pw=pw, pdu_idx=2, set_id=set_id, hk_data=hk_data)
|
||||||
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
|
elif objb == obj_ids.PLOC_MPSOC_ID:
|
||||||
)
|
return handle_ploc_mpsoc_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb == obj_ids.ACU_HANDLER_ID:
|
elif objb == obj_ids.ACU_HANDLER_ID:
|
||||||
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
return handle_acu_hk_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb == obj_ids.RAD_SENSOR_ID:
|
elif objb == obj_ids.RAD_SENSOR_ID:
|
||||||
return handle_rad_sensor_data(printer=printer, hk_data=hk_data, set_id=set_id)
|
return handle_rad_sensor_data(pw=pw, hk_data=hk_data, set_id=set_id)
|
||||||
elif objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
elif objb in [obj_ids.RW1_ID, obj_ids.RW2_ID, obj_ids.RW3_ID, obj_ids.RW4_ID]:
|
||||||
return handle_rw_hk_data(
|
return handle_rw_hk_data(
|
||||||
printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data
|
pw=pw, object_id=object_id, set_id=set_id, hk_data=hk_data
|
||||||
)
|
)
|
||||||
if objb in [
|
if objb in [
|
||||||
obj_ids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
obj_ids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||||
@ -139,13 +138,11 @@ def handle_regular_hk_print(
|
|||||||
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
||||||
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
||||||
]:
|
]:
|
||||||
return handle_sus_hk(
|
return handle_sus_hk(object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id)
|
||||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
|
||||||
)
|
|
||||||
elif objb in RTD_NAMES.keys():
|
elif objb in RTD_NAMES.keys():
|
||||||
return handle_rtd_hk(object_id=objb, hk_data=hk_data, printer=printer)
|
return handle_rtd_hk(object_id=objb, hk_data=hk_data, pw=pw)
|
||||||
elif objb == obj_ids.P60_DOCK_HANDLER:
|
elif objb == obj_ids.P60_DOCK_HANDLER:
|
||||||
return handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
return handle_p60_hk_data(pw=pw, set_id=set_id, hk_data=hk_data)
|
||||||
elif objb in [
|
elif objb in [
|
||||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||||
@ -153,7 +150,7 @@ def handle_regular_hk_print(
|
|||||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
return handle_gyros_hk_data(
|
return handle_gyros_hk_data(
|
||||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id
|
||||||
)
|
)
|
||||||
elif objb in [
|
elif objb in [
|
||||||
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
||||||
@ -162,21 +159,21 @@ def handle_regular_hk_print(
|
|||||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
return handle_mgm_hk_data(
|
return handle_mgm_hk_data(
|
||||||
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
object_id=object_id, hk_data=hk_data, pw=pw, set_id=set_id
|
||||||
)
|
)
|
||||||
elif objb == obj_ids.PL_PCDU_ID:
|
elif objb == obj_ids.PL_PCDU_ID:
|
||||||
return handle_plpcdu_hk(set_id=set_id, hk_data=hk_data, printer=printer)
|
return handle_plpcdu_hk(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||||
elif objb == obj_ids.THERMAL_CONTROLLER_ID:
|
elif objb == obj_ids.THERMAL_CONTROLLER_ID:
|
||||||
return handle_thermal_controller_hk_data(
|
return handle_thermal_controller_hk_data(
|
||||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
object_id=object_id, pw=pw, set_id=set_id, hk_data=hk_data
|
||||||
)
|
)
|
||||||
elif objb == obj_ids.STAR_TRACKER_ID:
|
elif objb == obj_ids.STAR_TRACKER_ID:
|
||||||
return handle_str_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
return handle_str_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||||
elif objb == obj_ids.PLOC_SUPV_ID:
|
elif objb == obj_ids.PLOC_SUPV_ID:
|
||||||
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, printer=printer)
|
return handle_supv_hk_data(set_id=set_id, hk_data=hk_data, pw=pw)
|
||||||
elif objb == obj_ids.ACS_CONTROLLER:
|
elif objb == obj_ids.ACS_CONTROLLER:
|
||||||
return handle_acs_ctrl_hk_data(
|
return handle_acs_ctrl_hk_data(
|
||||||
printer=printer, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
pw=pw, set_id=set_id, hk_data=hk_data, packet_time=packet_dt
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
|
import logging
|
||||||
import socket
|
import socket
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import json
|
import json
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
from tmtccmd.logging import get_console_logger
|
|
||||||
from tmtccmd.util.obj_id import ObjectIdU32
|
from tmtccmd.util.obj_id import ObjectIdU32
|
||||||
from dle_encoder import DleEncoder
|
from dle_encoder import DleEncoder
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TmTcpServer:
|
class TmTcpServer:
|
||||||
@ -29,8 +29,8 @@ class TmTcpServer:
|
|||||||
def __del__(self):
|
def __del__(self):
|
||||||
try:
|
try:
|
||||||
self.close()
|
self.close()
|
||||||
except:
|
except IOError:
|
||||||
LOGGER.warning("Could not close sockets!")
|
_LOGGER.warning("Could not close sockets!")
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.server_socket.close()
|
self.server_socket.close()
|
||||||
@ -45,8 +45,8 @@ class TmTcpServer:
|
|||||||
(self.client_connection, _) = self.server_socket.accept()
|
(self.client_connection, _) = self.server_socket.accept()
|
||||||
self.client_connection.setblocking(False)
|
self.client_connection.setblocking(False)
|
||||||
print("Client connected")
|
print("Client connected")
|
||||||
except:
|
except IOError:
|
||||||
# no client waiting
|
|
||||||
return
|
return
|
||||||
|
|
||||||
data_json_bytes = json.dumps(dictionary).encode()
|
data_json_bytes = json.dumps(dictionary).encode()
|
||||||
@ -57,7 +57,7 @@ class TmTcpServer:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
sent_length = self.client_connection.send(data_json_bytes)
|
sent_length = self.client_connection.send(data_json_bytes)
|
||||||
except:
|
except IOError:
|
||||||
self.client_connection = None
|
self.client_connection = None
|
||||||
return
|
return
|
||||||
if sent_length == 0:
|
if sent_length == 0:
|
||||||
|
@ -28,7 +28,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
|||||||
create_request_one_diag_command,
|
create_request_one_diag_command,
|
||||||
)
|
)
|
||||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
|
from tmtccmd.tc.pus_20_fsfw_param import create_load_param_cmd
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ def acs_cmd_defs(defs: TmtcDefinitionWrapper):
|
|||||||
|
|
||||||
|
|
||||||
@service_provider(CustomServiceList.ACS_CTRL.value)
|
@service_provider(CustomServiceList.ACS_CTRL.value)
|
||||||
def pack_acs_ctrl_command(p: ServiceProviderParams):
|
def pack_acs_ctrl_command(p: ServiceProviderParams): # noqa C901
|
||||||
op_code = p.op_code
|
op_code = p.op_code
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
if op_code in OpCodes.OFF:
|
if op_code in OpCodes.OFF:
|
||||||
@ -507,7 +507,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameter=param,
|
parameter=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case 1:
|
case 1:
|
||||||
@ -519,7 +519,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameter=param,
|
parameter=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case 2:
|
case 2:
|
||||||
@ -531,7 +531,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameter=param,
|
parameter=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case 3:
|
case 3:
|
||||||
@ -543,7 +543,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameter=param,
|
parameter=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
case 4:
|
case 4:
|
||||||
@ -555,7 +555,7 @@ def set_acs_ctrl_param_scalar(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameter=param,
|
parameter=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -603,7 +603,7 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameters=param,
|
parameters=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -636,7 +636,7 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameters=param,
|
parameters=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -663,7 +663,7 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
|
|||||||
domain_id=sid,
|
domain_id=sid,
|
||||||
unique_id=pid,
|
unique_id=pid,
|
||||||
parameters=param,
|
parameters=param,
|
||||||
).pack()
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
@ -672,12 +672,11 @@ def set_acs_ctrl_param_matrix(q: DefaultPusQueueHelper):
|
|||||||
|
|
||||||
|
|
||||||
def handle_acs_ctrl_hk_data(
|
def handle_acs_ctrl_hk_data(
|
||||||
printer: FsfwTmTcPrinter,
|
pw: PrintWrapper,
|
||||||
set_id: int,
|
set_id: int,
|
||||||
hk_data: bytes,
|
hk_data: bytes,
|
||||||
packet_time: datetime.datetime,
|
packet_time: datetime.datetime,
|
||||||
):
|
):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.ilog(_LOGGER, f"Received ACS CTRL HK with packet time {packet_time}")
|
pw.ilog(_LOGGER, f"Received ACS CTRL HK with packet time {packet_time}")
|
||||||
match set_id:
|
match set_id:
|
||||||
case SetId.MGM_RAW_SET:
|
case SetId.MGM_RAW_SET:
|
||||||
@ -721,7 +720,7 @@ def handle_acs_ctrl_sus_raw_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
sus_list_formatted = vec_fmt.format(*sus_list)
|
sus_list_formatted = vec_fmt.format(*sus_list)
|
||||||
current_idx += length
|
current_idx += length
|
||||||
pw.dlog(f"SUS {idx} RAW: {sus_list_formatted}")
|
pw.dlog(f"SUS {idx} RAW: {sus_list_formatted}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=12)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=12)
|
||||||
|
|
||||||
|
|
||||||
def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -757,7 +756,7 @@ def handle_acs_ctrl_sus_processed_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
sun_ijk_model = vec_fmt.format(*sun_ijk_model)
|
sun_ijk_model = vec_fmt.format(*sun_ijk_model)
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.dlog(f"{'SUS ijk Model'.ljust(25)}: {sun_ijk_model}")
|
pw.dlog(f"{'SUS ijk Model'.ljust(25)}: {sun_ijk_model}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=15)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=15)
|
||||||
|
|
||||||
|
|
||||||
def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -812,7 +811,7 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
|
pw.dlog(f"{entry[0].ljust(28)}: {entry[1]}")
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
assert current_idx == 61
|
assert current_idx == 61
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=6)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=6)
|
||||||
|
|
||||||
|
|
||||||
def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -866,7 +865,7 @@ def handle_mgm_data_processed(pw: PrintWrapper, hk_data: bytes):
|
|||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
if PERFORM_MGM_CALIBRATION:
|
if PERFORM_MGM_CALIBRATION:
|
||||||
perform_mgm_calibration(pw, mgm_3)
|
perform_mgm_calibration(pw, mgm_3)
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=8)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=8)
|
||||||
|
|
||||||
|
|
||||||
def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -900,7 +899,7 @@ def handle_gyr_data_raw(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"{'GYR 1 L3'.ljust(15)}: {float_str_fmt.format(*gyr_1_l3)}")
|
pw.dlog(f"{'GYR 1 L3'.ljust(15)}: {float_str_fmt.format(*gyr_1_l3)}")
|
||||||
pw.dlog(f"{'GYR 2 ADIS'.ljust(15)}: {float_str_fmt.format(*gyr_2_adis)}")
|
pw.dlog(f"{'GYR 2 ADIS'.ljust(15)}: {float_str_fmt.format(*gyr_2_adis)}")
|
||||||
pw.dlog(f"{'GYR 3 L3'.ljust(15)}: {float_str_fmt.format(*gyr_3_l3)}")
|
pw.dlog(f"{'GYR 3 L3'.ljust(15)}: {float_str_fmt.format(*gyr_3_l3)}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 4)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 4)
|
||||||
|
|
||||||
|
|
||||||
GYR_NAMES = ["GYR 0 ADIS", "GYR 1 L3", "GYR 2 ADIS", "GYR 3 L3"]
|
GYR_NAMES = ["GYR 0 ADIS", "GYR 1 L3", "GYR 2 ADIS", "GYR 3 L3"]
|
||||||
@ -926,7 +925,7 @@ def handle_gyr_data_processed(pw: PrintWrapper, hk_data: bytes):
|
|||||||
]
|
]
|
||||||
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
|
pw.dlog(f"GYR Vec Total: {gyr_vec_tot}")
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=5)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5)
|
||||||
|
|
||||||
|
|
||||||
def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -979,7 +978,7 @@ def handle_gps_data_processed(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"GPS Altitude: {alt} [m]")
|
pw.dlog(f"GPS Altitude: {alt} [m]")
|
||||||
pw.dlog(f"GPS Position: {pos} [m]")
|
pw.dlog(f"GPS Position: {pos} [m]")
|
||||||
pw.dlog(f"GPS Velocity: {velo} [m/s]")
|
pw.dlog(f"GPS Velocity: {velo} [m/s]")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=4)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5)
|
||||||
|
|
||||||
|
|
||||||
def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -1023,7 +1022,7 @@ def handle_mekf_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"{'MEKF Raw Status (key unknown)'.ljust(25)}: {status}")
|
pw.dlog(f"{'MEKF Raw Status (key unknown)'.ljust(25)}: {status}")
|
||||||
pw.dlog(f"{'MEKF Quaternion'.ljust(25)}: {fmt_str_4.format(*quat)}")
|
pw.dlog(f"{'MEKF Quaternion'.ljust(25)}: {fmt_str_4.format(*quat)}")
|
||||||
pw.dlog(f"{'MEKF Rotational Rate'.ljust(25)}: {fmt_str_3.format(*rates)}")
|
pw.dlog(f"{'MEKF Rotational Rate'.ljust(25)}: {fmt_str_3.format(*rates)}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||||
|
|
||||||
|
|
||||||
def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -1091,7 +1090,7 @@ def handle_ctrl_val_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"Control Values Error Quaternion: {err_quat}")
|
pw.dlog(f"Control Values Error Quaternion: {err_quat}")
|
||||||
pw.dlog(f"Control Values Error Angle: {err_ang} [deg]")
|
pw.dlog(f"Control Values Error Angle: {err_ang} [deg]")
|
||||||
pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [deg/s]")
|
pw.dlog(f"Control Values Target Rotational Rate: {tgt_rot} [deg/s]")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=5)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=5)
|
||||||
|
|
||||||
|
|
||||||
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
@ -1130,10 +1129,12 @@ def handle_act_cmd_data(pw: PrintWrapper, hk_data: bytes):
|
|||||||
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
|
pw.dlog(f"Actuator Commands RW Target Torque: {rw_tgt_torque}")
|
||||||
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
|
pw.dlog(f"Actuator Commands RW Target Speed: {rw_tgt_speed}")
|
||||||
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")
|
pw.dlog(f"Actuator Commands MTQ Target Dipole: {mtq_tgt_dipole}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], num_vars=3)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=3)
|
||||||
|
|
||||||
|
|
||||||
def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
|
def perform_mgm_calibration( # noqa C901: Complexity okay
|
||||||
|
pw: PrintWrapper, mgm_tuple: Tuple
|
||||||
|
): # noqa C901: Complexity okay
|
||||||
global CALIBR_SOCKET, CALIBRATION_ADDR
|
global CALIBR_SOCKET, CALIBRATION_ADDR
|
||||||
try:
|
try:
|
||||||
declare_api_cmd = "declare_api_version 2"
|
declare_api_cmd = "declare_api_version 2"
|
||||||
@ -1147,7 +1148,7 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if str(reply[0]) == "0":
|
if str(reply[0]) == "0":
|
||||||
pw.dlog(f"MGM calibration: API version 2 was not accepted")
|
pw.dlog("MGM calibration: API version 2 was not accepted")
|
||||||
return
|
return
|
||||||
if len(mgm_tuple) != 3:
|
if len(mgm_tuple) != 3:
|
||||||
pw.dlog(f"MGM tuple has invalid length {len(mgm_tuple)}")
|
pw.dlog(f"MGM tuple has invalid length {len(mgm_tuple)}")
|
||||||
@ -1165,7 +1166,7 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if str(reply[0]) == "0":
|
if str(reply[0]) == "0":
|
||||||
pw.dlog(f"MGM calibration: magnetmeter field format was not accepted")
|
pw.dlog("MGM calibration: magnetmeter field format was not accepted")
|
||||||
return
|
return
|
||||||
pw.dlog(f"Sent data {mgm_list} to Helmholtz Testbench successfully")
|
pw.dlog(f"Sent data {mgm_list} to Helmholtz Testbench successfully")
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
@ -1173,6 +1174,6 @@ def perform_mgm_calibration(pw: PrintWrapper, mgm_tuple: Tuple):
|
|||||||
except BlockingIOError as e:
|
except BlockingIOError as e:
|
||||||
pw.dlog(f"Error {e}")
|
pw.dlog(f"Error {e}")
|
||||||
except ConnectionResetError as e:
|
except ConnectionResetError as e:
|
||||||
pw.dlog("Socket was closed")
|
pw.dlog(f"Socket was closed: {e}")
|
||||||
except ConnectionRefusedError or OSError:
|
except ConnectionRefusedError or OSError:
|
||||||
pw.dlog("Connecting to Calibration Socket on addrss {} failed")
|
pw.dlog("Connecting to Calibration Socket on addrss {} failed")
|
||||||
|
@ -15,7 +15,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
|||||||
create_enable_periodic_hk_command_with_interval,
|
create_enable_periodic_hk_command_with_interval,
|
||||||
create_disable_periodic_hk_command,
|
create_disable_periodic_hk_command,
|
||||||
)
|
)
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -87,8 +87,7 @@ def pack_gps_command(object_id: bytes, q: DefaultPusQueueHelper, op_code: str):
|
|||||||
q.add_pus_tc(create_mode_command(object_id, Mode.OFF, 0))
|
q.add_pus_tc(create_mode_command(object_id, Mode.OFF, 0))
|
||||||
|
|
||||||
|
|
||||||
def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_gps_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
pw.dlog(f"Received GPS data, HK data length {len(hk_data)}")
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
fmt_str = "!ddddBBBHBBBBBI"
|
fmt_str = "!ddddBBBHBBBBBI"
|
||||||
@ -124,4 +123,6 @@ def handle_gps_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
)
|
)
|
||||||
pw.dlog(f"GNSS Date: {date_string}")
|
pw.dlog(f"GNSS Date: {date_string}")
|
||||||
pw.dlog(f"Unix seconds {unix_seconds}")
|
pw.dlog(f"Unix seconds {unix_seconds}")
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=14)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=14
|
||||||
|
)
|
||||||
|
@ -25,7 +25,6 @@ from eive_tmtc.config.definitions import CustomServiceList
|
|||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
|
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
@ -107,29 +106,24 @@ def handle_gyr_cmd(q: DefaultPusQueueHelper, op_code: str):
|
|||||||
|
|
||||||
|
|
||||||
def handle_gyros_hk_data(
|
def handle_gyros_hk_data(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if object_id.as_bytes in [
|
if object_id.as_bytes in [
|
||||||
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
obj_ids.GYRO_0_ADIS_HANDLER_ID,
|
||||||
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
obj_ids.GYRO_2_ADIS_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
handle_adis_gyro_hk(
|
handle_adis_gyro_hk(object_id=object_id, pw=pw, set_id=set_id, hk_data=hk_data)
|
||||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
|
||||||
)
|
|
||||||
elif object_id.as_bytes in [
|
elif object_id.as_bytes in [
|
||||||
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
obj_ids.GYRO_1_L3G_HANDLER_ID,
|
||||||
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
obj_ids.GYRO_3_L3G_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
handle_l3g_gyro_hk(
|
handle_l3g_gyro_hk(object_id=object_id, pw=pw, set_id=set_id, hk_data=hk_data)
|
||||||
object_id=object_id, printer=printer, set_id=set_id, hk_data=hk_data
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def handle_adis_gyro_hk(
|
def handle_adis_gyro_hk(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == AdisGyroSetId.CORE_HK:
|
if set_id == AdisGyroSetId.CORE_HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
fmt_str = "!ddddddf"
|
fmt_str = "!ddddddf"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(
|
(
|
||||||
@ -149,7 +143,6 @@ def handle_adis_gyro_hk(
|
|||||||
pw.dlog(f"Acceleration (m/s^2): X {accel_x} | Y {accel_y} | Z {accel_z}")
|
pw.dlog(f"Acceleration (m/s^2): X {accel_x} | Y {accel_y} | Z {accel_z}")
|
||||||
pw.dlog(f"Temperature {temp} C")
|
pw.dlog(f"Temperature {temp} C")
|
||||||
if set_id == AdisGyroSetId.CFG_HK:
|
if set_id == AdisGyroSetId.CFG_HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
fmt_str = "!HBHHH"
|
fmt_str = "!HBHHH"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
print(len(hk_data))
|
print(len(hk_data))
|
||||||
@ -168,10 +161,9 @@ def handle_adis_gyro_hk(
|
|||||||
|
|
||||||
|
|
||||||
def handle_l3g_gyro_hk(
|
def handle_l3g_gyro_hk(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == L3gGyroSetId.CORE_HK:
|
if set_id == L3gGyroSetId.CORE_HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
fmt_str = "!ffff"
|
fmt_str = "!ffff"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(angVelocX, angVelocY, angVelocZ, temp) = struct.unpack(
|
(angVelocX, angVelocY, angVelocZ, temp) = struct.unpack(
|
||||||
|
@ -24,13 +24,12 @@ from tmtccmd.tc.pus_3_fsfw_hk import (
|
|||||||
generate_one_diag_command,
|
generate_one_diag_command,
|
||||||
generate_one_hk_command,
|
generate_one_hk_command,
|
||||||
create_request_one_diag_command,
|
create_request_one_diag_command,
|
||||||
create_enable_periodic_hk_command,
|
|
||||||
create_disable_periodic_hk_command,
|
create_disable_periodic_hk_command,
|
||||||
create_enable_periodic_hk_command_with_interval,
|
create_enable_periodic_hk_command_with_interval,
|
||||||
)
|
)
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -129,7 +128,9 @@ def add_imtq_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
|
defs.add_service(CustomServiceList.IMTQ.value, "IMQT Device", oce)
|
||||||
|
|
||||||
|
|
||||||
def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
def pack_imtq_test_into( # noqa C901
|
||||||
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
|
):
|
||||||
q.add_log_cmd(
|
q.add_log_cmd(
|
||||||
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
|
f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}"
|
||||||
)
|
)
|
||||||
@ -426,26 +427,27 @@ ENG_HK_HEADERS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def handle_imtq_hk(printer: FsfwTmTcPrinter, hk_data: bytes, set_id: int):
|
def handle_imtq_hk(pw: PrintWrapper, hk_data: bytes, set_id: int):
|
||||||
if (set_id >= ImtqSetId.POSITIVE_X_TEST) and (set_id <= ImtqSetId.NEGATIVE_Z_TEST):
|
if (set_id >= ImtqSetId.POSITIVE_X_TEST) and (set_id <= ImtqSetId.NEGATIVE_Z_TEST):
|
||||||
return handle_self_test_data(printer, hk_data)
|
return handle_self_test_data(pw, hk_data)
|
||||||
elif set_id == ImtqSetId.ENG_HK_NO_TORQUE:
|
elif set_id == ImtqSetId.ENG_HK_NO_TORQUE:
|
||||||
return handle_eng_set(printer, hk_data, False)
|
return handle_eng_set(pw, hk_data, False)
|
||||||
elif set_id == ImtqSetId.ENG_HK_SET_WITH_TORQUE:
|
elif set_id == ImtqSetId.ENG_HK_SET_WITH_TORQUE:
|
||||||
return handle_eng_set(printer, hk_data, True)
|
return handle_eng_set(pw, hk_data, True)
|
||||||
elif set_id == ImtqSetId.CAL_MTM_SET:
|
elif set_id == ImtqSetId.CAL_MTM_SET:
|
||||||
return handle_calibrated_mtm_measurement(printer, hk_data)
|
return handle_calibrated_mtm_measurement(pw, hk_data)
|
||||||
elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE:
|
elif set_id == ImtqSetId.RAW_MTM_NO_TORQUE:
|
||||||
return handle_raw_mtm_measurement(printer, hk_data, False)
|
return handle_raw_mtm_measurement(pw, hk_data, False)
|
||||||
elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE:
|
elif set_id == ImtqSetId.RAW_MTM_WITH_TORQUE:
|
||||||
return handle_raw_mtm_measurement(printer, hk_data, True)
|
return handle_raw_mtm_measurement(pw, hk_data, True)
|
||||||
elif set_id == ImtqSetId.DIPOLES:
|
elif set_id == ImtqSetId.DIPOLES:
|
||||||
return handle_dipole_set(printer, hk_data)
|
return handle_dipole_set(pw, hk_data)
|
||||||
elif set_id == ImtqSetId.STATUS_SET:
|
elif set_id == ImtqSetId.STATUS_SET:
|
||||||
return handle_status_set(printer, hk_data)
|
return handle_status_set(pw, hk_data)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning(
|
pw.wlog(
|
||||||
f"IMTQ handler HK reply with unknown or unimplemented set id {set_id}"
|
_LOGGER,
|
||||||
|
f"IMTQ handler HK reply with unknown or unimplemented set id {set_id}",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -457,8 +459,7 @@ def unpack_status_set(hk_data: bytes) -> List:
|
|||||||
return [status_mode, status_error, status_conf, status_uptime]
|
return [status_mode, status_error, status_conf, status_uptime]
|
||||||
|
|
||||||
|
|
||||||
def handle_dipole_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_dipole_set(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog("Received iMTQ dipole set")
|
pw.dlog("Received iMTQ dipole set")
|
||||||
fmt_str = "!hhhH"
|
fmt_str = "!hhhH"
|
||||||
fmt_len = struct.calcsize(fmt_str)
|
fmt_len = struct.calcsize(fmt_str)
|
||||||
@ -469,7 +470,7 @@ def handle_dipole_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
pw.dlog(f"Dipole Y: {dipole_y}")
|
pw.dlog(f"Dipole Y: {dipole_y}")
|
||||||
pw.dlog(f"Dipole Z: {dipole_z}")
|
pw.dlog(f"Dipole Z: {dipole_z}")
|
||||||
pw.dlog(f"Current torque duration: {current_torque_duration}")
|
pw.dlog(f"Current torque duration: {current_torque_duration}")
|
||||||
pw.printer.print_validity_buffer(hk_data[fmt_len:], 2)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[fmt_len:], 2)
|
||||||
|
|
||||||
|
|
||||||
def unpack_eng_hk(hk_data: bytes) -> List:
|
def unpack_eng_hk(hk_data: bytes) -> List:
|
||||||
@ -500,8 +501,7 @@ def unpack_eng_hk(hk_data: bytes) -> List:
|
|||||||
return content_list
|
return content_list
|
||||||
|
|
||||||
|
|
||||||
def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes, torque_on: bool):
|
def handle_eng_set(pw: PrintWrapper, hk_data: bytes, torque_on: bool):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Found engineering HK. Torque Status: {torque_on}")
|
pw.dlog(f"Found engineering HK. Torque Status: {torque_on}")
|
||||||
content_list = unpack_eng_hk(hk_data)
|
content_list = unpack_eng_hk(hk_data)
|
||||||
validity_buffer = hk_data[32:]
|
validity_buffer = hk_data[32:]
|
||||||
@ -509,22 +509,28 @@ def handle_eng_set(printer: FsfwTmTcPrinter, hk_data: bytes, torque_on: bool):
|
|||||||
num_of_vars = len(ENG_HK_HEADERS)
|
num_of_vars = len(ENG_HK_HEADERS)
|
||||||
for k, v in zip(ENG_HK_HEADERS, content_list):
|
for k, v in zip(ENG_HK_HEADERS, content_list):
|
||||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_status_set(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_status_set(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
content_list = unpack_status_set(hk_data)
|
content_list = unpack_status_set(hk_data)
|
||||||
validity_buffer = hk_data[7:]
|
validity_buffer = hk_data[7:]
|
||||||
|
|
||||||
num_of_vars = 4
|
num_of_vars = 4
|
||||||
for k, v in zip(STATUS_HEADERS, content_list):
|
for k, v in zip(STATUS_HEADERS, content_list):
|
||||||
pw.dlog(f"{k.ljust(30)}: {v}")
|
pw.dlog(f"{k.ljust(30)}: {v}")
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_calibrated_mtm_measurement(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
header_list = [
|
header_list = [
|
||||||
"Calibrated MTM X [nT]",
|
"Calibrated MTM X [nT]",
|
||||||
"Calibrated MTM Y [nT]",
|
"Calibrated MTM Y [nT]",
|
||||||
@ -540,13 +546,14 @@ def handle_calibrated_mtm_measurement(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
num_of_vars = len(header_list)
|
num_of_vars = len(header_list)
|
||||||
pw.dlog(str(header_list))
|
pw.dlog(str(header_list))
|
||||||
pw.dlog(str(content_list))
|
pw.dlog(str(content_list))
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_raw_mtm_measurement(
|
def handle_raw_mtm_measurement(pw: PrintWrapper, hk_data: bytes, torque_status: bool):
|
||||||
printer: FsfwTmTcPrinter, hk_data: bytes, torque_status: bool
|
|
||||||
):
|
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Found raw MTM measurement. Torque Status: {torque_status}")
|
pw.dlog(f"Found raw MTM measurement. Torque Status: {torque_status}")
|
||||||
header_list = [
|
header_list = [
|
||||||
"Raw MTM X [nT]",
|
"Raw MTM X [nT]",
|
||||||
@ -563,11 +570,14 @@ def handle_raw_mtm_measurement(
|
|||||||
num_of_vars = 2
|
num_of_vars = 2
|
||||||
pw.dlog(str(header_list))
|
pw.dlog(str(header_list))
|
||||||
pw.dlog(str(content_list))
|
pw.dlog(str(content_list))
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_self_test_data(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
header_list = [
|
header_list = [
|
||||||
"Init Err",
|
"Init Err",
|
||||||
"Init Raw Mag X [nT]",
|
"Init Raw Mag X [nT]",
|
||||||
@ -671,7 +681,7 @@ def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
init_coil_z_temperature,
|
init_coil_z_temperature,
|
||||||
err,
|
err,
|
||||||
raw_mag_x,
|
raw_mag_x,
|
||||||
init_raw_mag_y,
|
raw_mag_y,
|
||||||
raw_mag_z,
|
raw_mag_z,
|
||||||
cal_mag_x,
|
cal_mag_x,
|
||||||
cal_mag_y,
|
cal_mag_y,
|
||||||
@ -699,4 +709,8 @@ def handle_self_test_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
num_of_vars = len(header_list)
|
num_of_vars = len(header_list)
|
||||||
pw.dlog(str(header_list))
|
pw.dlog(str(header_list))
|
||||||
pw.dlog(str(content_list))
|
pw.dlog(str(content_list))
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=num_of_vars)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=num_of_vars
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@ -17,7 +17,6 @@ from tmtccmd.config.tmtc import tmtc_definitions_provider, TmtcDefinitionWrapper
|
|||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
@ -64,26 +63,25 @@ def handle_mgm_cmd(q: DefaultPusQueueHelper, op_code: str):
|
|||||||
|
|
||||||
|
|
||||||
def handle_mgm_hk_data(
|
def handle_mgm_hk_data(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if object_id.as_bytes in [
|
if object_id.as_bytes in [
|
||||||
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
obj_ids.MGM_0_LIS3_HANDLER_ID,
|
||||||
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
obj_ids.MGM_2_LIS3_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data)
|
handle_mgm_lis3_hk_data(object_id, pw, set_id, hk_data)
|
||||||
elif object_id.as_bytes in [
|
elif object_id.as_bytes in [
|
||||||
obj_ids.MGM_1_RM3100_HANDLER_ID,
|
obj_ids.MGM_1_RM3100_HANDLER_ID,
|
||||||
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
obj_ids.MGM_3_RM3100_HANDLER_ID,
|
||||||
]:
|
]:
|
||||||
handle_mgm_rm3100_hk_data(object_id, printer, set_id, hk_data)
|
handle_mgm_rm3100_hk_data(object_id, pw, set_id, hk_data)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def handle_mgm_lis3_hk_data(
|
def handle_mgm_lis3_hk_data(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == MgmLis3SetId.CORE_HK:
|
if set_id == MgmLis3SetId.CORE_HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
fmt_str = "!ffff"
|
fmt_str = "!ffff"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(field_x, field_y, field_z, temp) = struct.unpack(
|
(field_x, field_y, field_z, temp) = struct.unpack(
|
||||||
@ -97,11 +95,10 @@ def handle_mgm_lis3_hk_data(
|
|||||||
|
|
||||||
|
|
||||||
def handle_mgm_rm3100_hk_data(
|
def handle_mgm_rm3100_hk_data(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
if set_id == MgmRm3100SetId.CORE_HK:
|
if set_id == MgmRm3100SetId.CORE_HK:
|
||||||
pw = PrintWrapper(printer)
|
fmt_str = "!fff"
|
||||||
fmt_str = f"!fff"
|
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(field_x, field_y, field_z) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
(field_x, field_y, field_z) = struct.unpack(fmt_str, hk_data[0 : 0 + inc_len])
|
||||||
pw.dlog(f"Received MGM RM3100 from object {object_id}")
|
pw.dlog(f"Received MGM RM3100 from object {object_id}")
|
||||||
|
@ -25,7 +25,7 @@ from spacepackets.ecss.tc import PusTelecommand
|
|||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class OpCodesDev:
|
class OpCodesDev:
|
||||||
@ -144,7 +144,7 @@ def add_rw_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def pack_single_rw_test_into(
|
def pack_single_rw_test_into( # noqa C901: Complexity is okay here.
|
||||||
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
|
object_id: bytes, rw_idx: int, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
if op_code == OpCodesDev.SPEED:
|
if op_code == OpCodesDev.SPEED:
|
||||||
@ -288,10 +288,9 @@ def pack_set_speed_command(
|
|||||||
|
|
||||||
|
|
||||||
def handle_rw_hk_data(
|
def handle_rw_hk_data(
|
||||||
printer: FsfwTmTcPrinter, object_id: ObjectIdU32, set_id: int, hk_data: bytes
|
pw: PrintWrapper, object_id: ObjectIdU32, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
|
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
if set_id == RwSetId.STATUS_SET_ID:
|
if set_id == RwSetId.STATUS_SET_ID:
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
@ -316,7 +315,7 @@ def handle_rw_hk_data(
|
|||||||
f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
|
f"Current Limit Control mode {clc_mode}. 0: Low Current Mode (0.3 A), "
|
||||||
f"1: High Current Mode (0.6 A)"
|
f"1: High Current Mode (0.6 A)"
|
||||||
)
|
)
|
||||||
printer.print_validity_buffer(hk_data[current_idx:], 5)
|
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5))
|
||||||
if set_id == RwSetId.LAST_RESET:
|
if set_id == RwSetId.LAST_RESET:
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
f"Received Last Reset HK (ID {set_id}) from Reaction Wheel {object_id.name}"
|
||||||
@ -375,7 +374,7 @@ def handle_rw_hk_data(
|
|||||||
f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
|
f"State {state}. 0: Error, 1: Idle, 2: Coasting, 3: Running, speed stable, "
|
||||||
f"4: Running, speed changing"
|
f"4: Running, speed changing"
|
||||||
)
|
)
|
||||||
pw.dlog(f"Number Of Invalid Packets:")
|
pw.dlog("Number Of Invalid Packets:")
|
||||||
pw.dlog("CRC | Length | CMD")
|
pw.dlog("CRC | Length | CMD")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"{num_invalid_crc_packets} | {num_invalid_len_packets} | {num_invalid_cmd_packets}"
|
f"{num_invalid_crc_packets} | {num_invalid_len_packets} | {num_invalid_cmd_packets}"
|
||||||
@ -386,8 +385,8 @@ def handle_rw_hk_data(
|
|||||||
)
|
)
|
||||||
pw.dlog("UART COM information:")
|
pw.dlog("UART COM information:")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"NumBytesWritten | NumBytesRead | ParityErrs | NoiseErrs | FrameErrs | "
|
"NumBytesWritten | NumBytesRead | ParityErrs | NoiseErrs | FrameErrs | "
|
||||||
f"RegOverrunErrs | TotalErrs"
|
"RegOverrunErrs | TotalErrs"
|
||||||
)
|
)
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} | {uart_num_parity_errors} | "
|
f"{uart_num_of_bytes_written} | {uart_num_of_bytes_read} | {uart_num_parity_errors} | "
|
||||||
@ -395,14 +394,16 @@ def handle_rw_hk_data(
|
|||||||
f"{uart_total_num_errors}"
|
f"{uart_total_num_errors}"
|
||||||
)
|
)
|
||||||
pw.dlog("SPI COM Info:")
|
pw.dlog("SPI COM Info:")
|
||||||
pw.dlog(f"NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs")
|
pw.dlog("NumBytesWritten | NumBytesRead | RegOverrunErrs | TotalErrs")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"{spi_num_bytes_written} | {spi_num_bytes_read} | {spi_num_reg_overrun_errors} | "
|
f"{spi_num_bytes_written} | {spi_num_bytes_read} | {spi_num_reg_overrun_errors} | "
|
||||||
f"{spi_total_num_errors}"
|
f"{spi_total_num_errors}"
|
||||||
)
|
)
|
||||||
if current_idx > 0:
|
if current_idx > 0:
|
||||||
printer.print_validity_buffer(
|
pw.dlog(
|
||||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_diag_command, make_sid
|
|||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
from eive_tmtc.config.object_ids import STR_ASSEMBLY, STAR_TRACKER_ID
|
from eive_tmtc.config.object_ids import STR_ASSEMBLY, STAR_TRACKER_ID
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -202,7 +202,7 @@ def prompt_object_id_mode_cmd() -> bytes:
|
|||||||
return STAR_TRACKER_ID
|
return STAR_TRACKER_ID
|
||||||
|
|
||||||
|
|
||||||
def pack_star_tracker_commands(
|
def pack_star_tracker_commands( # noqa C901
|
||||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
q.add_log_cmd(
|
q.add_log_cmd(
|
||||||
@ -707,8 +707,7 @@ def get_upload_image() -> str:
|
|||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
def handle_str_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
||||||
if set_id == SetId.SOLUTION:
|
if set_id == SetId.SOLUTION:
|
||||||
handle_solution_set(hk_data, pw)
|
handle_solution_set(hk_data, pw)
|
||||||
@ -747,7 +746,7 @@ def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
pw.dlog(f"CMOS Temperature: {cmos_temp}")
|
pw.dlog(f"CMOS Temperature: {cmos_temp}")
|
||||||
pw.dlog(f"FPGA Temperature: {fpga_temp}")
|
pw.dlog(f"FPGA Temperature: {fpga_temp}")
|
||||||
current_idx += fmt_len
|
current_idx += fmt_len
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 5)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 5)
|
||||||
|
|
||||||
|
|
||||||
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||||
@ -821,7 +820,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
|||||||
solution_strategy = hk_data[current_idx]
|
solution_strategy = hk_data[current_idx]
|
||||||
pw.dlog(f"Solution strategy: {solution_strategy}")
|
pw.dlog(f"Solution strategy: {solution_strategy}")
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 23)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 23)
|
||||||
|
|
||||||
|
|
||||||
@tmtc_definitions_provider
|
@tmtc_definitions_provider
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
@brief Commanding of the star tracker image helper object which is responsible for uploading
|
@brief Commanding of the star tracker image helper object which is responsible for uploading
|
||||||
and downloading images to/from the star tracker.
|
and downloading images to/from the star tracker.
|
||||||
@details Images to uplaod must be previously transferred to the OBC with the CFDP protocol.
|
@details Images to uplaod must be previously transferred to the OBC with the CFDP protocol.
|
||||||
Also downloaded images will be stored on the filesystem of the OBC and can be transferred via CFDP.
|
Also downloaded images will be stored on the filesystem of the OBC and can be
|
||||||
|
transferred via CFDP.
|
||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 29.11.2021
|
@date 29.11.2021
|
||||||
"""
|
"""
|
||||||
|
@ -3,7 +3,7 @@ import struct
|
|||||||
|
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class SetId(enum.IntEnum):
|
class SetId(enum.IntEnum):
|
||||||
@ -11,9 +11,8 @@ class SetId(enum.IntEnum):
|
|||||||
|
|
||||||
|
|
||||||
def handle_sus_hk(
|
def handle_sus_hk(
|
||||||
object_id: ObjectIdU32, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
|
object_id: ObjectIdU32, hk_data: bytes, pw: PrintWrapper, set_id: int
|
||||||
):
|
):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Received SUS HK data from {object_id}")
|
pw.dlog(f"Received SUS HK data from {object_id}")
|
||||||
if set_id == SetId.HK:
|
if set_id == SetId.HK:
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
@ -24,7 +23,9 @@ def handle_sus_hk(
|
|||||||
channels.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2]))
|
channels.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2]))
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
pw.dlog(f"Temperature: {temperature} C")
|
pw.dlog(f"Temperature: {temperature} C")
|
||||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
pw.dlog("AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||||
for idx, val in enumerate(channels):
|
for idx, val in enumerate(channels):
|
||||||
pw.dlog(f"{idx} | {val[0]:#06x} |" + str(val[0]).ljust(5))
|
pw.dlog(f"{idx} | {val[0]:#06x} |" + str(val[0]).ljust(5))
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=7
|
||||||
|
)
|
||||||
|
@ -18,7 +18,6 @@ from tmtccmd.config.tmtc import (
|
|||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import create_mode_command, Mode
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from eive_tmtc.config.object_ids import CCSDS_HANDLER_ID
|
|
||||||
|
|
||||||
|
|
||||||
class ActionId(enum.IntEnum):
|
class ActionId(enum.IntEnum):
|
||||||
@ -67,7 +66,7 @@ class Info:
|
|||||||
DISABLE_ACTION = "Disable TX (legacy)"
|
DISABLE_ACTION = "Disable TX (legacy)"
|
||||||
|
|
||||||
|
|
||||||
def pack_ccsds_handler_test(
|
def pack_ccsds_handler_command( # noqa C901
|
||||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
obyt = object_id.as_bytes
|
obyt = object_id.as_bytes
|
||||||
|
@ -61,7 +61,7 @@ class Info:
|
|||||||
|
|
||||||
|
|
||||||
@service_provider(CustomServiceList.COM_SS)
|
@service_provider(CustomServiceList.COM_SS)
|
||||||
def build_com_subsystem_cmd(p: ServiceProviderParams):
|
def build_com_subsystem_cmd(p: ServiceProviderParams): # noqa C901
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
o = p.op_code
|
o = p.op_code
|
||||||
prefix = "COM Subsystem"
|
prefix = "COM Subsystem"
|
||||||
|
@ -31,7 +31,7 @@ from eive_tmtc.config.object_ids import SYRLINKS_HANDLER_ID
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class SetId(enum.IntEnum):
|
class SetId(enum.IntEnum):
|
||||||
@ -142,7 +142,7 @@ def normal_mode_cmd(q: DefaultPusQueueHelper, info: str, submode: int):
|
|||||||
q.add_pus_tc(create_mode_command(SYRLINKS_HANDLER_ID, Mode.NORMAL, submode))
|
q.add_pus_tc(create_mode_command(SYRLINKS_HANDLER_ID, Mode.NORMAL, submode))
|
||||||
|
|
||||||
|
|
||||||
def pack_syrlinks_command(
|
def pack_syrlinks_command( # noqa C901: Complexity okay here.
|
||||||
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
obyt = object_id.as_bytes
|
obyt = object_id.as_bytes
|
||||||
@ -254,31 +254,28 @@ def pack_syrlinks_command(
|
|||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||||
|
|
||||||
|
|
||||||
def handle_syrlinks_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_syrlinks_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
if set_id == SetId.RX_REGISTERS_DATASET:
|
if set_id == SetId.RX_REGISTERS_DATASET:
|
||||||
return handle_syrlinks_rx_registers_dataset(printer, hk_data)
|
return handle_syrlinks_rx_registers_dataset(pw, hk_data)
|
||||||
elif set_id == SetId.TX_REGISTERS_DATASET:
|
elif set_id == SetId.TX_REGISTERS_DATASET:
|
||||||
return handle_syrlinks_tx_registers_dataset(printer, hk_data)
|
return handle_syrlinks_tx_registers_dataset(pw, hk_data)
|
||||||
elif set_id == SetId.TEMPERATURE_SET_ID:
|
elif set_id == SetId.TEMPERATURE_SET_ID:
|
||||||
return handle_syrlinks_temp_dataset(printer, hk_data)
|
return handle_syrlinks_temp_dataset(pw, hk_data)
|
||||||
else:
|
else:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
pw.dlog(f"Service 3 TM: Syrlinks handler reply with unknown set ID {set_id}")
|
||||||
|
|
||||||
|
|
||||||
def handle_syrlinks_temp_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_syrlinks_temp_dataset(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
if len(hk_data) < 8:
|
if len(hk_data) < 8:
|
||||||
raise ValueError("expected at least 8 bytes of HK data")
|
raise ValueError("expected at least 8 bytes of HK data")
|
||||||
temp_power_amplifier = struct.unpack("!f", hk_data[0:4])[0]
|
temp_power_amplifier = struct.unpack("!f", hk_data[0:4])[0]
|
||||||
temp_baseband_board = struct.unpack("!f", hk_data[4:8])[0]
|
temp_baseband_board = struct.unpack("!f", hk_data[4:8])[0]
|
||||||
pw.dlog(f"Temperatur Power Amplifier [C]: {temp_power_amplifier}")
|
pw.dlog(f"Temperatur Power Amplifier [C]: {temp_power_amplifier}")
|
||||||
pw.dlog(f"Temperatur Baseband Board [C]: {temp_baseband_board}")
|
pw.dlog(f"Temperatur Baseband Board [C]: {temp_baseband_board}")
|
||||||
printer.print_validity_buffer(hk_data[8:], 2)
|
pw.dlog(FsfwTmTcPrinter.get_validity_buffer(hk_data[8:], 2))
|
||||||
|
|
||||||
|
|
||||||
def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_syrlinks_rx_registers_dataset(pw: PrintWrapper, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
header_list = [
|
header_list = [
|
||||||
"RX Status",
|
"RX Status",
|
||||||
"RX Sensitivity",
|
"RX Sensitivity",
|
||||||
@ -338,7 +335,9 @@ def handle_syrlinks_rx_registers_dataset(printer: FsfwTmTcPrinter, hk_data: byte
|
|||||||
validity_buffer = hk_data[22:]
|
validity_buffer = hk_data[22:]
|
||||||
for header, content in zip(header_list, content_list):
|
for header, content in zip(header_list, content_list):
|
||||||
pw.dlog(f"{header}: {content}")
|
pw.dlog(f"{header}: {content}")
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(validity_buffer=validity_buffer, num_vars=8)
|
||||||
|
)
|
||||||
pw.dlog(f"Carrier Detect: {carrier_detect}")
|
pw.dlog(f"Carrier Detect: {carrier_detect}")
|
||||||
pw.dlog(f"Carrier Lock: {carrier_lock}")
|
pw.dlog(f"Carrier Lock: {carrier_lock}")
|
||||||
pw.dlog(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
pw.dlog(f"Data Lock (data clock recovery loop lock status): {data_lock}")
|
||||||
@ -372,10 +371,9 @@ WAVEFORM_STRINGS = ["OFF", "CW", "QPSK", "0QPSK", "PCM/PM", "PSK/PM", "BPSK"]
|
|||||||
|
|
||||||
|
|
||||||
def handle_syrlinks_tx_registers_dataset(
|
def handle_syrlinks_tx_registers_dataset(
|
||||||
printer: FsfwTmTcPrinter,
|
pw: PrintWrapper,
|
||||||
hk_data: bytes,
|
hk_data: bytes,
|
||||||
):
|
):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
header_list = ["TX Status Raw", "TX Waveform", "TX AGC value"]
|
header_list = ["TX Status Raw", "TX Waveform", "TX AGC value"]
|
||||||
tx_status = hk_data[0]
|
tx_status = hk_data[0]
|
||||||
"""
|
"""
|
||||||
@ -412,7 +410,9 @@ def handle_syrlinks_tx_registers_dataset(
|
|||||||
validity_buffer = hk_data[4:]
|
validity_buffer = hk_data[4:]
|
||||||
for header, content in zip(header_list, content_list):
|
for header, content in zip(header_list, content_list):
|
||||||
pw.dlog(f"{header}: {content}")
|
pw.dlog(f"{header}: {content}")
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=3)
|
pw.dlog(
|
||||||
|
FsfwTmTcPrinter.get_validity_buffer(validity_buffer=validity_buffer, num_vars=3)
|
||||||
|
)
|
||||||
# pw.dlog(f"TX CONV: {tx_conv!r}")
|
# pw.dlog(f"TX CONV: {tx_conv!r}")
|
||||||
# pw.dlog(f"TX DIFF (differential encoder enable): {tx_diff_encoder_enable}")
|
# pw.dlog(f"TX DIFF (differential encoder enable): {tx_diff_encoder_enable}")
|
||||||
pw.dlog(f"TX Status: {tx_status_status!r}")
|
pw.dlog(f"TX Status: {tx_status_status!r}")
|
||||||
|
@ -19,7 +19,7 @@ from tmtccmd.tc.pus_20_fsfw_param import (
|
|||||||
)
|
)
|
||||||
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
from tmtccmd.config.tmtc import OpCodeEntry, tmtc_definitions_provider
|
||||||
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
from eive_tmtc.config.object_ids import CORE_CONTROLLER_ID
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -212,7 +212,9 @@ def add_core_controller_definitions(defs: TmtcDefinitionWrapper):
|
|||||||
defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
|
defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
|
||||||
|
|
||||||
|
|
||||||
def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
def pack_core_commands( # noqa C901
|
||||||
|
q: DefaultPusQueueHelper, op_code: str
|
||||||
|
): # noqa: C901 , complexity okay here
|
||||||
if op_code == OpCode.ANNOUNCE_VERSION:
|
if op_code == OpCode.ANNOUNCE_VERSION:
|
||||||
q.add_log_cmd(f"{Info.ANNOUNCE_VERSION}")
|
q.add_log_cmd(f"{Info.ANNOUNCE_VERSION}")
|
||||||
q.add_pus_tc(create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_VERSION))
|
q.add_pus_tc(create_action_cmd(CORE_CONTROLLER_ID, ActionId.ANNOUNCE_VERSION))
|
||||||
@ -251,15 +253,7 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
|||||||
int(input("Specify systemctl command type by key: "))
|
int(input("Specify systemctl command type by key: "))
|
||||||
)
|
)
|
||||||
unit_name = input("Specify unit name: ")
|
unit_name = input("Specify unit name: ")
|
||||||
cmd_data = bytearray([systemctl_cmd])
|
q.add_pus_tc(create_systemctl_cmd(systemctl_cmd, unit_name))
|
||||||
cmd_data.extend(unit_name.encode())
|
|
||||||
q.add_pus_tc(
|
|
||||||
create_action_cmd(
|
|
||||||
object_id=CORE_CONTROLLER_ID,
|
|
||||||
action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR,
|
|
||||||
user_data=cmd_data,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING:
|
elif op_code == OpCode.EXECUTE_SHELL_CMD_BLOCKING:
|
||||||
custom_cmd = input("Please specify command to execute: ")
|
custom_cmd = input("Please specify command to execute: ")
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(
|
||||||
@ -458,6 +452,16 @@ def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def create_systemctl_cmd(systemctl_cmd: SystemctlCmd, unit_name: str):
|
||||||
|
cmd_data = bytearray([systemctl_cmd])
|
||||||
|
cmd_data.extend(unit_name.encode())
|
||||||
|
return create_action_cmd(
|
||||||
|
object_id=CORE_CONTROLLER_ID,
|
||||||
|
action_id=ActionId.SYSTEMCTL_CMD_EXECUTOR,
|
||||||
|
user_data=cmd_data,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def list_directory_base_user_data() -> bytearray:
|
def list_directory_base_user_data() -> bytearray:
|
||||||
all_opt = int(input("Use all (-a) option (0/1) ?: "))
|
all_opt = int(input("Use all (-a) option (0/1) ?: "))
|
||||||
if all_opt not in [0, 1]:
|
if all_opt not in [0, 1]:
|
||||||
@ -579,9 +583,8 @@ def create_xsc_reboot_cmds(
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_core_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
if set_id == SetId.HK:
|
if set_id == SetId.HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
fmt_str = "!fff"
|
fmt_str = "!fff"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(temperature, ps_voltage, pl_voltage) = struct.unpack(
|
(temperature, ps_voltage, pl_voltage) = struct.unpack(
|
||||||
@ -592,13 +595,14 @@ def handle_core_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
f"PL Voltage [mV] {pl_voltage}"
|
f"PL Voltage [mV] {pl_voltage}"
|
||||||
)
|
)
|
||||||
pw.dlog(printout)
|
pw.dlog(printout)
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=3)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[inc_len:], num_vars=3
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_core_ctrl_action_replies(
|
def handle_core_ctrl_action_replies(
|
||||||
action_id: int, printer: FsfwTmTcPrinter, custom_data: bytes
|
action_id: int, pw: PrintWrapper, custom_data: bytes
|
||||||
):
|
):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
if action_id == ActionId.LIST_DIR_DUMP_DIRECTLY:
|
if action_id == ActionId.LIST_DIR_DUMP_DIRECTLY:
|
||||||
if len(custom_data) < 4:
|
if len(custom_data) < 4:
|
||||||
_LOGGER.warning("Data unexpectedly small")
|
_LOGGER.warning("Data unexpectedly small")
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import struct
|
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.tmtc.obj_prompt import prompt_object
|
from eive_tmtc.tmtc.obj_prompt import prompt_object
|
||||||
from spacepackets.ecss import PusTelecommand
|
from spacepackets.ecss import PusTelecommand
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
from eive_tmtc.config.object_ids import (
|
from eive_tmtc.config.object_ids import (
|
||||||
ACS_SUBSYSTEM_ID,
|
ACS_SUBSYSTEM_ID,
|
||||||
ACS_CONTROLLER,
|
|
||||||
IMTQ_HANDLER_ID,
|
IMTQ_HANDLER_ID,
|
||||||
GPS_0_HEALTH_DEV,
|
GPS_0_HEALTH_DEV,
|
||||||
GPS_1_HEALTH_DEV,
|
|
||||||
GYRO_0_ADIS_HANDLER_ID,
|
GYRO_0_ADIS_HANDLER_ID,
|
||||||
GYRO_1_L3G_HANDLER_ID,
|
GYRO_1_L3G_HANDLER_ID,
|
||||||
ACS_BOARD_ASS_ID,
|
ACS_BOARD_ASS_ID,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@file ploc_memory_dumper.py
|
@file ploc_memory_dumper.py
|
||||||
@brief This file implements the command to dump memory sectors of the PLOC. Memories of the PLOC which can be dumped
|
@brief This file implements the command to dump memory sectors of the PLOC. Memories of the PLOC
|
||||||
are one MRAM, two flash memories and the SRAM.
|
which can be dumped are one MRAM, two flash memories and the SRAM.
|
||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 31.08.2021
|
@date 31.08.2021
|
||||||
"""
|
"""
|
||||||
|
@ -6,12 +6,14 @@
|
|||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 06.03.2021
|
@date 06.03.2021
|
||||||
"""
|
"""
|
||||||
|
import dataclasses
|
||||||
import logging
|
import logging
|
||||||
import struct
|
import struct
|
||||||
import enum
|
import enum
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID
|
from eive_tmtc.config.object_ids import get_object_ids, PLOC_MPSOC_ID
|
||||||
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from tmtccmd.config.tmtc import (
|
from tmtccmd.config.tmtc import (
|
||||||
tmtc_definitions_provider,
|
tmtc_definitions_provider,
|
||||||
OpCodeEntry,
|
OpCodeEntry,
|
||||||
@ -22,38 +24,53 @@ from tmtccmd.tc import service_provider
|
|||||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||||
from eive_tmtc.utility.input_helper import InputHelper
|
from eive_tmtc.utility.input_helper import InputHelper
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||||
|
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
MANUAL_INPUT = "1"
|
MANUAL_INPUT = "1"
|
||||||
|
|
||||||
flash_write_file_dict = {
|
OBC_WRITE_FILE_DICT = {
|
||||||
MANUAL_INPUT: ["manual input", ""],
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": ["/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"],
|
"2": ("/mnt/sd0/ploc/mpsoc/flash_write.bin", "/mnt/sd0/ploc/mpsoc/flash_write.bin"),
|
||||||
}
|
}
|
||||||
|
|
||||||
mpsoc_file_dict = {
|
OBC_READ_FILE_DICT = {
|
||||||
MANUAL_INPUT: ["manual input", ""],
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": ["0:/flash", "0:/flash"],
|
"2": ("/mnt/sd0/ploc/mpsoc/flash_read.bin", "/mnt/sd0/ploc/mpsoc/flash_read.bin"),
|
||||||
|
}
|
||||||
|
|
||||||
|
MPSOC_WRITE_FILE_DICT = {
|
||||||
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
|
"2": ("0:/", "0:/"),
|
||||||
|
}
|
||||||
|
|
||||||
|
MPSOC_READ_FILE_DICT = {
|
||||||
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
|
"2": ("0:/PICA", "0:/PICA"),
|
||||||
}
|
}
|
||||||
|
|
||||||
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
|
SEQ_FILE_NAMES = ["0:/EM16/231", "0:/EQ04/E-75", "0:/EQ01/E130"]
|
||||||
SEQ_FILE_DICT = {
|
SEQ_FILE_DICT = {
|
||||||
MANUAL_INPUT: ["manual input", ""],
|
MANUAL_INPUT: ("manual input", ""),
|
||||||
"2": [f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"],
|
"2": (f"16QRM On Carrier 200 MBd ({SEQ_FILE_NAMES[0]})", f"{SEQ_FILE_NAMES[0]}"),
|
||||||
"3": [f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"],
|
"3": (f"QPSK On Carrier 780 MBd ({SEQ_FILE_NAMES[1]})", f"{SEQ_FILE_NAMES[1]}"),
|
||||||
"4": [f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"],
|
"4": (f"Maximum Bandwidth QPSK ({SEQ_FILE_NAMES[2]})", f"{SEQ_FILE_NAMES[2]}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CARRIAGE_RETURN = 0xD
|
CARRIAGE_RETURN = 0xD
|
||||||
|
|
||||||
|
|
||||||
class CommandId(enum.IntEnum):
|
class SetId(enum.IntEnum):
|
||||||
|
HK_ID = 0
|
||||||
|
|
||||||
|
|
||||||
|
class ActionId(enum.IntEnum):
|
||||||
TC_MEM_WRITE = 1
|
TC_MEM_WRITE = 1
|
||||||
TC_MEM_READ = 2
|
TC_MEM_READ = 2
|
||||||
FLASH_WRITE = 9
|
TM_MEM_READ_RPT = 6
|
||||||
|
TC_FLASH_WRITE_FULL_FILE = 9
|
||||||
TC_FLASH_DELETE = 10
|
TC_FLASH_DELETE = 10
|
||||||
TC_REPLAY_START = 11
|
TC_REPLAY_START = 11
|
||||||
TC_REPLAY_STOP = 12
|
TC_REPLAY_STOP = 12
|
||||||
@ -64,28 +81,40 @@ class CommandId(enum.IntEnum):
|
|||||||
TC_MODE_REPLAY = 16
|
TC_MODE_REPLAY = 16
|
||||||
TC_CAM_CMD_SEND = 17
|
TC_CAM_CMD_SEND = 17
|
||||||
TC_MODE_IDLE = 18
|
TC_MODE_IDLE = 18
|
||||||
|
TM_CAM_CMD_RPT = 19
|
||||||
SET_UART_TX_TRISTATE = 20
|
SET_UART_TX_TRISTATE = 20
|
||||||
RELEASE_UART_TX = 21
|
RELEASE_UART_TX = 21
|
||||||
TC_CAM_TAKE_PIC = 22
|
TC_CAM_TAKE_PIC = 22
|
||||||
TC_SIMPLEX_SEND_FILE = 23
|
TC_SIMPLEX_SEND_FILE = 23
|
||||||
TC_DOWNLINK_DATA_MODULATE = 24
|
TC_DOWNLINK_DATA_MODULATE = 24
|
||||||
TC_MODE_SNAPSHOT = 25
|
TC_MODE_SNAPSHOT = 25
|
||||||
|
TC_FLASH_DIR_GET_CONTENT = 28
|
||||||
|
TM_FLASH_DIRECTORY_CONTENT = 29
|
||||||
|
TC_FLASH_READ_FULL_FILE = 30
|
||||||
|
|
||||||
|
|
||||||
class OpCode:
|
class OpCode:
|
||||||
ON = ["on"]
|
ON = "on"
|
||||||
OFF = ["off"]
|
OFF = "off"
|
||||||
NORMAL = ["normal"]
|
NORMAL = "normal"
|
||||||
VERIFY_BOOT = ["verify_boot"]
|
VERIFY_BOOT = "verify_boot"
|
||||||
MODE_REPLAY = ["mode_replay"]
|
MODE_REPLAY = "mode_replay"
|
||||||
MODE_IDLE = ["mode_idle"]
|
MODE_IDLE = "mode_idle"
|
||||||
REPLAY_WRITE_SEQ = ["replay_write"]
|
REPLAY_WRITE_SEQ = "replay_write"
|
||||||
DOWNLINK_PWR_ON = ["downlink_pwr_on"]
|
DOWNLINK_PWR_ON = "downlink_pwr_on"
|
||||||
REPLAY_START = ["replay_start"]
|
MEM_WRITE = "memory_write"
|
||||||
CAM_TAKE_PIC = ["cam_take_pic"]
|
MEM_READ = "memory_read"
|
||||||
SIMPLEX_SEND_FILE = ["simplex_send_file"]
|
DOWNLINK_PWR_OFF = "downlink_pwr_off"
|
||||||
DOWNLINK_DATA_MODULATE = ["downlink_data_modulate"]
|
FLASH_WRITE_FILE = "flash_write_file"
|
||||||
MODE_SNAPSHOT = ["mode_snapshot"]
|
FLASH_READ_FILE = "flash_read_file"
|
||||||
|
FLASH_DELETE_FILE = "flash_delete_file"
|
||||||
|
FLASH_GET_DIR_CONTENT = "flash_get_dir_content"
|
||||||
|
REPLAY_STOP = "replay_stop"
|
||||||
|
REPLAY_START = "replay_start"
|
||||||
|
CAM_TAKE_PIC = "cam_take_pic"
|
||||||
|
SIMPLEX_SEND_FILE = "simplex_send_file"
|
||||||
|
DOWNLINK_DATA_MODULATE = "downlink_data_modulate"
|
||||||
|
MODE_SNAPSHOT = "mode_snapshot"
|
||||||
|
|
||||||
|
|
||||||
class Info:
|
class Info:
|
||||||
@ -94,12 +123,18 @@ class Info:
|
|||||||
NORMAL = "Normal"
|
NORMAL = "Normal"
|
||||||
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
VERIFY_BOOT = "Verify boot by reading 0xdeadbeef from DEADBEEF address"
|
||||||
MODE_REPLAY = "Switch to REPLAY mode"
|
MODE_REPLAY = "Switch to REPLAY mode"
|
||||||
|
REPLAY_STOP = "Stop Replay"
|
||||||
MODE_IDLE = "Switch to IDLE mode"
|
MODE_IDLE = "Switch to IDLE mode"
|
||||||
REPLAY_WRITE_SEQ = "Replay write sequence"
|
REPLAY_WRITE_SEQ = "Replay write sequence"
|
||||||
DOWNLINK_PWR_ON = "Downlink Power On"
|
DOWNLINK_PWR_ON = "Downlink Power On"
|
||||||
|
DOWNLINK_PWR_OFF = "Downlink Power Off"
|
||||||
REPLAY_START = "Replay Start"
|
REPLAY_START = "Replay Start"
|
||||||
CAM_TAKE_PIC = "Cam Take Picture"
|
CAM_TAKE_PIC = "Cam Take Picture"
|
||||||
SIMPLEX_SEND_FILE = "Simplex Send File"
|
SIMPLEX_SEND_FILE = "Simplex Send File"
|
||||||
|
FLASH_READ_FILE = "Copy file from MPSoC to OBC"
|
||||||
|
FLASH_WRITE_FILE = "Copy file from OBC to MPSoC"
|
||||||
|
FLASH_DELETE_FILE = "Delete file on MPSoC"
|
||||||
|
FLASH_GET_DIR_CONTENT = "Get flash directory content on MPSoC"
|
||||||
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
|
DOWNLINK_DATA_MODULATE = "Downlink data modulate"
|
||||||
MODE_SNAPSHOT = "Mode Snapshot"
|
MODE_SNAPSHOT = "Mode Snapshot"
|
||||||
|
|
||||||
@ -108,28 +143,25 @@ class MemAddresses(enum.IntEnum):
|
|||||||
DEADBEEF = 0x40000004
|
DEADBEEF = 0x40000004
|
||||||
|
|
||||||
|
|
||||||
class PlocReplyIds(enum.IntEnum):
|
|
||||||
TM_MEM_READ_RPT = 6
|
|
||||||
TM_CAM_CMD_RPT = 19
|
|
||||||
|
|
||||||
|
|
||||||
@tmtc_definitions_provider
|
@tmtc_definitions_provider
|
||||||
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
||||||
oce = OpCodeEntry()
|
oce = OpCodeEntry()
|
||||||
oce.add(OpCode.OFF, Info.OFF)
|
oce.add(OpCode.OFF, Info.OFF)
|
||||||
oce.add(OpCode.ON, Info.ON)
|
oce.add(OpCode.ON, Info.ON)
|
||||||
oce.add(OpCode.NORMAL, Info.NORMAL)
|
oce.add(OpCode.NORMAL, Info.NORMAL)
|
||||||
oce.add("3", "Ploc MPSoC: Memory write")
|
oce.add(OpCode.MEM_WRITE, "Ploc MPSoC: Memory write")
|
||||||
oce.add("4", "Ploc MPSoC: Memory read")
|
oce.add(OpCode.MEM_READ, "Ploc MPSoC: Memory read")
|
||||||
oce.add("5", "Ploc MPSoC: Flash write")
|
oce.add(OpCode.FLASH_WRITE_FILE, Info.FLASH_WRITE_FILE)
|
||||||
oce.add("6", "Ploc MPSoC: Flash delete")
|
oce.add(OpCode.FLASH_READ_FILE, Info.FLASH_READ_FILE)
|
||||||
|
oce.add(OpCode.FLASH_DELETE_FILE, Info.FLASH_DELETE_FILE)
|
||||||
|
oce.add(OpCode.FLASH_GET_DIR_CONTENT, Info.FLASH_GET_DIR_CONTENT)
|
||||||
oce.add(OpCode.REPLAY_START, Info.REPLAY_START)
|
oce.add(OpCode.REPLAY_START, Info.REPLAY_START)
|
||||||
oce.add("8", "Ploc MPSoC: Replay stop")
|
oce.add(OpCode.REPLAY_STOP, Info.REPLAY_STOP)
|
||||||
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
|
oce.add(OpCode.DOWNLINK_PWR_ON, Info.DOWNLINK_PWR_ON)
|
||||||
oce.add("10", "Ploc MPSoC: Downlink pwr off")
|
oce.add(OpCode.DOWNLINK_PWR_OFF, Info.DOWNLINK_PWR_OFF)
|
||||||
oce.add(OpCode.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
|
oce.add(OpCode.REPLAY_WRITE_SEQ, Info.REPLAY_WRITE_SEQ)
|
||||||
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
oce.add("12", "Ploc MPSoC: OBSW reset sequence count")
|
||||||
oce.add(OpCode.VERIFY_BOOT, "Ploc MPSoC: Read DEADBEEF address")
|
oce.add(OpCode.VERIFY_BOOT, Info.VERIFY_BOOT)
|
||||||
oce.add(OpCode.MODE_REPLAY, Info.MODE_REPLAY)
|
oce.add(OpCode.MODE_REPLAY, Info.MODE_REPLAY)
|
||||||
oce.add(OpCode.MODE_IDLE, Info.MODE_IDLE)
|
oce.add(OpCode.MODE_IDLE, Info.MODE_IDLE)
|
||||||
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
oce.add("16", "Ploc MPSoC: Tc cam command send")
|
||||||
@ -143,7 +175,9 @@ def add_ploc_mpsoc_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
|
|
||||||
|
|
||||||
@service_provider(CustomServiceList.PLOC_MPSOC)
|
@service_provider(CustomServiceList.PLOC_MPSOC)
|
||||||
def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
def pack_ploc_mpsoc_commands( # noqa C901
|
||||||
|
p: ServiceProviderParams,
|
||||||
|
): # noqa C901: Complexity okay here.
|
||||||
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
object_id = get_object_ids().get(PLOC_MPSOC_ID)
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
prefix = "PLOC MPSoC"
|
prefix = "PLOC MPSoC"
|
||||||
@ -152,19 +186,19 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
f"Generate command for PLOC MPSoC with object id: {object_id.as_hex_string}"
|
||||||
)
|
)
|
||||||
obyt = object_id.as_bytes
|
obyt = object_id.as_bytes
|
||||||
if op_code in OpCode.OFF:
|
if op_code == OpCode.OFF:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
q.add_log_cmd(f"{prefix}: {Info.OFF}")
|
||||||
command = pack_mode_data(obyt, Mode.OFF, 0)
|
command = pack_mode_data(obyt, Mode.OFF, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))
|
||||||
if op_code in OpCode.ON:
|
if op_code == OpCode.ON:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
q.add_log_cmd(f"{prefix}: {Info.ON}")
|
||||||
data = pack_mode_data(obyt, Mode.ON, 0)
|
data = pack_mode_data(obyt, Mode.ON, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||||
if op_code in OpCode.NORMAL:
|
if op_code == OpCode.NORMAL:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
|
q.add_log_cmd(f"{prefix}: {Info.NORMAL}")
|
||||||
data = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
data = pack_mode_data(object_id.as_bytes, Mode.NORMAL, 0)
|
||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=data))
|
||||||
if op_code == "3":
|
if op_code == OpCode.MEM_WRITE:
|
||||||
q.add_log_cmd("PLOC MPSoC: TC mem write test")
|
q.add_log_cmd("PLOC MPSoC: TC mem write test")
|
||||||
memory_address = int(
|
memory_address = int(
|
||||||
input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16
|
input("PLOC MPSoC: Tc Mem Write: Type memory address: 0x"), 16
|
||||||
@ -180,11 +214,15 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
q.add_log_cmd("PLOC MPSoC: TC mem read test")
|
q.add_log_cmd("PLOC MPSoC: TC mem read test")
|
||||||
data = prepare_mem_read_command(object_id=object_id.as_bytes)
|
data = prepare_mem_read_command(object_id=object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "5":
|
if op_code == OpCode.FLASH_WRITE_FILE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Flash write")
|
q.add_log_cmd(f"{prefix}: {Info.FLASH_WRITE_FILE}")
|
||||||
data = prepare_flash_write_cmd(object_id.as_bytes)
|
data = prepare_flash_write_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "6":
|
if op_code == OpCode.FLASH_READ_FILE:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.FLASH_READ_FILE}")
|
||||||
|
data = prepare_flash_read_cmd(object_id.as_bytes)
|
||||||
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
if op_code == OpCode.FLASH_DELETE_FILE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Flash delete")
|
q.add_log_cmd("PLOC MPSoC: Flash delete")
|
||||||
data = prepare_flash_delete_cmd(object_id.as_bytes)
|
data = prepare_flash_delete_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
@ -192,76 +230,88 @@ def pack_ploc_mpsoc_commands(p: ServiceProviderParams):
|
|||||||
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
|
q.add_log_cmd(f"{prefix}: {Info.REPLAY_START}")
|
||||||
data = prepare_replay_start_cmd(object_id.as_bytes)
|
data = prepare_replay_start_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "8":
|
if op_code == OpCode.REPLAY_STOP:
|
||||||
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
q.add_log_cmd("PLOC MPSoC: Replay stop")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_REPLAY_STOP)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_REPLAY_STOP)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.DOWNLINK_PWR_ON:
|
if op_code == OpCode.DOWNLINK_PWR_ON:
|
||||||
q.add_log_cmd(f"{prefix}: {OpCode.DOWNLINK_PWR_ON}")
|
q.add_log_cmd(f"{prefix}: {OpCode.DOWNLINK_PWR_ON}")
|
||||||
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
|
data = prepare_downlink_pwr_on_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "10":
|
if op_code == OpCode.DOWNLINK_PWR_OFF:
|
||||||
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
q.add_log_cmd("PLOC MPSoC: Downlink pwr off")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_DOWNLINK_PWR_OFF)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_DOWNLINK_PWR_OFF)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.REPLAY_WRITE_SEQ:
|
if op_code == OpCode.FLASH_GET_DIR_CONTENT:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.FLASH_GET_DIR_CONTENT}")
|
||||||
|
dir_name = input("Please specify MPSoC directory name to get information for: ")
|
||||||
|
dir_name = bytearray(dir_name.encode("utf-8"))
|
||||||
|
dir_name.append(0)
|
||||||
|
q.add_pus_tc(
|
||||||
|
create_action_cmd(
|
||||||
|
object_id=object_id.as_bytes,
|
||||||
|
action_id=ActionId.TC_FLASH_DIR_GET_CONTENT,
|
||||||
|
user_data=dir_name,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if op_code == OpCode.REPLAY_WRITE_SEQ:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
|
q.add_log_cmd(f"{prefix}: {Info.REPLAY_WRITE_SEQ}")
|
||||||
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
|
data = prepare_replay_write_sequence_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "12":
|
if op_code == "12":
|
||||||
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
q.add_log_cmd("PLOC MPSoC: Reset OBSW sequence count")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.OBSW_RESET_SEQ_COUNT)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.OBSW_RESET_SEQ_COUNT)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.VERIFY_BOOT:
|
if op_code == OpCode.VERIFY_BOOT:
|
||||||
num_words = 1
|
num_words = 1
|
||||||
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
q.add_log_cmd(f"{prefix} {Info.VERIFY_BOOT}")
|
||||||
data = (
|
data = (
|
||||||
object_id.as_bytes
|
object_id.as_bytes
|
||||||
+ struct.pack("!I", CommandId.TC_MEM_READ)
|
+ struct.pack("!I", ActionId.TC_MEM_READ)
|
||||||
+ struct.pack("!I", MemAddresses.DEADBEEF)
|
+ struct.pack("!I", MemAddresses.DEADBEEF)
|
||||||
+ struct.pack("!H", num_words)
|
+ struct.pack("!H", num_words)
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.MODE_REPLAY:
|
if op_code == OpCode.MODE_REPLAY:
|
||||||
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
q.add_log_cmd("PLOC MPSoC: Tc mode replay")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_REPLAY)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_REPLAY)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.MODE_IDLE:
|
if op_code == OpCode.MODE_IDLE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
q.add_log_cmd("PLOC MPSoC: Tc mode idle")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_IDLE)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_IDLE)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "16":
|
if op_code == "16":
|
||||||
q.add_log_cmd("PLOC MPSoC: Tc cam command send")
|
q.add_log_cmd("PLOC MPSoC: Tc cam command send")
|
||||||
cam_cmd = input("Specify cam command string: ")
|
cam_cmd = input("Specify cam command string: ")
|
||||||
data = (
|
data = (
|
||||||
object_id.as_bytes
|
object_id.as_bytes
|
||||||
+ struct.pack("!I", CommandId.TC_CAM_CMD_SEND)
|
+ struct.pack("!I", ActionId.TC_CAM_CMD_SEND)
|
||||||
+ bytearray(cam_cmd, "utf-8")
|
+ bytearray(cam_cmd, "utf-8")
|
||||||
)
|
)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "17":
|
if op_code == "17":
|
||||||
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
q.add_log_cmd("PLOC MPSoC: Set UART TX tristate")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.SET_UART_TX_TRISTATE)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.SET_UART_TX_TRISTATE)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code == "18":
|
if op_code == "18":
|
||||||
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
q.add_log_cmd("PLOC MPSoC: Release UART TX")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.RELEASE_UART_TX)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.RELEASE_UART_TX)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.CAM_TAKE_PIC:
|
if op_code == OpCode.CAM_TAKE_PIC:
|
||||||
q.add_log_cmd("PLOC MPSoC: Cam take picture")
|
q.add_log_cmd("PLOC MPSoC: Cam take picture")
|
||||||
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
|
data = prepare_cam_take_pic_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.SIMPLEX_SEND_FILE:
|
if op_code == OpCode.SIMPLEX_SEND_FILE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Simplex send file")
|
q.add_log_cmd("PLOC MPSoC: Simplex send file")
|
||||||
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
|
data = prepare_simplex_send_file_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.DOWNLINK_DATA_MODULATE:
|
if op_code == OpCode.DOWNLINK_DATA_MODULATE:
|
||||||
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
q.add_log_cmd("PLOC MPSoC: Downlink data modulate")
|
||||||
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
data = prepare_downlink_data_modulate_cmd(object_id.as_bytes)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
if op_code in OpCode.MODE_SNAPSHOT:
|
if op_code == OpCode.MODE_SNAPSHOT:
|
||||||
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
|
q.add_log_cmd("PLOC MPSoC: Mode snapshot")
|
||||||
data = object_id.as_bytes + struct.pack("!I", CommandId.TC_MODE_SNAPSHOT)
|
data = object_id.as_bytes + struct.pack("!I", ActionId.TC_MODE_SNAPSHOT)
|
||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
|
||||||
|
|
||||||
|
|
||||||
@ -278,7 +328,7 @@ def generate_write_mem_command(
|
|||||||
"""
|
"""
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_MEM_WRITE)
|
+ struct.pack("!I", ActionId.TC_MEM_WRITE)
|
||||||
+ struct.pack("!I", memory_address)
|
+ struct.pack("!I", memory_address)
|
||||||
+ struct.pack("!H", mem_len)
|
+ struct.pack("!H", mem_len)
|
||||||
+ struct.pack("!I", memory_data)
|
+ struct.pack("!I", memory_data)
|
||||||
@ -291,31 +341,48 @@ def prepare_mem_read_command(object_id: bytes) -> bytearray:
|
|||||||
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
|
num_words = int(input("PLOC MPSoC specify number of words (32-bit) to read: "))
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_MEM_READ)
|
+ struct.pack("!I", ActionId.TC_MEM_READ)
|
||||||
+ struct.pack("!I", memory_address)
|
+ struct.pack("!I", memory_address)
|
||||||
+ struct.pack("!H", num_words)
|
+ struct.pack("!H", num_words)
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_flash_base_cmd(
|
||||||
|
obc_filename: str, mpsoc_filename: str, action_id: int, object_id: bytes
|
||||||
|
) -> bytearray:
|
||||||
|
command = bytearray(object_id)
|
||||||
|
command.extend(struct.pack("!I", action_id))
|
||||||
|
command.extend(obc_filename.encode("utf-8"))
|
||||||
|
command.append(0)
|
||||||
|
command.extend(mpsoc_filename.encode("utf-8"))
|
||||||
|
command.append(0)
|
||||||
|
return command
|
||||||
|
|
||||||
|
|
||||||
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
def prepare_flash_write_cmd(object_id: bytes) -> bytearray:
|
||||||
obc_file = get_obc_file()
|
obc_file = get_obc_file(OBC_WRITE_FILE_DICT)
|
||||||
mpsoc_file = get_mpsoc_file()
|
mpsoc_file = get_mpsoc_file(MPSOC_WRITE_FILE_DICT)
|
||||||
command = (
|
return prepare_flash_base_cmd(
|
||||||
object_id
|
obc_file, mpsoc_file, ActionId.TC_FLASH_WRITE_FULL_FILE, object_id
|
||||||
+ struct.pack("!I", CommandId.FLASH_WRITE)
|
|
||||||
+ bytearray(obc_file, "utf-8")
|
|
||||||
+ bytearray(mpsoc_file, "utf-8")
|
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
|
||||||
|
|
||||||
|
def prepare_flash_read_cmd(object_id: bytes) -> bytearray:
|
||||||
|
mpsoc_file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
|
||||||
|
obc_file = get_obc_file(OBC_READ_FILE_DICT)
|
||||||
|
cmd = prepare_flash_base_cmd(
|
||||||
|
obc_file, mpsoc_file, ActionId.TC_FLASH_READ_FULL_FILE, object_id
|
||||||
|
)
|
||||||
|
file_size = get_mpsoc_file_size()
|
||||||
|
cmd.extend(struct.pack("!I", file_size))
|
||||||
|
return cmd
|
||||||
|
|
||||||
|
|
||||||
def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
|
def prepare_flash_delete_cmd(object_id: bytes) -> bytearray:
|
||||||
file = get_mpsoc_file()
|
file = get_mpsoc_file(MPSOC_READ_FILE_DICT)
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id + struct.pack("!I", ActionId.TC_FLASH_DELETE) + file.encode("utf-8")
|
||||||
+ struct.pack("!I", CommandId.TC_FLASH_DELETE)
|
|
||||||
+ bytearray(file, "utf-8")
|
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
@ -324,7 +391,7 @@ def prepare_replay_start_cmd(object_id: bytes) -> bytearray:
|
|||||||
replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
|
replay = int(input("Specify replay mode (0 - once, 1 - repeated): "))
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_REPLAY_START)
|
+ struct.pack("!I", ActionId.TC_REPLAY_START)
|
||||||
+ struct.pack("!B", replay)
|
+ struct.pack("!B", replay)
|
||||||
)
|
)
|
||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
@ -335,7 +402,7 @@ def prepare_downlink_pwr_on_cmd(object_id: bytes) -> bytearray:
|
|||||||
lane_rate = int(input("Specify lane rate (0 - 9): "))
|
lane_rate = int(input("Specify lane rate (0 - 9): "))
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_DOWNLINK_PWR_ON)
|
+ struct.pack("!I", ActionId.TC_DOWNLINK_PWR_ON)
|
||||||
+ struct.pack("!B", mode)
|
+ struct.pack("!B", mode)
|
||||||
+ struct.pack("!B", lane_rate)
|
+ struct.pack("!B", lane_rate)
|
||||||
)
|
)
|
||||||
@ -347,7 +414,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
|||||||
file = get_sequence_file()
|
file = get_sequence_file()
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_REPLAY_WRITE_SEQUENCE)
|
+ struct.pack("!I", ActionId.TC_REPLAY_WRITE_SEQUENCE)
|
||||||
+ struct.pack("!B", use_decoding)
|
+ struct.pack("!B", use_decoding)
|
||||||
+ bytearray(file, "utf-8")
|
+ bytearray(file, "utf-8")
|
||||||
# + bytes([0])
|
# + bytes([0])
|
||||||
@ -357,7 +424,7 @@ def prepare_replay_write_sequence_cmd(object_id: bytes) -> bytearray:
|
|||||||
|
|
||||||
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
||||||
selection = input("Use default parameter? (Y/N): ")
|
selection = input("Use default parameter? (Y/N): ")
|
||||||
if selection is "Y" or selection is "y":
|
if selection.lower() in ["y", "1", "yes"]:
|
||||||
filename = "0:/test"
|
filename = "0:/test"
|
||||||
encoder_setting_y = 7
|
encoder_setting_y = 7
|
||||||
quantization_y = 0
|
quantization_y = 0
|
||||||
@ -377,7 +444,7 @@ def prepare_cam_take_pic_cmd(object_id: bytes) -> bytearray:
|
|||||||
bypass_compressor = int(input("Specify bypassCompressor: "))
|
bypass_compressor = int(input("Specify bypassCompressor: "))
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_CAM_TAKE_PIC)
|
+ struct.pack("!I", ActionId.TC_CAM_TAKE_PIC)
|
||||||
+ bytearray(filename, "utf-8")
|
+ bytearray(filename, "utf-8")
|
||||||
+ bytes([0])
|
+ bytes([0])
|
||||||
+ struct.pack("!B", encoder_setting_y)
|
+ struct.pack("!B", encoder_setting_y)
|
||||||
@ -395,7 +462,7 @@ def prepare_simplex_send_file_cmd(object_id: bytes) -> bytearray:
|
|||||||
filename = input("Specify filename: ")
|
filename = input("Specify filename: ")
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_SIMPLEX_SEND_FILE)
|
+ struct.pack("!I", ActionId.TC_SIMPLEX_SEND_FILE)
|
||||||
+ bytearray(filename, "utf-8")
|
+ bytearray(filename, "utf-8")
|
||||||
+ bytes([0])
|
+ bytes([0])
|
||||||
)
|
)
|
||||||
@ -409,7 +476,7 @@ def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
|
|||||||
dest_mem_addr = int(input("Specify destMemAddr: "))
|
dest_mem_addr = int(input("Specify destMemAddr: "))
|
||||||
command = (
|
command = (
|
||||||
object_id
|
object_id
|
||||||
+ struct.pack("!I", CommandId.TC_DOWNLINK_DATA_MODULATE)
|
+ struct.pack("!I", ActionId.TC_DOWNLINK_DATA_MODULATE)
|
||||||
+ struct.pack("!B", format)
|
+ struct.pack("!B", format)
|
||||||
+ struct.pack("!I", src_mem_addr)
|
+ struct.pack("!I", src_mem_addr)
|
||||||
+ struct.pack("!H", src_mem_len)
|
+ struct.pack("!H", src_mem_len)
|
||||||
@ -418,28 +485,35 @@ def prepare_downlink_data_modulate_cmd(object_id: bytes) -> bytearray:
|
|||||||
return bytearray(command)
|
return bytearray(command)
|
||||||
|
|
||||||
|
|
||||||
def get_obc_file() -> str:
|
def get_obc_file(input_dict: dict) -> str:
|
||||||
_LOGGER.info("Specify OBC file ")
|
_LOGGER.info("Specify OBC filename")
|
||||||
input_helper = InputHelper(flash_write_file_dict)
|
input_helper = InputHelper(input_dict)
|
||||||
key = input_helper.get_key()
|
key = input_helper.get_key()
|
||||||
if key == MANUAL_INPUT:
|
if key == MANUAL_INPUT:
|
||||||
file = input("Ploc MPSoC: Specify absolute name of flash file: ")
|
file = input("Ploc MPSoC: Specify absolute name of flash file: ")
|
||||||
else:
|
else:
|
||||||
file = flash_write_file_dict[key][1]
|
file = input_dict[key][1]
|
||||||
return file
|
return file
|
||||||
|
|
||||||
|
|
||||||
def get_mpsoc_file() -> str:
|
def get_mpsoc_file(input_dict: dict) -> str:
|
||||||
_LOGGER.info("Specify MPSoC file")
|
_LOGGER.info("Specify MPSoC filename")
|
||||||
input_helper = InputHelper(mpsoc_file_dict)
|
input_helper = InputHelper(input_dict)
|
||||||
key = input_helper.get_key()
|
key = input_helper.get_key()
|
||||||
if key == MANUAL_INPUT:
|
if key == MANUAL_INPUT:
|
||||||
file = input("Ploc MPSoC: Specify absolute name file: ")
|
file = input("Ploc MPSoC: Specify absolute name file: ")
|
||||||
else:
|
else:
|
||||||
file = mpsoc_file_dict[key][1]
|
file = input_dict[key][1]
|
||||||
return file
|
return file
|
||||||
|
|
||||||
|
|
||||||
|
def get_mpsoc_file_size() -> int:
|
||||||
|
file_size = int(input("Specify MPSoC file size: "))
|
||||||
|
if file_size <= 0:
|
||||||
|
raise ValueError("Invalid file size")
|
||||||
|
return file_size
|
||||||
|
|
||||||
|
|
||||||
def get_sequence_file() -> str:
|
def get_sequence_file() -> str:
|
||||||
_LOGGER.info("Specify sequence file")
|
_LOGGER.info("Specify sequence file")
|
||||||
input_helper = InputHelper(SEQ_FILE_DICT)
|
input_helper = InputHelper(SEQ_FILE_DICT)
|
||||||
@ -449,3 +523,184 @@ def get_sequence_file() -> str:
|
|||||||
else:
|
else:
|
||||||
file = SEQ_FILE_DICT[key][1]
|
file = SEQ_FILE_DICT[key][1]
|
||||||
return file
|
return file
|
||||||
|
|
||||||
|
|
||||||
|
def handle_ploc_mpsoc_hk_data(pw: PrintWrapper, hk_data: bytes, set_id: int):
|
||||||
|
if set_id == SetId.HK_ID:
|
||||||
|
fmt_str = "!IBBBBBBB"
|
||||||
|
current_idx = 0
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(
|
||||||
|
status,
|
||||||
|
mode,
|
||||||
|
downlink_pwr_on,
|
||||||
|
downlink_reply_active,
|
||||||
|
downlink_jesd_sync_status,
|
||||||
|
downlink_dac_status,
|
||||||
|
cam_status,
|
||||||
|
cam_sdi_status,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
current_idx += inc_len
|
||||||
|
pw.ilog(_LOGGER, "Received MPSoC HK")
|
||||||
|
pw.dlog(f"Status: {status}")
|
||||||
|
pw.dlog(f"Mode: {mode}")
|
||||||
|
pw.dlog(f"Downlink Power On: {downlink_pwr_on}")
|
||||||
|
pw.dlog(f"Downlink Reply Active: {downlink_reply_active}")
|
||||||
|
pw.dlog(f"Downlink JESD Sync Status: {downlink_jesd_sync_status}")
|
||||||
|
pw.dlog(f"Downlink DAC Status: {downlink_dac_status}")
|
||||||
|
pw.dlog(f"CAM Status: {cam_status}")
|
||||||
|
pw.dlog(f"CAM SDI Status: {cam_sdi_status}")
|
||||||
|
|
||||||
|
fmt_str = "!fffffffff"
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(
|
||||||
|
cam_fpga_temp,
|
||||||
|
cam_soc_temp,
|
||||||
|
sysmon_temp,
|
||||||
|
sysmon_vcc_int,
|
||||||
|
sysmon_vcc_aux,
|
||||||
|
sysmon_vcc_bram,
|
||||||
|
sysmon_vcc_paux,
|
||||||
|
sysmon_vcc_pint,
|
||||||
|
sysmon_vcc_pdro,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
current_idx += inc_len
|
||||||
|
|
||||||
|
pw.dlog(f"CAM FPGA Temperature: {cam_fpga_temp}")
|
||||||
|
pw.dlog(f"CAM SoC Temperature: {cam_soc_temp}")
|
||||||
|
pw.dlog(f"System Monitor Temperature: {sysmon_temp}")
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON VCC INT {sysmon_vcc_int:.3f} | SYSMON VCC AUX {sysmon_vcc_aux:.3f} | "
|
||||||
|
f"SYSMON VCC BRAM {sysmon_vcc_bram:.3f}"
|
||||||
|
)
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON VCC PAUX {sysmon_vcc_paux:.3f} | SYSMON VCC PINT {sysmon_vcc_pint:.3f} | "
|
||||||
|
f"SYSMON VCC PDRO {sysmon_vcc_pdro:.3f}"
|
||||||
|
)
|
||||||
|
|
||||||
|
fmt_str = "!fffffffffffff"
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(
|
||||||
|
sysmon_mb_12v,
|
||||||
|
sysmon_mb_3v3,
|
||||||
|
sysmon_mb_1v8,
|
||||||
|
sysmon_vcc_12v,
|
||||||
|
sysmon_vcc_5v,
|
||||||
|
sysmon_vcc_3v3,
|
||||||
|
sysmon_vcc_3v3va,
|
||||||
|
sysmon_vcc_2v5ddr,
|
||||||
|
sysmon_vcc_1v2ddr,
|
||||||
|
sysmon_vcc_0v9,
|
||||||
|
sysmon_vcc_0v6vtt,
|
||||||
|
sysmon_safe_cotr_cur,
|
||||||
|
sysmon_nvm4_xo_cur,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
current_idx += inc_len
|
||||||
|
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON MB 12V {sysmon_mb_12v:.3f} | SYSMON MB 3V3 {sysmon_mb_3v3:.3f} | "
|
||||||
|
f"SYSMON MBA 1V8 {sysmon_mb_1v8:.3f}"
|
||||||
|
)
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON VCC 12V {sysmon_vcc_12v:.3f} | SYSMON VCC 5V {sysmon_vcc_5v:.3f} | "
|
||||||
|
f"SYSMON VCC 3V3 {sysmon_vcc_3v3:.3f} | SYSMON VCC 3V3VA {sysmon_vcc_3v3va}"
|
||||||
|
)
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON VCC 2V5DDR {sysmon_vcc_2v5ddr:.3f} | "
|
||||||
|
f"SYSMON VCC 1V2DDR {sysmon_vcc_1v2ddr:.3f} | "
|
||||||
|
f"SYSMON VCC 0V9 {sysmon_vcc_0v9:.3f} | "
|
||||||
|
f"SYSMON VCC 0V6VTT {sysmon_vcc_0v6vtt}"
|
||||||
|
)
|
||||||
|
pw.dlog(
|
||||||
|
f"SYSMON SAFE COTS CURR: {sysmon_safe_cotr_cur} | "
|
||||||
|
f"SYSMON NVM4XO CURR {sysmon_nvm4_xo_cur}"
|
||||||
|
)
|
||||||
|
fmt_str = "!HHBB"
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(
|
||||||
|
sem_uncorrectable_errs,
|
||||||
|
sem_correctable_errs,
|
||||||
|
sem_status,
|
||||||
|
reboot_mpsoc_required,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
|
||||||
|
pw.dlog(f"SEM IP Uncorrectable Errors: {sem_uncorrectable_errs}")
|
||||||
|
pw.dlog(f"SEM IP Correctable Errors: {sem_correctable_errs}")
|
||||||
|
pw.dlog(f"SEM IP Status: {sem_status}")
|
||||||
|
pw.dlog(f"Reboot MPSoC required: {reboot_mpsoc_required}")
|
||||||
|
else:
|
||||||
|
_LOGGER.warning(f"Unknown set ID {set_id} for MPSoC HK")
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@dataclasses.dataclass
|
||||||
|
class DirElement:
|
||||||
|
name: str
|
||||||
|
attr: int
|
||||||
|
size: int
|
||||||
|
|
||||||
|
|
||||||
|
def handle_mpsoc_data_reply(action_id: int, pw: PrintWrapper, custom_data: bytearray):
|
||||||
|
if action_id == ActionId.TM_MEM_READ_RPT:
|
||||||
|
header_list = [
|
||||||
|
"PLOC Memory Address",
|
||||||
|
"PLOC Mem Len",
|
||||||
|
"PLOC Read Memory Data",
|
||||||
|
]
|
||||||
|
content_list = [
|
||||||
|
"0x" + custom_data[:4].hex(),
|
||||||
|
struct.unpack("!H", custom_data[4:6])[0],
|
||||||
|
"0x" + custom_data[6:10].hex(),
|
||||||
|
]
|
||||||
|
pw.dlog(f"{header_list}")
|
||||||
|
pw.dlog(f"{content_list}")
|
||||||
|
elif action_id == ActionId.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]),
|
||||||
|
]
|
||||||
|
pw.dlog(f"{header_list}")
|
||||||
|
pw.dlog(f"{content_list}")
|
||||||
|
elif action_id == ActionId.TM_FLASH_DIRECTORY_CONTENT:
|
||||||
|
if len(custom_data) < 16:
|
||||||
|
_LOGGER.warning(
|
||||||
|
"PLOC MPSoC flash directory data shorter than minimum 16 bytes"
|
||||||
|
)
|
||||||
|
current_idx = 0
|
||||||
|
dir_name_short = custom_data[current_idx : current_idx + 12].decode("utf-8")
|
||||||
|
current_idx += 12
|
||||||
|
num_elements = struct.unpack("!I", custom_data[current_idx : current_idx + 4])[
|
||||||
|
0
|
||||||
|
]
|
||||||
|
current_idx += 4
|
||||||
|
elem_names = []
|
||||||
|
elem_attrs = []
|
||||||
|
elem_sizes = []
|
||||||
|
expected_size = 16 + num_elements * 17
|
||||||
|
if len(custom_data) < expected_size:
|
||||||
|
_LOGGER.warning(
|
||||||
|
f"PLOC MPSoC flash directory data shorter than expected {expected_size}"
|
||||||
|
)
|
||||||
|
pw.dlog(
|
||||||
|
f"Received PLOC MPSoC flash directory content for path {dir_name_short} "
|
||||||
|
f"with {num_elements} elements"
|
||||||
|
)
|
||||||
|
# It is as weird as it looks..
|
||||||
|
for _ in range(num_elements):
|
||||||
|
end_of_str = custom_data[current_idx : current_idx + 12].index(b"\x00")
|
||||||
|
elem_name = custom_data[current_idx : current_idx + end_of_str].decode(
|
||||||
|
"utf-8"
|
||||||
|
)
|
||||||
|
current_idx += 12
|
||||||
|
elem_names.append(elem_name)
|
||||||
|
for _ in range(num_elements):
|
||||||
|
elem_attrs.append(custom_data[current_idx])
|
||||||
|
current_idx += 1
|
||||||
|
for _ in range(num_elements):
|
||||||
|
elem_sizes.append(
|
||||||
|
struct.unpack("!I", custom_data[current_idx : current_idx + 4])[0]
|
||||||
|
)
|
||||||
|
current_idx += 4
|
||||||
|
for i in range(num_elements):
|
||||||
|
pw.dlog(f"{DirElement(elem_names[i], elem_attrs[i], elem_sizes[i])}")
|
||||||
|
@ -21,7 +21,7 @@ from tmtccmd.tc import service_provider
|
|||||||
from tmtccmd.tc.decorator import ServiceProviderParams
|
from tmtccmd.tc.decorator import ServiceProviderParams
|
||||||
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
from tmtccmd.pus.s200_fsfw_mode import pack_mode_data, Mode
|
||||||
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
from eive_tmtc.utility.input_helper import InputHelper
|
from eive_tmtc.utility.input_helper import InputHelper
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -223,7 +223,7 @@ def add_ploc_supv_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
|
|
||||||
|
|
||||||
@service_provider(CustomServiceList.PLOC_SUPV)
|
@service_provider(CustomServiceList.PLOC_SUPV)
|
||||||
def pack_ploc_supv_commands(p: ServiceProviderParams):
|
def pack_ploc_supv_commands(p: ServiceProviderParams): # noqa C901
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
op_code = p.op_code
|
op_code = p.op_code
|
||||||
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
object_id = get_object_ids().get(PLOC_SUPV_ID)
|
||||||
@ -484,7 +484,9 @@ def pack_ploc_supv_commands(p: ServiceProviderParams):
|
|||||||
def pack_sel_boot_image_cmd(
|
def pack_sel_boot_image_cmd(
|
||||||
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
object_id: bytes, mem: int, bp0: int, bp1: int, bp2: int
|
||||||
) -> bytearray:
|
) -> bytearray:
|
||||||
"""This function can be used to generate the command to select the image from which the MPSoC will boot
|
"""This function can be used to generate the command to select the image from which the MPSoC
|
||||||
|
will boot.
|
||||||
|
|
||||||
@param object_id The object id of the PLOC supervisor handler.
|
@param object_id The object id of the PLOC supervisor handler.
|
||||||
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
|
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
|
||||||
@param bp0 Partition pin 0
|
@param bp0 Partition pin 0
|
||||||
@ -721,8 +723,7 @@ def get_event_buffer_path() -> str:
|
|||||||
return file
|
return file
|
||||||
|
|
||||||
|
|
||||||
def handle_supv_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
def handle_supv_hk_data(set_id: int, hk_data: bytes, pw: PrintWrapper):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
if set_id == SetIds.HK_REPORT:
|
if set_id == SetIds.HK_REPORT:
|
||||||
pass
|
pass
|
||||||
@ -752,7 +753,7 @@ def handle_supv_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
|||||||
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
|
f"BP0 State {bp_0_state} | BP1 State {bp_1_state} | BP2 State {bp_2_state}"
|
||||||
)
|
)
|
||||||
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
pw.dlog(f"Boot State {boot_state} | Boot Cycles {boot_cycles}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 10)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 10)
|
||||||
else:
|
else:
|
||||||
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
pw.dlog(f"PLOC SUPV: HK handling not implemented for set ID {set_id}")
|
||||||
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
pw.dlog(f"Raw Data: 0x[{hk_data.hex(sep=',')}]")
|
||||||
|
@ -18,7 +18,7 @@ from tmtccmd.tc import DefaultPusQueueHelper
|
|||||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
||||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class SetId(enum.IntEnum):
|
class SetId(enum.IntEnum):
|
||||||
@ -100,9 +100,8 @@ def rad_sensor_mode_cmd(
|
|||||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||||
|
|
||||||
|
|
||||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_rad_sensor_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
if set_id == SetId.HK:
|
if set_id == SetId.HK:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
pw.dlog("Received Radiation Sensor HK data")
|
pw.dlog("Received Radiation Sensor HK data")
|
||||||
fmt_str = "!fHHHHHH"
|
fmt_str = "!fHHHHHH"
|
||||||
@ -112,8 +111,10 @@ def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
|||||||
)
|
)
|
||||||
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
|
||||||
pw.dlog(f"Temperature: {temp} C")
|
pw.dlog(f"Temperature: {temp} C")
|
||||||
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
pw.dlog("AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||||
for idx, val in ain_dict.items():
|
for idx, val in ain_dict.items():
|
||||||
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=7
|
||||||
|
)
|
||||||
|
@ -75,7 +75,7 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
|
|
||||||
|
|
||||||
@service_provider(CustomServiceList.SCEX.value)
|
@service_provider(CustomServiceList.SCEX.value)
|
||||||
def pack_scex_cmds(p: ServiceProviderParams):
|
def pack_scex_cmds(p: ServiceProviderParams): # noqa C901
|
||||||
op_code = p.op_code
|
op_code = p.op_code
|
||||||
q = p.queue_helper
|
q = p.queue_helper
|
||||||
if op_code in OpCode.SWITCH_ON:
|
if op_code in OpCode.SWITCH_ON:
|
||||||
|
@ -17,7 +17,7 @@ from tmtccmd.pus.s8_fsfw_funccmd import create_action_cmd
|
|||||||
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
from tmtccmd.tc.pus_200_fsfw_mode import Subservice as ModeSubservices
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
class BpxSetId(enum.IntEnum):
|
class BpxSetId(enum.IntEnum):
|
||||||
@ -126,8 +126,7 @@ HEADER_LIST = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_bpx_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
if set_id == BpxSetId.GET_HK_SET:
|
if set_id == BpxSetId.GET_HK_SET:
|
||||||
fmt_str = "!HHHHhhhhIB"
|
fmt_str = "!HHHHhhhhIB"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
@ -158,7 +157,9 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
validity_buffer = hk_data[inc_len:]
|
validity_buffer = hk_data[inc_len:]
|
||||||
pw.dlog(str(HEADER_LIST))
|
pw.dlog(str(HEADER_LIST))
|
||||||
pw.dlog(str(content_list))
|
pw.dlog(str(content_list))
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=10
|
||||||
|
)
|
||||||
elif set_id == BpxSetId.GET_CFG_SET:
|
elif set_id == BpxSetId.GET_CFG_SET:
|
||||||
battheat_mode = hk_data[0]
|
battheat_mode = hk_data[0]
|
||||||
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
battheat_low = struct.unpack("!b", hk_data[1:2])[0]
|
||||||
@ -172,4 +173,6 @@ def handle_bpx_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
validity_buffer = hk_data[3:]
|
validity_buffer = hk_data[3:]
|
||||||
pw.dlog(str(header_list))
|
pw.dlog(str(header_list))
|
||||||
pw.dlog(str(content_list))
|
pw.dlog(str(content_list))
|
||||||
printer.print_validity_buffer(validity_buffer=validity_buffer, num_vars=10)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=validity_buffer, num_vars=10
|
||||||
|
)
|
||||||
|
@ -140,7 +140,7 @@ def pack_common_power_cmds(
|
|||||||
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetId.CORE)))
|
q.add_pus_tc(disable_periodic_hk_command(True, make_sid(objb, SetId.CORE)))
|
||||||
|
|
||||||
|
|
||||||
def pack_common_gomspace_cmds(
|
def pack_common_gomspace_cmds( # noqa C901: Complexity is okay here.
|
||||||
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
prefix: str, object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
):
|
):
|
||||||
objb = object_id.as_bytes
|
objb = object_id.as_bytes
|
||||||
|
@ -98,7 +98,9 @@ class P60DockHkTable:
|
|||||||
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
|
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
|
||||||
|
|
||||||
|
|
||||||
def pack_p60dock_cmds(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
|
def pack_p60dock_cmds( # noqa C901: Complexity okay here.
|
||||||
|
object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str
|
||||||
|
):
|
||||||
objb = object_id.as_bytes
|
objb = object_id.as_bytes
|
||||||
pack_common_power_cmds("P60 Dock", object_id, q, op_code)
|
pack_common_power_cmds("P60 Dock", object_id, q, op_code)
|
||||||
pack_common_gomspace_cmds("P60 Dock", object_id, q, op_code)
|
pack_common_gomspace_cmds("P60 Dock", object_id, q, op_code)
|
||||||
|
@ -3,8 +3,16 @@
|
|||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 17.12.2020
|
@date 17.12.2020
|
||||||
"""
|
"""
|
||||||
|
import enum
|
||||||
|
|
||||||
from eive_tmtc.config.definitions import CustomServiceList
|
from eive_tmtc.config.definitions import CustomServiceList
|
||||||
from eive_tmtc.config.object_ids import PDU_1_HANDLER_ID
|
from eive_tmtc.config.object_ids import PDU_1_HANDLER_ID
|
||||||
|
from eive_tmtc.gomspace.gomspace_common import (
|
||||||
|
pack_ping_command,
|
||||||
|
TableIds,
|
||||||
|
pack_get_param_command,
|
||||||
|
)
|
||||||
|
from eive_tmtc.gomspace.gomspace_pdu_definitions import PduHkTable
|
||||||
from eive_tmtc.tmtc.power.common_power import (
|
from eive_tmtc.tmtc.power.common_power import (
|
||||||
pack_common_gomspace_cmds,
|
pack_common_gomspace_cmds,
|
||||||
req_hk_cmds,
|
req_hk_cmds,
|
||||||
@ -17,15 +25,15 @@ from eive_tmtc.tmtc.power.common_power import (
|
|||||||
pack_common_power_cmds,
|
pack_common_power_cmds,
|
||||||
GomspaceOpCode,
|
GomspaceOpCode,
|
||||||
GsInfo,
|
GsInfo,
|
||||||
PowerInfo,
|
|
||||||
add_common_power_defs,
|
add_common_power_defs,
|
||||||
SetId,
|
SetId,
|
||||||
)
|
)
|
||||||
|
from spacepackets.ecss import PusTelecommand
|
||||||
|
|
||||||
from eive_tmtc.gomspace.gomspace_common import *
|
|
||||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import *
|
|
||||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
|
from tmtccmd.util import ObjectIdU32
|
||||||
|
|
||||||
|
|
||||||
class Pdu1InfoBase:
|
class Pdu1InfoBase:
|
||||||
@ -102,7 +110,9 @@ def info_off_pdu1(base: str) -> str:
|
|||||||
return "PDU1: " + base + " off"
|
return "PDU1: " + base + " off"
|
||||||
|
|
||||||
|
|
||||||
def pdu1_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
|
def pdu1_switch_cmds( # noqa C901: Complexity is okay here.
|
||||||
|
q: DefaultPusQueueHelper, op_code: str
|
||||||
|
): # noqa C901: Complexity okay here
|
||||||
if op_code in PowerOpCodes.TCS_ON:
|
if op_code in PowerOpCodes.TCS_ON:
|
||||||
tcs_on_cmd(q)
|
tcs_on_cmd(q)
|
||||||
elif op_code in PowerOpCodes.TCS_OFF:
|
elif op_code in PowerOpCodes.TCS_OFF:
|
||||||
@ -181,6 +191,7 @@ PDU1_DICT = {
|
|||||||
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
|
Pdu1ChIndex.SYRLINKS: Pdu1InfoBase.SYRLINKS,
|
||||||
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
|
Pdu1ChIndex.MGT: Pdu1InfoBase.MGT,
|
||||||
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
|
Pdu1ChIndex.SCEX: Pdu1InfoBase.SCEX,
|
||||||
|
Pdu1ChIndex.PLOC: Pdu1InfoBase.PLOC,
|
||||||
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
|
Pdu1ChIndex.ACS_A: Pdu1InfoBase.ACS_A,
|
||||||
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
|
Pdu1ChIndex.SUS_N: Pdu1InfoBase.SUS_N,
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,18 @@
|
|||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 17.12.2020
|
@date 17.12.2020
|
||||||
"""
|
"""
|
||||||
|
import enum
|
||||||
|
|
||||||
from eive_tmtc.config.object_ids import PDU_2_HANDLER_ID
|
from eive_tmtc.config.object_ids import PDU_2_HANDLER_ID
|
||||||
|
from eive_tmtc.gomspace.gomspace_common import (
|
||||||
|
pack_reboot_command,
|
||||||
|
pack_ping_command,
|
||||||
|
pack_gnd_wdt_reset_command,
|
||||||
|
pack_get_param_command,
|
||||||
|
TableIds,
|
||||||
|
pack_request_full_hk_table_command,
|
||||||
|
)
|
||||||
|
from eive_tmtc.gomspace.gomspace_pdu_definitions import PduHkTable, PduConfigTable
|
||||||
from eive_tmtc.tmtc.power.common_power import (
|
from eive_tmtc.tmtc.power.common_power import (
|
||||||
pack_common_gomspace_cmds,
|
pack_common_gomspace_cmds,
|
||||||
req_hk_cmds,
|
req_hk_cmds,
|
||||||
@ -20,10 +31,11 @@ from eive_tmtc.tmtc.power.common_power import (
|
|||||||
SetId,
|
SetId,
|
||||||
add_common_power_defs,
|
add_common_power_defs,
|
||||||
)
|
)
|
||||||
from eive_tmtc.gomspace.gomspace_common import *
|
from spacepackets.ecss import PusTelecommand
|
||||||
from eive_tmtc.gomspace.gomspace_pdu_definitions import *
|
|
||||||
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
|
from tmtccmd.util import ObjectIdU32
|
||||||
|
|
||||||
|
|
||||||
class Pdu2InfoBase:
|
class Pdu2InfoBase:
|
||||||
@ -159,7 +171,7 @@ def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str):
|
def pdu2_switch_cmds(q: DefaultPusQueueHelper, op_code: str): # noqa C901
|
||||||
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
|
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
|
||||||
pl_pcdu_bat_nom_on_cmd(q)
|
pl_pcdu_bat_nom_on_cmd(q)
|
||||||
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:
|
elif op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_OFF:
|
||||||
|
@ -22,13 +22,13 @@ from tmtccmd.tc.pus_11_tc_sched import (
|
|||||||
)
|
)
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
from tmtccmd.tc.pus_200_fsfw_mode import pack_mode_data, Mode, Subservice
|
||||||
from tmtccmd.tc.pus_20_fsfw_param import (
|
from tmtccmd.tc.pus_20_fsfw_param import (
|
||||||
pack_scalar_double_param_app_data,
|
create_scalar_double_parameter,
|
||||||
create_load_param_cmd,
|
create_load_param_cmd,
|
||||||
pack_boolean_parameter_app_data,
|
create_scalar_boolean_parameter,
|
||||||
)
|
)
|
||||||
from spacepackets.ecss.tc import PusTelecommand
|
from spacepackets.ecss.tc import PusTelecommand
|
||||||
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
from eive_tmtc.config.object_ids import PL_PCDU_ID
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -161,7 +161,9 @@ def add_pl_pcdu_cmds(defs: TmtcDefinitionWrapper):
|
|||||||
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
|
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
|
||||||
|
|
||||||
|
|
||||||
def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):
|
def pack_pl_pcdu_commands( # noqa C901: Complexity is okay here.
|
||||||
|
q: DefaultPusQueueHelper, op_code: str
|
||||||
|
): # noqa C901: Complexity is okay here.
|
||||||
if op_code in OpCode.SWITCH_ON:
|
if op_code in OpCode.SWITCH_ON:
|
||||||
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Mode.ON, submode=0)
|
pack_pl_pcdu_mode_cmd(q=q, info=Info.SWITCH_ON, mode=Mode.ON, submode=0)
|
||||||
if op_code in OpCode.SWITCH_OFF:
|
if op_code in OpCode.SWITCH_OFF:
|
||||||
@ -423,21 +425,21 @@ def pack_wait_time_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
|||||||
q.add_log_cmd(f"Updating {print_str} wait time to {wait_time}")
|
q.add_log_cmd(f"Updating {print_str} wait time to {wait_time}")
|
||||||
if wait_time is None:
|
if wait_time is None:
|
||||||
return
|
return
|
||||||
param_data = pack_scalar_double_param_app_data(
|
param_data = create_scalar_double_parameter(
|
||||||
object_id=PL_PCDU_ID,
|
object_id=PL_PCDU_ID,
|
||||||
domain_id=0,
|
domain_id=0,
|
||||||
unique_id=param_id,
|
unique_id=param_id,
|
||||||
parameter=wait_time,
|
parameter=wait_time,
|
||||||
)
|
)
|
||||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
q.add_pus_tc(create_load_param_cmd(param_data))
|
||||||
|
|
||||||
|
|
||||||
def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
def pack_failure_injection_cmd(q: DefaultPusQueueHelper, param_id: int, print_str: str):
|
||||||
q.add_log_cmd(f"Inserting {print_str} error")
|
q.add_log_cmd(f"Inserting {print_str} error")
|
||||||
param_data = pack_boolean_parameter_app_data(
|
param_data = create_scalar_boolean_parameter(
|
||||||
object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True
|
object_id=PL_PCDU_ID, domain_id=0, unique_id=param_id, parameter=True
|
||||||
)
|
)
|
||||||
q.add_pus_tc(create_load_param_cmd(app_data=param_data))
|
q.add_pus_tc(create_load_param_cmd(param_data))
|
||||||
|
|
||||||
|
|
||||||
def pack_pl_pcdu_mode_cmd(
|
def pack_pl_pcdu_mode_cmd(
|
||||||
@ -468,9 +470,8 @@ ADC_CHANNELS_NAMED = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_plpcdu_hk(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
if set_id == SetId.ADC:
|
if set_id == SetId.ADC:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
pw.dlog("Received PL PCDU ADC HK data")
|
pw.dlog("Received PL PCDU ADC HK data")
|
||||||
channels = []
|
channels = []
|
||||||
@ -496,4 +497,6 @@ def handle_plpcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
pw.dlog(ch_print)
|
pw.dlog(ch_print)
|
||||||
for i in range(12):
|
for i in range(12):
|
||||||
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
pw.dlog(f"{ADC_CHANNELS_NAMED[i].ljust(24)} | {processed_vals[i]}")
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=3)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=3
|
||||||
|
)
|
||||||
|
@ -35,7 +35,6 @@ from eive_tmtc.tmtc.power.acu import add_acu_cmds, acu_req_hk_cmds
|
|||||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||||
create_request_one_diag_command,
|
create_request_one_diag_command,
|
||||||
make_sid,
|
make_sid,
|
||||||
create_request_one_hk_command,
|
|
||||||
)
|
)
|
||||||
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
from tmtccmd.config.tmtc import tmtc_definitions_provider
|
||||||
from tmtccmd.tc import DefaultPusQueueHelper
|
from tmtccmd.tc import DefaultPusQueueHelper
|
||||||
|
@ -9,7 +9,7 @@ from eive_tmtc.tmtc.power.common_power import (
|
|||||||
)
|
)
|
||||||
from eive_tmtc.tmtc.power.power import PcduSetIds
|
from eive_tmtc.tmtc.power.power import PcduSetIds
|
||||||
from tmtccmd.util import ObjectIdBase
|
from tmtccmd.util import ObjectIdBase
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from eive_tmtc.gomspace.gomspace_common import GomspaceDeviceActionId
|
from eive_tmtc.gomspace.gomspace_common import GomspaceDeviceActionId
|
||||||
from eive_tmtc.config.object_ids import (
|
from eive_tmtc.config.object_ids import (
|
||||||
@ -119,7 +119,7 @@ class DevicesInfoParser:
|
|||||||
return current_idx
|
return current_idx
|
||||||
|
|
||||||
def print(self, pw: PrintWrapper):
|
def print(self, pw: PrintWrapper):
|
||||||
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
pw.dlog("Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
||||||
for i in range(len(self.dev_types)):
|
for i in range(len(self.dev_types)):
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
|
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
|
||||||
@ -146,18 +146,13 @@ class DevicesInfoParser:
|
|||||||
return "Unknown Type"
|
return "Unknown Type"
|
||||||
|
|
||||||
|
|
||||||
def handle_pdu_data(
|
def handle_pdu_data(pw: PrintWrapper, pdu_idx: int, set_id: int, hk_data: bytes):
|
||||||
printer: FsfwTmTcPrinter, pdu_idx: int, set_id: int, hk_data: bytes
|
|
||||||
):
|
|
||||||
pw = PrintWrapper(printer=printer)
|
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
priv_idx = pdu_idx - 1
|
priv_idx = pdu_idx - 1
|
||||||
if set_id == SetId.AUX or set_id == SetId.AUX:
|
if set_id == SetId.AUX or set_id == SetId.AUX:
|
||||||
fmt_str = "!hhBBBIIH"
|
fmt_str = "!BBBIIH"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(
|
(
|
||||||
vcc,
|
|
||||||
vbat,
|
|
||||||
conv_enb_0,
|
conv_enb_0,
|
||||||
conv_enb_1,
|
conv_enb_1,
|
||||||
conv_enb_2,
|
conv_enb_2,
|
||||||
@ -165,7 +160,6 @@ def handle_pdu_data(
|
|||||||
uptime,
|
uptime,
|
||||||
reset_cause,
|
reset_cause,
|
||||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV")
|
|
||||||
pw.dlog(f"Converter Enables [{conv_enb_0},{conv_enb_1},{conv_enb_2}]")
|
pw.dlog(f"Converter Enables [{conv_enb_0},{conv_enb_1},{conv_enb_2}]")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"Boot Cause {boot_cause} | Uptime {uptime} | Reset Cause {reset_cause}",
|
f"Boot Cause {boot_cause} | Uptime {uptime} | Reset Cause {reset_cause}",
|
||||||
@ -187,7 +181,7 @@ def handle_pdu_data(
|
|||||||
wdt = WdtInfo(pw=pw)
|
wdt = WdtInfo(pw=pw)
|
||||||
current_idx = wdt.parse(wdt_data=hk_data[current_idx:], current_idx=current_idx)
|
current_idx = wdt.parse(wdt_data=hk_data[current_idx:], current_idx=current_idx)
|
||||||
wdt.print()
|
wdt.print()
|
||||||
pw.dlog(f"PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
|
pw.dlog("PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
|
||||||
dev_parser.print(pw=pw)
|
dev_parser.print(pw=pw)
|
||||||
if set_id == SetId.CORE or set_id == SetId.CORE:
|
if set_id == SetId.CORE or set_id == SetId.CORE:
|
||||||
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
|
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
|
||||||
@ -216,20 +210,19 @@ def handle_pdu_data(
|
|||||||
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||||
)
|
)
|
||||||
pw.dlog(content_line)
|
pw.dlog(content_line)
|
||||||
fmt_str = "!IBf"
|
fmt_str = "!IBfhh"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(boot_count, batt_mode, temperature) = struct.unpack(
|
(boot_count, batt_mode, temperature, vcc, vbat) = struct.unpack(
|
||||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||||
)
|
)
|
||||||
info = (
|
info = (
|
||||||
f"Boot Count {boot_count} | Battery Mode {batt_mode} | "
|
f"Boot Count {boot_count} | Battery Mode {batt_mode} | "
|
||||||
f"Temperature {temperature}"
|
f"Temperature {temperature} | VCC {vcc} | VBAT {vbat}"
|
||||||
)
|
)
|
||||||
pw.dlog(info)
|
pw.dlog(info)
|
||||||
|
|
||||||
|
|
||||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_p60_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer=printer)
|
|
||||||
if set_id == SetId.CORE:
|
if set_id == SetId.CORE:
|
||||||
pw.dlog("Received P60 Core HK. Voltages in mV, currents in mA")
|
pw.dlog("Received P60 Core HK. Voltages in mV, currents in mA")
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
@ -276,7 +269,9 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
temps = f"In C: Temp 0 {temp_0} | Temp 1 {temp_1} | "
|
temps = f"In C: Temp 0 {temp_0} | Temp 1 {temp_1} | "
|
||||||
pw.dlog(temps)
|
pw.dlog(temps)
|
||||||
pw.dlog(batt_info)
|
pw.dlog(batt_info)
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=9
|
||||||
|
)
|
||||||
if set_id == SetId.AUX:
|
if set_id == SetId.AUX:
|
||||||
pw.dlog("Received P60 AUX HK. Voltages in mV, currents in mA")
|
pw.dlog("Received P60 AUX HK. Voltages in mV, currents in mA")
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
@ -341,7 +336,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
"6:TempSens(BatPack)|7:TempSens(BatPack)"
|
"6:TempSens(BatPack)|7:TempSens(BatPack)"
|
||||||
)
|
)
|
||||||
dev_parser.print(pw=pw)
|
dev_parser.print(pw=pw)
|
||||||
printer.print_validity_buffer(
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -354,8 +349,7 @@ def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[
|
|||||||
return current_idx, u16_list
|
return current_idx, u16_list
|
||||||
|
|
||||||
|
|
||||||
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_acu_hk_data(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer=printer)
|
|
||||||
if set_id == SetId.CORE:
|
if set_id == SetId.CORE:
|
||||||
mppt_mode = hk_data[0]
|
mppt_mode = hk_data[0]
|
||||||
current_idx = 1
|
current_idx = 1
|
||||||
@ -383,9 +377,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
pw.dlog("Received ACU Core HK. Voltages in mV, currents in mA")
|
pw.dlog("Received ACU Core HK. Voltages in mV, currents in mA")
|
||||||
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV | MPPT Mode {mppt_mode}")
|
pw.dlog(f"VCC {vcc} mV | VBAT {vbat} mV | MPPT Mode {mppt_mode}")
|
||||||
header_str = (
|
header_str = "Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
|
||||||
f"Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
|
|
||||||
)
|
|
||||||
pw.dlog(header_str)
|
pw.dlog(header_str)
|
||||||
for i in range(6):
|
for i in range(6):
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
@ -397,7 +389,7 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
|
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
|
||||||
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
|
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
|
||||||
)
|
)
|
||||||
printer.print_validity_buffer(
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
validity_buffer=hk_data[current_idx:], num_vars=12
|
validity_buffer=hk_data[current_idx:], num_vars=12
|
||||||
)
|
)
|
||||||
if set_id == SetId.AUX:
|
if set_id == SetId.AUX:
|
||||||
@ -422,7 +414,8 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
|
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
|
||||||
|
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | DAC 2 {dac_enb_str[2]}"
|
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | "
|
||||||
|
f"DAC 2 {dac_enb_str[2]}"
|
||||||
)
|
)
|
||||||
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
|
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
@ -430,11 +423,13 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
)
|
)
|
||||||
|
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|"
|
"ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|"
|
||||||
f"5:DAC|6:TempSens|7:Reserved"
|
"5:DAC|6:TempSens|7:Reserved"
|
||||||
)
|
)
|
||||||
dev_parser.print(pw=pw)
|
dev_parser.print(pw=pw)
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=8)
|
FsfwTmTcPrinter.get_validity_buffer(
|
||||||
|
validity_buffer=hk_data[current_idx:], num_vars=8
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_get_param_data_reply(
|
def handle_get_param_data_reply(
|
||||||
@ -557,8 +552,7 @@ def parse_name_list(data: bytes, name_len: int):
|
|||||||
return ch_list
|
return ch_list
|
||||||
|
|
||||||
|
|
||||||
def handle_pcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_pcdu_hk(pw: PrintWrapper, set_id: int, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog("Received PCDU HK")
|
pw.dlog("Received PCDU HK")
|
||||||
if set_id == PcduSetIds.SWITCHER_SET:
|
if set_id == PcduSetIds.SWITCHER_SET:
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
@ -578,4 +572,4 @@ def handle_pcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
pw.dlog(f"{name.ljust(25)}: {val}")
|
pw.dlog(f"{name.ljust(25)}: {val}")
|
||||||
pw.dlog(f"{'P60 Dock 5V Stack'.ljust(25)}: {p60_stack_5v_val}")
|
pw.dlog(f"{'P60 Dock 5V Stack'.ljust(25)}: {p60_stack_5v_val}")
|
||||||
pw.dlog(f"{'P60 Dock 3V3 Stack'.ljust(25)}: {p60_stack_3v3_val}")
|
pw.dlog(f"{'P60 Dock 3V3 Stack'.ljust(25)}: {p60_stack_3v3_val}")
|
||||||
pw.printer.print_validity_buffer(hk_data[current_idx:], 4)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], 4)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@file solar_array_deployment.py
|
@file solar_array_deployment.py
|
||||||
@brief The test function in this file simply returns a command which triggers the solar array deployment.
|
@brief The test function in this file simply returns a command which triggers the solar array
|
||||||
|
deployment.
|
||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 15.02.2021
|
@date 15.02.2021
|
||||||
"""
|
"""
|
||||||
|
@ -11,7 +11,6 @@ from tmtccmd.tc import service_provider
|
|||||||
from eive_tmtc.config.object_ids import EIVE_SYSTEM_ID
|
from eive_tmtc.config.object_ids import EIVE_SYSTEM_ID
|
||||||
from tmtccmd.tc.pus_200_fsfw_mode import (
|
from tmtccmd.tc.pus_200_fsfw_mode import (
|
||||||
create_mode_command,
|
create_mode_command,
|
||||||
Mode,
|
|
||||||
create_announce_mode_recursive_command,
|
create_announce_mode_recursive_command,
|
||||||
)
|
)
|
||||||
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
|
from tmtccmd.tc.pus_8_fsfw_funccmd import create_action_cmd
|
||||||
@ -22,6 +21,10 @@ class SystemMode:
|
|||||||
BOOT = 5
|
BOOT = 5
|
||||||
SAFE = AcsMode.SAFE
|
SAFE = AcsMode.SAFE
|
||||||
IDLE = AcsMode.IDLE
|
IDLE = AcsMode.IDLE
|
||||||
|
PTG_NADIR = AcsMode.PTG_NADIR
|
||||||
|
PTG_TARGET = AcsMode.PTG_TARGET
|
||||||
|
PTG_TARGET_GS = AcsMode.PTG_TARGET_GS
|
||||||
|
PTG_INERTIAL = AcsMode.PTG_INERTIAL
|
||||||
|
|
||||||
|
|
||||||
class ActionId(enum.IntEnum):
|
class ActionId(enum.IntEnum):
|
||||||
@ -32,6 +35,10 @@ class OpCode:
|
|||||||
BOOT_MODE = "boot"
|
BOOT_MODE = "boot"
|
||||||
SAFE_MODE = "safe"
|
SAFE_MODE = "safe"
|
||||||
IDLE_MODE = "idle"
|
IDLE_MODE = "idle"
|
||||||
|
NADIR_MODE = "nadir"
|
||||||
|
TARGET_MODE = "ptg_target"
|
||||||
|
TARGET_GS_MODE = "ptg_target_gs"
|
||||||
|
INERTIAL_MODE = "ptg_inertial"
|
||||||
ANNOUNCE_MODES = "announce_modes"
|
ANNOUNCE_MODES = "announce_modes"
|
||||||
REBOOT_I2C = "reboot_i2c"
|
REBOOT_I2C = "reboot_i2c"
|
||||||
|
|
||||||
@ -40,6 +47,10 @@ class Info:
|
|||||||
BOOT_MODE = "Command System into Boot Mode"
|
BOOT_MODE = "Command System into Boot Mode"
|
||||||
SAFE_MODE = "Command System into Safe Mode"
|
SAFE_MODE = "Command System into Safe Mode"
|
||||||
IDLE_MODE = "Command System into Idle Pointing Mode"
|
IDLE_MODE = "Command System into Idle Pointing Mode"
|
||||||
|
NADIR_MODE = "Command System into Nadir Pointing Mode"
|
||||||
|
TARGET_MODE = "Command System into Target Pointing Mode"
|
||||||
|
TARGET_GS_MODE = "Command System into Target Groundstation Pointing Mode"
|
||||||
|
INERTIAL_MODE = "Command System into Inertial Pointing Mode"
|
||||||
ANNOUNCE_MODES = "Announce mode recursively"
|
ANNOUNCE_MODES = "Announce mode recursively"
|
||||||
REBOOT_I2C = "Reboot I2C bus"
|
REBOOT_I2C = "Reboot I2C bus"
|
||||||
|
|
||||||
@ -55,6 +66,18 @@ def build_system_cmds(p: ServiceProviderParams):
|
|||||||
elif o == OpCode.IDLE_MODE:
|
elif o == OpCode.IDLE_MODE:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
|
q.add_log_cmd(f"{prefix}: {Info.IDLE_MODE}")
|
||||||
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.IDLE, 0))
|
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.IDLE, 0))
|
||||||
|
elif o == OpCode.NADIR_MODE:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.NADIR_MODE}")
|
||||||
|
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_NADIR, 0))
|
||||||
|
elif o == OpCode.TARGET_MODE:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.TARGET_MODE}")
|
||||||
|
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET, 0))
|
||||||
|
elif o == OpCode.TARGET_GS_MODE:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.TARGET_GS_MODE}")
|
||||||
|
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_TARGET_GS, 0))
|
||||||
|
elif o == OpCode.INERTIAL_MODE:
|
||||||
|
q.add_log_cmd(f"{prefix}: {Info.INERTIAL_MODE}")
|
||||||
|
q.add_pus_tc(create_mode_command(EIVE_SYSTEM_ID, SystemMode.PTG_INERTIAL, 0))
|
||||||
elif o == OpCode.ANNOUNCE_MODES:
|
elif o == OpCode.ANNOUNCE_MODES:
|
||||||
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
|
q.add_log_cmd(f"{prefix}: {Info.ANNOUNCE_MODES}")
|
||||||
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
|
q.add_pus_tc(create_announce_mode_recursive_command(EIVE_SYSTEM_ID))
|
||||||
@ -72,6 +95,10 @@ def add_system_cmd_defs(defs: TmtcDefinitionWrapper):
|
|||||||
oce.add(keys=OpCode.BOOT_MODE, info=Info.BOOT_MODE)
|
oce.add(keys=OpCode.BOOT_MODE, info=Info.BOOT_MODE)
|
||||||
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
|
oce.add(keys=OpCode.SAFE_MODE, info=Info.SAFE_MODE)
|
||||||
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
|
oce.add(keys=OpCode.IDLE_MODE, info=Info.IDLE_MODE)
|
||||||
|
oce.add(keys=OpCode.NADIR_MODE, info=Info.NADIR_MODE)
|
||||||
|
oce.add(keys=OpCode.TARGET_MODE, info=Info.TARGET_MODE)
|
||||||
|
oce.add(keys=OpCode.TARGET_GS_MODE, info=Info.TARGET_GS_MODE)
|
||||||
|
oce.add(keys=OpCode.INERTIAL_MODE, info=Info.INERTIAL_MODE)
|
||||||
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
|
oce.add(keys=OpCode.ANNOUNCE_MODES, info=Info.ANNOUNCE_MODES)
|
||||||
oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C)
|
oce.add(keys=OpCode.REBOOT_I2C, info=Info.REBOOT_I2C)
|
||||||
defs.add_service(
|
defs.add_service(
|
||||||
|
@ -13,7 +13,7 @@ from tmtccmd.util import ObjectIdU32
|
|||||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data, Subservice
|
||||||
import eive_tmtc.config.object_ids as oids
|
import eive_tmtc.config.object_ids as oids
|
||||||
from eive_tmtc.config.object_ids import get_object_ids
|
from eive_tmtc.config.object_ids import get_object_ids
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
RTD_IDS = [
|
RTD_IDS = [
|
||||||
oids.RTD_0_PLOC_HSPD,
|
oids.RTD_0_PLOC_HSPD,
|
||||||
@ -147,8 +147,7 @@ def pack_rtd_commands(
|
|||||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||||
|
|
||||||
|
|
||||||
def handle_rtd_hk(object_id: bytes, hk_data: bytes, printer: FsfwTmTcPrinter):
|
def handle_rtd_hk(object_id: bytes, hk_data: bytes, pw: PrintWrapper):
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
rtd_name = RTD_NAMES.get(object_id)
|
rtd_name = RTD_NAMES.get(object_id)
|
||||||
if rtd_name is None:
|
if rtd_name is None:
|
||||||
rtd_name = "unknown RTD device"
|
rtd_name = "unknown RTD device"
|
||||||
@ -162,7 +161,7 @@ def handle_rtd_hk(object_id: bytes, hk_data: bytes, printer: FsfwTmTcPrinter):
|
|||||||
pw.dlog(f"RTD Value: {rtd_val}")
|
pw.dlog(f"RTD Value: {rtd_val}")
|
||||||
pw.dlog(f"Error Byte: {error_byte}")
|
pw.dlog(f"Error Byte: {error_byte}")
|
||||||
pw.dlog(f"Last Error Byte: {last_err_byte}")
|
pw.dlog(f"Last Error Byte: {last_err_byte}")
|
||||||
pw.printer.print_validity_buffer(hk_data[fmt_len:], 4)
|
FsfwTmTcPrinter.get_validity_buffer(hk_data[fmt_len:], 4)
|
||||||
|
|
||||||
|
|
||||||
def prompt_rtd_idx():
|
def prompt_rtd_idx():
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import pprint
|
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from eive_tmtc.pus_tm.defs import PrintWrapper
|
from eive_tmtc.pus_tm.defs import PrintWrapper
|
||||||
from tmtccmd.fsfw import validity_buffer_list
|
from tmtccmd.fsfw import validity_buffer_list
|
||||||
from tmtccmd.util import ObjectIdU32
|
from tmtccmd.util import ObjectIdU32
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
|
||||||
from .defs import CtrlSetId
|
from .defs import CtrlSetId
|
||||||
from .heater import HEATER_LOCATION
|
from .heater import HEATER_LOCATION
|
||||||
|
|
||||||
@ -14,7 +12,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def handle_thermal_controller_hk_data(
|
def handle_thermal_controller_hk_data(
|
||||||
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
|
object_id: ObjectIdU32, pw: PrintWrapper, set_id: int, hk_data: bytes
|
||||||
):
|
):
|
||||||
# need a better solutuon for this is this is used again..
|
# need a better solutuon for this is this is used again..
|
||||||
"""
|
"""
|
||||||
@ -24,7 +22,6 @@ def handle_thermal_controller_hk_data(
|
|||||||
TCP_TEMP_DEV_SERVER = TmTcpServer("localhost", 7306)
|
TCP_TEMP_DEV_SERVER = TmTcpServer("localhost", 7306)
|
||||||
"""
|
"""
|
||||||
if set_id == CtrlSetId.PRIMARY_SENSORS:
|
if set_id == CtrlSetId.PRIMARY_SENSORS:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog("Received sensor temperature data")
|
pw.dlog("Received sensor temperature data")
|
||||||
|
|
||||||
# get all the floats
|
# get all the floats
|
||||||
@ -58,7 +55,6 @@ def handle_thermal_controller_hk_data(
|
|||||||
for idx, (k, v) in enumerate(parsed_data.items()):
|
for idx, (k, v) in enumerate(parsed_data.items()):
|
||||||
print(f"{str(k).ljust(30)}: Valid: {valid_list[idx]}, Value: {v}")
|
print(f"{str(k).ljust(30)}: Valid: {valid_list[idx]}, Value: {v}")
|
||||||
elif set_id == CtrlSetId.DEVICE_SENSORS:
|
elif set_id == CtrlSetId.DEVICE_SENSORS:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog("Received device temperature data")
|
pw.dlog("Received device temperature data")
|
||||||
fmt_str = "!fhhhhiiiifffhffffffffffffff"
|
fmt_str = "!fhhhhiiiifffhffffffffffffff"
|
||||||
fmt_len = struct.calcsize(fmt_str)
|
fmt_len = struct.calcsize(fmt_str)
|
||||||
@ -94,7 +90,6 @@ def handle_thermal_controller_hk_data(
|
|||||||
for idx, (k, v) in enumerate(parsed_data.items()):
|
for idx, (k, v) in enumerate(parsed_data.items()):
|
||||||
print(f"{str(k).ljust(30)}: Valid: {valid_list[idx]}, Value: {v}")
|
print(f"{str(k).ljust(30)}: Valid: {valid_list[idx]}, Value: {v}")
|
||||||
elif set_id == CtrlSetId.SUS_TEMP_SENSORS:
|
elif set_id == CtrlSetId.SUS_TEMP_SENSORS:
|
||||||
pw = PrintWrapper(printer)
|
|
||||||
pw.dlog("Received SUS temperature data")
|
pw.dlog("Received SUS temperature data")
|
||||||
fmt_str = "!ffffffffffff"
|
fmt_str = "!ffffffffffff"
|
||||||
fmt_len = struct.calcsize(fmt_str)
|
fmt_len = struct.calcsize(fmt_str)
|
||||||
|
@ -148,7 +148,8 @@ def time_prompt_offset_from_now() -> datetime.datetime:
|
|||||||
seconds_offset = math.floor(
|
seconds_offset = math.floor(
|
||||||
float(
|
float(
|
||||||
input(
|
input(
|
||||||
"Please enter the time as a offset from now in seconds. Negative offset is allowed: "
|
"Please enter the time as a offset from now in seconds. Negative offset is "
|
||||||
|
"allowed: "
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
@file input_helper.py
|
@file input_helper.py
|
||||||
@brief This class can be used to get user input. A dictionary must be provided which describes the input options.
|
@brief This class can be used to get user input. A dictionary must be provided which describes the
|
||||||
|
input options.
|
||||||
@author J. Meier
|
@author J. Meier
|
||||||
@date 13.02.2021
|
@date 13.02.2021
|
||||||
"""
|
"""
|
||||||
|
@ -29,7 +29,7 @@ classifiers = [
|
|||||||
"Topic :: Scientific/Engineering"
|
"Topic :: Scientific/Engineering"
|
||||||
]
|
]
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"tmtccmd ~= 4.1",
|
"tmtccmd ~= 5.0.0rc0",
|
||||||
"python-dateutil ~= 2.8",
|
"python-dateutil ~= 2.8",
|
||||||
# tmtccmd @ git+https://github.com/robamu-org/tmtccmd@<gitRev>#egg=tmtccmd
|
# tmtccmd @ git+https://github.com/robamu-org/tmtccmd@<gitRev>#egg=tmtccmd
|
||||||
]
|
]
|
||||||
|
15
release-checklist.md
Normal file
15
release-checklist.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
Checklist for new releases
|
||||||
|
========
|
||||||
|
|
||||||
|
# Pre-Release
|
||||||
|
|
||||||
|
1. Bump version inside the `eive_tmtc/__init__.py` file.
|
||||||
|
2. Update `CHANGELOG.md`: Convert `unreleased` section into version section
|
||||||
|
with date and new `unreleased`section.
|
||||||
|
3. Run auto-formatter with `black .`
|
||||||
|
4. Run linter with `flake8 .`
|
||||||
|
|
||||||
|
# Post-Release
|
||||||
|
|
||||||
|
1. Create new release on `EGit` based on the release branch. This also creates
|
||||||
|
a tag.
|
12
tmtcc.py
12
tmtcc.py
@ -45,7 +45,7 @@ except ImportError as error:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import tmtccmd
|
import tmtccmd
|
||||||
except ImportError as error:
|
except ImportError:
|
||||||
run_tmtc_commander = None
|
run_tmtc_commander = None
|
||||||
initialize_tmtc_commander = None
|
initialize_tmtc_commander = None
|
||||||
tb = traceback.format_exc()
|
tb = traceback.format_exc()
|
||||||
@ -56,7 +56,7 @@ except ImportError as error:
|
|||||||
from spacepackets.ecss import PusVerificator
|
from spacepackets.ecss import PusVerificator
|
||||||
from tmtccmd import TcHandlerBase, BackendBase
|
from tmtccmd import TcHandlerBase, BackendBase
|
||||||
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
|
from tmtccmd.util import FileSeqCountProvider, PusFileSeqCountProvider
|
||||||
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
from tmtccmd.logging.pus import (
|
from tmtccmd.logging.pus import (
|
||||||
RawTmtcTimedLogWrapper,
|
RawTmtcTimedLogWrapper,
|
||||||
@ -204,7 +204,7 @@ class CfdpInCcsdsWrapper(SpecificApidHandlerBase):
|
|||||||
_LOGGER.info("Received File Data PDU TM")
|
_LOGGER.info("Received File Data PDU TM")
|
||||||
else:
|
else:
|
||||||
if pdu_base.directive_type == DirectiveType.FINISHED_PDU:
|
if pdu_base.directive_type == DirectiveType.FINISHED_PDU:
|
||||||
_LOGGER.info(f"Received Finished PDU TM")
|
_LOGGER.info("Received Finished PDU TM")
|
||||||
else:
|
else:
|
||||||
_LOGGER.info(
|
_LOGGER.info(
|
||||||
f"Received File Directive PDU with type {pdu_base.directive_type!r} TM"
|
f"Received File Directive PDU with type {pdu_base.directive_type!r} TM"
|
||||||
@ -312,7 +312,7 @@ class TcHandler(TcHandlerBase):
|
|||||||
)
|
)
|
||||||
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
|
elif pdu.pdu_directive_type == DirectiveType.EOF_PDU:
|
||||||
self.queue_helper.add_log_cmd(
|
self.queue_helper.add_log_cmd(
|
||||||
f"CFDP Source: Sending EOF PDU"
|
"CFDP Source: Sending EOF PDU"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
fd_pdu = pdu.to_file_data_pdu()
|
fd_pdu = pdu.to_file_data_pdu()
|
||||||
@ -332,7 +332,7 @@ class TcHandler(TcHandlerBase):
|
|||||||
f"Finished queue for service {def_proc.service} and op code {def_proc.op_code}"
|
f"Finished queue for service {def_proc.service} and op code {def_proc.op_code}"
|
||||||
)
|
)
|
||||||
elif info.proc_type == TcProcedureType.CFDP:
|
elif info.proc_type == TcProcedureType.CFDP:
|
||||||
_LOGGER.info(f"Finished CFDP queue")
|
_LOGGER.info("Finished CFDP queue")
|
||||||
|
|
||||||
|
|
||||||
def setup_params() -> SetupWrapper:
|
def setup_params() -> SetupWrapper:
|
||||||
@ -437,7 +437,7 @@ def setup_backend(
|
|||||||
return tmtc_backend
|
return tmtc_backend
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(): # noqa C901: Complexity okay here.
|
||||||
print(f"-- eive tmtc v{__version__} --")
|
print(f"-- eive tmtc v{__version__} --")
|
||||||
print(f"-- spacepackets v{spacepackets.__version__} --")
|
print(f"-- spacepackets v{spacepackets.__version__} --")
|
||||||
add_colorlog_console_logger(_LOGGER)
|
add_colorlog_console_logger(_LOGGER)
|
||||||
|
87
tmtcloop.py
87
tmtcloop.py
@ -1,87 +0,0 @@
|
|||||||
#!/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,
|
|
||||||
handle_unspecified_args,
|
|
||||||
)
|
|
||||||
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.procedure_packer 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().setLevel("ERROR")
|
|
||||||
|
|
||||||
tmtccmd.init_and_start_daemons(tmtc_backend=tmtc_backend)
|
|
||||||
tmtc_backend.perform_operation()
|
|
||||||
|
|
||||||
# remove cmdline args so that we can reuse code
|
|
||||||
sys.argv = sys.argv[:1]
|
|
||||||
|
|
||||||
while True:
|
|
||||||
args.service = None
|
|
||||||
args.op_code = None
|
|
||||||
handle_unspecified_args(args, hook_obj.get_service_op_code_dictionary())
|
|
||||||
|
|
||||||
tmtc_backend.set_service(args.service)
|
|
||||||
tmtc_backend.set_opcode(args.op_code)
|
|
||||||
tmtc_backend.set_mode(CoreModeList.CONTINUOUS_MODE)
|
|
||||||
|
|
||||||
tmtc_backend.perform_operation()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
Loading…
Reference in New Issue
Block a user