scex code additions #115

Merged
muellerr merged 16 commits from scex-additions into main 2022-09-29 11:48:27 +02:00
9 changed files with 81 additions and 15 deletions

24
.run/SCEX FRAM .run.xml Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SCEX FRAM " type="PythonConfigurationType" factoryName="Python" folderName="SCEX">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s scex -o fram -l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SCEX " type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<configuration default="false" name="SCEX " type="PythonConfigurationType" factoryName="Python" folderName="SCEX">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s scex" />
<option name="PARAMETERS" value="-s scex -d 8" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SCEX Ping" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<configuration default="false" name="SCEX Ping" type="PythonConfigurationType" factoryName="Python" folderName="SCEX">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -12,7 +12,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s scex -o ping" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SCEX oneCell" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<configuration default="false" name="SCEX oneCell" type="PythonConfigurationType" factoryName="Python" folderName="SCEX">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="-s scex -o 4 -d 4" />
<option name="PARAMETERS" value="-s scex -o onecell -l" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

View File

@ -215,3 +215,6 @@ Event ID (dec); Event ID (hex); Name; Severity; Description; File Path
13701;0x3585;REBOOT_SW;MEDIUM; Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy;bsp_q7s/core/CoreController.h
13702;0x3586;REBOOT_MECHANISM_TRIGGERED;MEDIUM;The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots;bsp_q7s/core/CoreController.h
13703;0x3587;REBOOT_HW;MEDIUM;;bsp_q7s/core/CoreController.h
13800;0x35e8;MISSING_PACKET;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13801;0x35e9;EXPERIMENT_TIMEDOUT;LOW;;mission/devices/devicedefinitions/ScexDefinitions.h
13802;0x35ea;MULTI_PACKET_COMMAND_DONE;INFO;;mission/devices/devicedefinitions/ScexDefinitions.h

1 Event ID (dec) Event ID (hex) Name Severity Description File Path
215 13701 0x3585 REBOOT_SW MEDIUM Software reboot occurred. Can also be a systemd reboot. P1: Current Chip, P2: Current Copy bsp_q7s/core/CoreController.h
216 13702 0x3586 REBOOT_MECHANISM_TRIGGERED MEDIUM The reboot mechanism was triggered. P1: First 16 bits: Last Chip, Last 16 bits: Last Copy, P2: Each byte is the respective reboot count for the slots bsp_q7s/core/CoreController.h
217 13703 0x3587 REBOOT_HW MEDIUM bsp_q7s/core/CoreController.h
218 13800 0x35e8 MISSING_PACKET LOW mission/devices/devicedefinitions/ScexDefinitions.h
219 13801 0x35e9 EXPERIMENT_TIMEDOUT LOW mission/devices/devicedefinitions/ScexDefinitions.h
220 13802 0x35ea MULTI_PACKET_COMMAND_DONE INFO mission/devices/devicedefinitions/ScexDefinitions.h

View File

@ -46,6 +46,7 @@
0x44330015;PLOC_MPSOC_HANDLER
0x44330016;PLOC_SUPERVISOR_HANDLER
0x44330017;PLOC_SUPERVISOR_HELPER
0x44330032;SCEX
0x444100A2;SOLAR_ARRAY_DEPL_HANDLER
0x444100A4;HEATER_HANDLER
0x44420004;TMP1075_HANDLER_1
@ -69,6 +70,7 @@
0x445300A3;SYRLINKS_HK_HANDLER
0x49000000;ARDUINO_COM_IF
0x49010005;GPIO_IF
0x49010006;SCEX_UART_READER
0x49020004;SPI_MAIN_COM_IF
0x49020005;SPI_RW_COM_IF
0x49020006;SPI_RTD_COM_IF

1 0x00005060 P60DOCK_TEST_TASK
46 0x44330015 PLOC_MPSOC_HANDLER
47 0x44330016 PLOC_SUPERVISOR_HANDLER
48 0x44330017 PLOC_SUPERVISOR_HELPER
49 0x44330032 SCEX
50 0x444100A2 SOLAR_ARRAY_DEPL_HANDLER
51 0x444100A4 HEATER_HANDLER
52 0x44420004 TMP1075_HANDLER_1
70 0x445300A3 SYRLINKS_HK_HANDLER
71 0x49000000 ARDUINO_COM_IF
72 0x49010005 GPIO_IF
73 0x49010006 SCEX_UART_READER
74 0x49020004 SPI_MAIN_COM_IF
75 0x49020005 SPI_RW_COM_IF
76 0x49020006 SPI_RTD_COM_IF

View File

@ -1,6 +1,6 @@
Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h
0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/HasReturnvaluesIF.h
0x0000;OK;System-wide code for ok.;0;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
0x0001;Failed;Unspecified system-wide code for failed.;1;HasReturnvaluesIF;fsfw/returnvalues/returnvalue.h
0x63a0;NVMB_KeyNotExists;Specified key does not exist in json file;160;NVM_PARAM_BASE;mission/memory/NVMParameterBase.h
0x58a0;SUSS_ErrorUnlockMutex;;160;SUS_HANDLER;mission/devices/SusHandler.h
0x58a1;SUSS_ErrorLockMutex;;161;SUS_HANDLER;mission/devices/SusHandler.h
@ -361,8 +361,9 @@ Full ID (hex); Name; Description; Unique ID; Subsytem Name; File Path
0x2cd2;CCS_TooShortBlockedPacket;;210;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
0x2cd3;CCS_TooShortMapExtraction;;211;CCSDS_HANDLER_IF;fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
0x4201;PUS11_InvalidTypeTimeWindow;;1;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4202;PUS11_TimeshiftingNotPossible;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4203;PUS11_InvalidRelativeTime;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4202;PUS11_InvalidTimeWindow;;2;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4203;PUS11_TimeshiftingNotPossible;;3;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x4204;PUS11_InvalidRelativeTime;;4;PUS_SERVICE_11;fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
0x3401;DC_NoReplyReceived;;1;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3402;DC_ProtocolError;;2;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
0x3403;DC_Nullpointer;;3;DEVICE_COMMUNICATION_IF;fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h

1 Full ID (hex) Name Description Unique ID Subsytem Name File Path
2 0x0000 OK System-wide code for ok. 0 HasReturnvaluesIF fsfw/returnvalues/HasReturnvaluesIF.h fsfw/returnvalues/returnvalue.h
3 0x0001 Failed Unspecified system-wide code for failed. 1 HasReturnvaluesIF fsfw/returnvalues/HasReturnvaluesIF.h fsfw/returnvalues/returnvalue.h
4 0x63a0 NVMB_KeyNotExists Specified key does not exist in json file 160 NVM_PARAM_BASE mission/memory/NVMParameterBase.h
5 0x58a0 SUSS_ErrorUnlockMutex 160 SUS_HANDLER mission/devices/SusHandler.h
6 0x58a1 SUSS_ErrorLockMutex 161 SUS_HANDLER mission/devices/SusHandler.h
361 0x2cd2 CCS_TooShortBlockedPacket 210 CCSDS_HANDLER_IF fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
362 0x2cd3 CCS_TooShortMapExtraction 211 CCSDS_HANDLER_IF fsfw/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h
363 0x4201 PUS11_InvalidTypeTimeWindow 1 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
364 0x4202 PUS11_TimeshiftingNotPossible PUS11_InvalidTimeWindow 2 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
365 0x4203 PUS11_InvalidRelativeTime PUS11_TimeshiftingNotPossible 3 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
366 0x4204 PUS11_InvalidRelativeTime 4 PUS_SERVICE_11 fsfw/src/fsfw/pus/Service11TelecommandScheduling.h
367 0x3401 DC_NoReplyReceived 1 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
368 0x3402 DC_ProtocolError 2 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h
369 0x3403 DC_Nullpointer 3 DEVICE_COMMUNICATION_IF fsfw/src/fsfw/devicehandlers/DeviceCommunicationIF.h

View File

@ -1,10 +1,12 @@
import enum
import json
from spacepackets.ecss import PusTelecommand
from config.definitions import CustomServiceList
from tmtccmd import DefaultProcedureInfo, TcHandlerBase
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper, service_provider
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
from tmtccmd.tc import service_provider
from tmtccmd.tc.decorator import ServiceProviderParams
from tmtccmd.tc.pus_8_funccmd import make_fsfw_action_cmd
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
@ -24,6 +26,9 @@ class OpCodes:
ALL_CELLS_CMD = ["5", "allcells"]
FRAM = ["6", "fram"]
SWITCH_ON = ["7", "on"]
SWITCH_OFF = ["8", "off"]
class ActionIds(enum.IntEnum):
PING = 7
@ -46,6 +51,9 @@ class Info:
ALL_CELLS_CMD = "All Cells"
FRAM = "Read FRAM"
SWITCH_ON = "Switch Scex on"
SWITCH_OFF = "Switch Scex off"
@tmtc_definitions_provider
def add_scex_cmds(defs: TmtcDefinitionWrapper):
@ -58,6 +66,8 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
oce.add(keys=OpCodes.ALL_CELLS_CMD, info=Info.ALL_CELLS_CMD)
oce.add(keys=OpCodes.FRAM, info=Info.FRAM)
oce.add(keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON)
oce.add(keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF)
defs.add_service(
name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=oce
@ -68,6 +78,24 @@ def add_scex_cmds(defs: TmtcDefinitionWrapper):
def pack_scex_cmds(p: ServiceProviderParams):
op_code = p.op_code
q = p.queue_helper
if op_code in OpCodes.SWITCH_ON:
q.add_log_cmd(Info.SWITCH_ON)
q.add_pus_tc(
PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.ON, 0),
)
)
if op_code in OpCodes.SWITCH_OFF:
q.add_log_cmd(Info.SWITCH_OFF)
q.add_pus_tc(
PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=pack_mode_data(SCEX_HANDLER_ID, Modes.OFF, 0),
)
)
if op_code in OpCodes.PING:
q.add_log_cmd(Info.PING)
app_data = bytes([0])
@ -93,7 +121,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
# one cell
if op_code in OpCodes.ONE_CELLS_CMD:
q.add_log_cmd(Info.ONE_CELLS_CMD)
app_data = bytearray()
app_data = bytearray([0])
# cell number
cn = 0
@ -125,6 +153,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
# in app_data
# app_data.extend(struct.pack("!H", first_dac))
app_data.append(cell_select)
append_16_bit_val(packet=app_data, val=first_dac[cn])
append_16_bit_val(packet=app_data, val=last_dac[cn])
append_16_bit_val(packet=app_data, val=res_switch1[cn])
@ -140,7 +169,7 @@ def pack_scex_cmds(p: ServiceProviderParams):
if op_code in OpCodes.ALL_CELLS_CMD:
q.add_log_cmd(Info.ALL_CELLS_CMD)
app_data = bytearray()
app_data = bytearray([0])
# cell number
cn = 0

View File

@ -211,7 +211,14 @@ def handle_default_procedure(
gui=tc_handler.gui,
)
if service == CustomServiceList.SCEX.value:
return pack_scex_cmds(q=queue_helper, op_code=op_code)
return pack_scex_cmds(
ServiceProviderParams(
handler_base=tc_base,
op_code=op_code,
info=info,
queue_helper=queue_helper,
)
)
if not route_to_registered_service_handlers(
service,
ServiceProviderParams(