Compare commits

...

27 Commits

Author SHA1 Message Date
4b902ce01b Merge branch 'develop' of https://egit.irs.uni-stuttgart.de/eive/eive-tmtc into develop 2022-05-24 15:06:34 +02:00
ccafa89a92 bump tmtccmd dependency 2022-05-24 15:06:26 +02:00
ec16af0724 Merge pull request 'Regular reboot command' (#85) from mueller/reboot-cmd into develop
Reviewed-on: #85
2022-05-24 15:00:58 +02:00
41f1f4c99a changelog 2022-05-24 01:13:43 +02:00
575932f646 new reboot command 2022-05-24 01:13:21 +02:00
51bbeaa693 transform into static method 2022-05-23 22:24:10 +02:00
f30913b24b Merge pull request 'ACU HK Parsing' (#80) from mueller/acu-hk into develop
Reviewed-on: #80
2022-05-23 18:59:56 +02:00
7f03dcb3a6 bugfix for acu hk parsing 2022-05-23 18:59:19 +02:00
3586b541c1 Merge remote-tracking branch 'origin/develop' into mueller/acu-hk 2022-05-23 18:34:44 +02:00
e7cb7ca096 run afmt 2022-05-23 18:34:28 +02:00
2698756b29 update changelog 2022-05-23 18:32:59 +02:00
d36799448c Merge remote-tracking branch 'origin/develop' into mueller/acu-hk 2022-05-23 18:32:32 +02:00
ba69be6296 Merge pull request 'add rtd cmds' (#84) from mueller/rtd-cmds into develop
Reviewed-on: #84
2022-05-23 18:31:39 +02:00
427efab44e Merge branch 'develop' into mueller/rtd-cmds 2022-05-23 18:30:29 +02:00
4aa89e42ee Merge pull request 'Rad Sensor HK parsing' (#81) from mueller/rad-sensor into develop
Reviewed-on: #81
2022-05-23 18:30:17 +02:00
ea1865bd45 update changelog 2022-05-23 18:29:50 +02:00
4de3e7d107 rad sensor reading works 2022-05-23 18:25:25 +02:00
4251b126b7 Merge remote-tracking branch 'origin/develop' into mueller/rad-sensor 2022-05-23 18:02:03 +02:00
fe36485e85 Merge remote-tracking branch 'origin/develop' into mueller/acu-hk 2022-05-23 18:01:25 +02:00
e884f397cd Merge remote-tracking branch 'origin/develop' into mueller/acu-hk 2022-05-23 15:50:45 +02:00
2506d911de rad sensor HK parsing 2022-05-23 15:49:21 +02:00
314071de1c rad sensor data 2022-05-23 15:38:05 +02:00
b9de13ffe7 something not working 2022-05-23 14:04:34 +02:00
e033609177 run black 2022-05-23 13:47:01 +02:00
580b381848 completed ACU hk parsing 2022-05-23 12:38:50 +02:00
c01f1d0191 run black 2022-05-23 11:25:33 +02:00
ea1e440407 start acu hk handling 2022-05-23 11:24:55 +02:00
20 changed files with 979 additions and 676 deletions

View File

@@ -10,6 +10,21 @@ list yields a list of all related PRs for each release.
# [unreleased]
# [v1.12.0]
- Add full regular reboot command
- Add Rad Sensor HK parsing
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/81
- Add procedures, parser functions and general application functionalities
for the thermal-vacuum test. This includes daemon functionality to poll
all Telemetry even when there is no operator present
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/76
https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/74
https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/79
https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/73
- Add ACU HK parsing
PR: https://egit.irs.uni-stuttgart.de/eive/eive-tmtc/pulls/80
# [v1.11.0]
- Add `setup.cfg` and `setup.py` file, allowing package installation

View File

@@ -79,7 +79,7 @@ HEATER_7_HPA = bytes([0x60, 0x00, 0x00, 0x07])
# RTDs
RTD_0_PLOC_HSPD = bytes([0x44, 0x42, 0x00, 0x16])
RTD_1_PLOC_MISSIONBRD= bytes([0x44, 0x42, 0x00, 0x17])
RTD_1_PLOC_MISSIONBRD = bytes([0x44, 0x42, 0x00, 0x17])
RTD_2_4K_CAM = bytes([0x44, 0x42, 0x00, 0x18])
RTD_3_DAC_HSPD = bytes([0x44, 0x42, 0x00, 0x19])
RTD_4_STR = bytes([0x44, 0x42, 0x00, 0x20])

View File

@@ -10,6 +10,7 @@ import enum
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.tc.definitions import PusTelecommand
from tmtccmd.utility import ObjectId
class GomspaceDeviceActionIds(enum.IntEnum):
@@ -43,7 +44,8 @@ class SetIds:
PDU_2_AUX = 4
P60_CORE = 5
P60_AUX = 6
ACU = 7
ACU_CORE = 7
ACU_AUX = 8
class TableIds:
@@ -67,7 +69,7 @@ class Channel:
def pack_get_param_command(
object_id: bytearray, table_id: int, memory_address: bytearray, parameter_size: int
object_id: bytes, table_id: int, memory_address: bytearray, parameter_size: int
) -> PusTelecommand:
"""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.
@@ -88,7 +90,7 @@ def pack_get_param_command(
def pack_set_param_command(
object_id: bytearray,
object_id: bytes,
memory_address: bytearray,
parameter_size: int,
parameter: int,
@@ -128,7 +130,7 @@ def pack_set_param_command(
)
def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
def pack_ping_command(object_id: ObjectId, data: bytearray) -> PusTelecommand:
""" " Function to generate the command to ping a gomspace device
@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
@@ -137,33 +139,35 @@ def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
data are simply copied by the device and then sent back.
"""
return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PING, app_data=data
object_id=object_id.as_bytes,
action_id=GomspaceDeviceActionIds.PING,
app_data=data,
)
def pack_gnd_wdt_reset_command(object_id: bytearray) -> PusTelecommand:
def pack_gnd_wdt_reset_command(object_id: ObjectId) -> PusTelecommand:
""" " Function to generate the command to reset the watchdog of a gomspace device.
@param object_id Object Id of the gomspace device handler.
"""
return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.WDT_RESET
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.WDT_RESET
)
def pack_reboot_command(object_id: bytearray) -> PusTelecommand:
def pack_reboot_command(object_id: ObjectId) -> PusTelecommand:
"""Function to generate the command which triggers a reboot of a gomspace device
@param object_id The object id of the gomspace device handler.
"""
return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.REBOOT
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REBOOT
)
def pack_request_full_hk_table_command(object_id: bytearray) -> PusTelecommand:
def pack_request_full_hk_table_command(object_id: ObjectId) -> PusTelecommand:
"""Function to generate the command to request the full housekeeping table from a gomspace
device.
@param object_id The object id of the gomspace device handler.
"""
return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.REQUEST_HK_TABLE
object_id=object_id.as_bytes, action_id=GomspaceDeviceActionIds.REQUEST_HK_TABLE
)

View File

@@ -1,4 +1,7 @@
from pus_tc.devs.gps import GpsOpCodes
from pus_tc.devs.pcdu import add_pcdu_cmds
from pus_tc.devs.rad_sensor import add_rad_sens_cmds
from pus_tc.system.core import add_core_controller_definitions
from tmtccmd.config import (
add_op_code_entry,
add_service_op_code_entry,
@@ -11,11 +14,10 @@ from pus_tc.devs.heater import add_heater_cmds
from pus_tc.devs.rtd import specify_rtd_cmds
from pus_tc.devs.reaction_wheels import add_rw_cmds
from pus_tc.devs.bpx_batt import BpxOpCodes
from tmtccmd.config.globals import get_default_service_op_code_dict
def get_eive_service_op_code_dict() -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict
service_op_code_dict = get_default_service_op_code_dict()
add_bpx_cmd_definitions(cmd_dict=service_op_code_dict)
add_core_controller_definitions(cmd_dict=service_op_code_dict)
@@ -320,67 +322,8 @@ def add_bpx_cmd_definitions(cmd_dict: ServiceOpCodeDictT):
)
def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
from pus_tc.system.core import OpCodes
od = dict()
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT, info="Reboot with Prompt")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_SELF, info="Reboot Self")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_0, info="Reboot 0 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_0_1, info="Reboot 0 1")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_0, info="Reboot 1 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_1_1, info="Reboot 1 1")
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
info="Enable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
info="Disable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
info="Reset all reboot counters",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_00,
info="Reset reboot counter 0 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_01,
info="Reset reboot counter 0 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_10,
info="Reset reboot counter 1 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.GET_HK,
info="Request housekeeping set",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
info="Reboot Self",
op_code_entry=od,
)
def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.devs.plpcdu import OpCodes, Info
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.SWITCH_ON, info=Info.SWITCH_ON
@@ -478,289 +421,6 @@ def add_time_cmds(cmd_dict: ServiceOpCodeDictT):
)
def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info
from pus_tc.devs.pdu1 import Pdu1OpCodes
from pus_tc.devs.pdu2 import Pdu2OpCodes
from gomspace.gomspace_common import Info as GsInfo
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_3V3_ON,
info=Info.STACK_3V3_ON,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_3V3_OFF,
info=Info.STACK_3V3_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_ON,
info=Info.STACK_5V_ON,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_OFF,
info=Info.STACK_5V_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="P60 Dock: Print Switches, Voltages, Currents",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="P60 Dock: Print Latchups",
)
add_op_code_entry(op_code_dict=op_code_dict, keys=P60OpCodes.TEST, info="P60 Tests")
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.P60DOCK.value,
info="P60 Device",
op_code_entry=op_code_dict,
)
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.TCS_BOARD_ON.value,
info="PDU1: Turn TCS board on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.TCS_BOARD_OFF.value,
info="PDU1: Turn TCS board off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.STAR_TRACKER_ON.value,
info="PDU1: Turn star tracker on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.STAR_TRACKER_OFF.value,
info="PDU1: Turn star tracker off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_ON.value,
info="PDU1: Turn SUS nominal on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_OFF.value,
info="PDU1: Turn SUS nominal off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_ON.value,
info="PDU1: Turn ACS A side on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_OFF.value,
info="PDU1: Turn ACS A side off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_ON.value,
info="PDU1: Turn Syrlinks on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_OFF.value,
info="PDU1: Turn Syrlinks off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_ON.value,
info="PDU1: Turn MGT on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_OFF.value,
info="PDU1: Turn MGT off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_ON.value,
info="PDU1: Turn PLOC on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_OFF.value,
info="PDU1: Turn PLOC off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_ON.value,
info="PDU1: Turn Solar Cell Experiment on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_OFF.value,
info="PDU1: Turn Solar Cell Experiment off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU1: Print Switches, Voltages, Currents",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU1: Print Latchups",
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests"
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.PDU1.value,
info="PDU1 Device",
op_code_entry=op_code_dict,
)
op_code_dict = dict()
add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU2 Tests")
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_ON.value,
info="PDU2: Turn ACS Side B on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value,
info="PDU2: Turn ACS Side B off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
info="PDU2: Turn SUS redundant on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
info="PDU2: Turn SUS redundant off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_ON.value,
info="PDU2: Turn reaction wheels on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_OFF.value,
info="PDU2: Turn reaction wheels off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value,
info="PDU2: Switch TCS Heater Input on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value,
info="PDU2: Switch TCS Heater Input off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value,
info="PDU2: Switch Solar Array Deployment On",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value,
info="PDU2: Switch Solar Array Deployment Off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_ON.value,
info="PDU2: Turn payload camera on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_OFF.value,
info="PDU2: Turn payload camera off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU2: Print Switches, Voltages, Currents",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU2: Print Latchups",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name="pdu2",
info="PDU2 Device",
op_code_entry=op_code_dict,
)
op_code_dict = {
"0": ("ACU: Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"51": ("ACU: Print channel statistics", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_tuple = ("ACU Devices", op_code_dict)
cmd_dict[CustomServiceList.ACU.value] = service_tuple
def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict_srv_imtq = {
"0": ("IMTQ Tests All", {OpCodeDictKeys.TIMEOUT: 2.0}),
@@ -777,20 +437,6 @@ def add_imtq_cmds(cmd_dict: ServiceOpCodeDictT):
cmd_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict_srv_rad_sensor = {
"0": ("Radiation Sensor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"1": ("Radiation Sensor: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"2": ("Radiation Sensor: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Radiation Sensor: Start conversions", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Radiation Sensor: Read conversions", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Radiation Sensor: Enable debug output", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("Radiation Sensor: Disable debug putput", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_rad_sensor_tuple = ("Radiation Sensor", op_code_dict_srv_rad_sensor)
cmd_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
def add_ploc_mpsoc_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict_srv_ploc_mpsoc = {
"0": ("Ploc MPSoC: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),

View File

@@ -1,15 +1,105 @@
# -*- coding: utf-8 -*-
"""
@file tmtcc_tc_acu.py
@brief ACU tests
@author J. Meier
"""ACU commands
@author J. Meier, R. Mueller
@date 21.12.2020
"""
import struct
from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
from tmtccmd.tc.packer import TcQueueT
from tmtccmd.config.definitions import QueueCommands
from gomspace.gomspace_common import *
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.tc.pus_3_fsfw_hk import (
make_sid,
generate_one_diag_command,
generate_one_hk_command,
)
import gomspace.gomspace_common as gs
from gomspace.gomspace_common import GomspaceOpCodes
from gomspace.gomspace_common import Info as GsInfo
from config.object_ids import ACU_HANDLER_ID
from pus_tc.devs.p60dock import P60DockConfigTable
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.utility import ObjectId
class ACUConfigTable:
mppt_mode = gs.TableEntry(bytearray([0x00, 0x00]), gs.TableEntry.uint8_size)
mppt_d_mode = gs.TableEntry(bytearray([0x00, 0x01]), gs.TableEntry.uint8_size)
vboost = gs.TableEntry(bytearray([0x00, 0x02]), gs.TableEntry.uint16_size)
vbat_max_hi = gs.TableEntry(bytearray([0x00, 0x10]), gs.TableEntry.uint16_size)
vbat_max_lo = gs.TableEntry(bytearray([0x00, 0x12]), gs.TableEntry.uint16_size)
ov_mode = gs.TableEntry(bytearray([0x00, 0x1A]), gs.TableEntry.uint8_size)
class ACUHkTable:
temperature1 = gs.TableEntry(bytearray([0x00, 0x1C]), gs.TableEntry.uint16_size)
temperature2 = gs.TableEntry(bytearray([0x00, 0x1D]), gs.TableEntry.uint16_size)
temperature3 = gs.TableEntry(bytearray([0x00, 0x1E]), gs.TableEntry.uint16_size)
# Ground WDT value (remaining seconds until reboot)
wdt_gnd_left = gs.TableEntry(bytearray([0x00, 0x74]), gs.TableEntry.uint32_size)
class OpCodes:
TEST = ["0", "test"]
class Info:
TEST = "ACU Test"
def add_acu_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.TEST, info=Info.TEST)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict,
name=CustomServiceList.ACU.value,
info="ACU Device",
)
def pack_acu_commands(
object_id: ObjectId, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Handling ACU command"))
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Print channel stats"))
command = generate_action_command(
object_id=object_id.as_bytes,
action_id=gs.GomspaceDeviceActionIds.PRINT_SWITCH_V_I,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
tc_queue.appendleft(
(QueueCommands.PRINT, f"PDU1: {GsInfo.REQUEST_CORE_HK_ONCE}")
)
hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_CORE)
command = generate_one_diag_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
tc_queue.appendleft(
(QueueCommands.PRINT, f"PDU1: {GsInfo.REQUEST_AUX_HK_ONCE}")
)
hk_sid = make_sid(object_id=object_id.as_bytes, set_id=gs.SetIds.ACU_AUX)
command = generate_one_hk_command(sid=hk_sid, ssc=0)
tc_queue.appendleft(command.pack_command_tuple())
pack_test_cmds(object_id=object_id, tc_queue=tc_queue)
return tc_queue
class ACUTestProcedure:
@@ -26,59 +116,28 @@ class ACUTestProcedure:
ping = False
read_temperature1 = False
read_temperature2 = False
read_temperature3 = True
read_mppt_mode = True
read_vboost = True
read_vbat_max_hi = True
read_vbat_max_lo = True
read_ov_mode = True
read_temperature3 = False
read_mppt_mode = False
read_vboost = False
read_vbat_max_hi = False
read_vbat_max_lo = False
read_ov_mode = False
off = False
class ACUConfigTable:
mppt_mode = TableEntry(bytearray([0x00, 0x00]), TableEntry.uint8_size)
mppt_d_mode = TableEntry(bytearray([0x00, 0x01]), TableEntry.uint8_size)
vboost = TableEntry(bytearray([0x00, 0x02]), TableEntry.uint16_size)
vbat_max_hi = TableEntry(bytearray([0x00, 0x10]), TableEntry.uint16_size)
vbat_max_lo = TableEntry(bytearray([0x00, 0x12]), TableEntry.uint16_size)
ov_mode = TableEntry(bytearray([0x00, 0x1A]), TableEntry.uint8_size)
class ACUHkTable:
temperature1 = TableEntry(bytearray([0x00, 0x1C]), TableEntry.uint16_size)
temperature2 = TableEntry(bytearray([0x00, 0x1D]), TableEntry.uint16_size)
temperature3 = TableEntry(bytearray([0x00, 0x1E]), TableEntry.uint16_size)
# Ground WDT value (remaining seconds until reboot)
wdt_gnd_left = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint32_size)
class CommandId:
PRINT_CHANNEL_STATS = 51
def pack_acu_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU"))
if op_code == "51":
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Print channel stats"))
command = object_id + struct.pack("!I", CommandId.PRINT_CHANNEL_STATS)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return
def pack_test_cmds(object_id: ObjectId, tc_queue: TcQueueT):
if ACUTestProcedure.all or ACUTestProcedure.reboot:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reboot"))
command = pack_reboot_command(object_id)
command = gs.pack_reboot_command(object_id)
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt:
tc_queue.appendleft(
(QueueCommands.PRINT, "ACU: Reading ground watchdog timer value")
)
command = pack_get_param_command(
object_id,
TableIds.hk,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.hk,
ACUHkTable.wdt_gnd_left.parameter_address,
ACUHkTable.wdt_gnd_left.parameter_size,
)
@@ -86,20 +145,20 @@ def pack_acu_test_into(
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.gnd_wdt_reset:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Testing ground watchdog reset"))
command = pack_gnd_wdt_reset_command(object_id)
command = gs.pack_gnd_wdt_reset_command(object_id)
# command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.ping:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Ping Test"))
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
command = pack_ping_command(object_id, ping_data)
command = gs.pack_ping_command(object_id, ping_data)
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_temperature3:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3"))
command = pack_get_param_command(
object_id,
TableIds.hk,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.hk,
ACUHkTable.temperature3.parameter_address,
ACUHkTable.temperature3.parameter_size,
)
@@ -107,9 +166,9 @@ def pack_acu_test_into(
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vboost:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value"))
command = pack_get_param_command(
object_id,
TableIds.config,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.config,
ACUConfigTable.vboost.parameter_address,
ACUConfigTable.vboost.parameter_size,
)
@@ -117,9 +176,9 @@ def pack_acu_test_into(
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_hi"))
command = pack_get_param_command(
object_id,
TableIds.config,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.config,
ACUConfigTable.vbat_max_hi.parameter_address,
ACUConfigTable.vbat_max_hi.parameter_size,
)
@@ -127,9 +186,9 @@ def pack_acu_test_into(
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_lo"))
command = pack_get_param_command(
object_id,
TableIds.config,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.config,
ACUConfigTable.vbat_max_lo.parameter_address,
ACUConfigTable.vbat_max_lo.parameter_size,
)
@@ -137,23 +196,20 @@ def pack_acu_test_into(
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ov_mode"))
command = pack_get_param_command(
object_id,
TableIds.config,
command = gs.pack_get_param_command(
object_id.as_bytes,
gs.TableIds.config,
ACUConfigTable.ov_mode.parameter_address,
ACUConfigTable.ov_mode.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU"))
command = pack_set_param_command(
p60dock_object_id,
P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size,
Channel.off,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if ACUTestProcedure.all or ACUTestProcedure.off:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU"))
command = gs.pack_set_param_command(
ACU_HANDLER_ID,
P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size,
gs.Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())

View File

@@ -87,11 +87,12 @@ class P60DockHkTable:
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
def pack_p60dock_cmds(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
objb = object_id.as_bytes
if op_code in P60OpCodes.STACK_3V3_ON:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_ON))
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.on,
@@ -100,7 +101,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code in P60OpCodes.STACK_3V3_OFF:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_OFF))
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.off,
@@ -109,7 +110,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code in P60OpCodes.STACK_5V_ON:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_ON))
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_10.parameter_address,
P60DockConfigTable.out_en_10.parameter_size,
Channel.on,
@@ -118,7 +119,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code in P60OpCodes.STACK_5V_OFF:
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_OFF))
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_10.parameter_address,
P60DockConfigTable.out_en_10.parameter_size,
Channel.off,
@@ -143,13 +144,13 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")
)
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
@@ -162,7 +163,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")
)
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
P60DockHkTable.wdt_gnd_left.parameter_address,
P60DockHkTable.wdt_gnd_left.parameter_size,
@@ -188,7 +189,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
parameter = 0 # set channel off
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
parameter,
@@ -200,7 +201,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "P60 Dock: Testing temperature reading")
)
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
@@ -212,7 +213,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "P60 Dock: Testing Output Channel 3 state (PDU2)")
)
command = pack_get_param_command(
object_id,
objb,
TableIds.config,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
@@ -227,7 +228,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
)
command = pack_get_param_command(
object_id,
objb,
TableIds.config,
P60DockConfigTable.cur_lu_lim_0.parameter_address,
P60DockConfigTable.cur_lu_lim_0.parameter_size,
@@ -240,7 +241,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
parameter = 1 # set channel on
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
parameter,
@@ -253,7 +254,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
table_id_invalid = 5
command = pack_get_param_command(
object_id,
objb,
table_id_invalid,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
@@ -269,7 +270,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
invalid_address = bytearray([0x01, 0xF4])
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
invalid_address,
P60DockHkTable.temperature1.parameter_size,
@@ -286,7 +287,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
parameter_size = 2
parameter = 1
command = pack_set_param_command(
object_id, invalid_address, parameter_size, parameter
objb, invalid_address, parameter_size, parameter
)
# command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
@@ -299,7 +300,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
invalid_size = 5
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
P60DockHkTable.temperature1.parameter_address,
invalid_size,
@@ -314,7 +315,7 @@ def pack_p60dock_cmds(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
parameter = 1
command = pack_set_param_command(
object_id,
objb,
P60DockConfigTable.out_en_3.parameter_address,
invalid_size,
parameter,

297
pus_tc/devs/pcdu.py Normal file
View File

@@ -0,0 +1,297 @@
from config.definitions import CustomServiceList
from tmtccmd.config import (
ServiceOpCodeDictT,
add_op_code_entry,
add_service_op_code_entry,
OpCodeDictKeys,
)
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, Info
from pus_tc.devs.pdu1 import Pdu1OpCodes
from pus_tc.devs.pdu2 import Pdu2OpCodes
from pus_tc.devs.acu import add_acu_cmds
from gomspace.gomspace_common import Info as GsInfo
def add_p60_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_3V3_ON,
info=Info.STACK_3V3_ON,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_3V3_OFF,
info=Info.STACK_3V3_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_ON,
info=Info.STACK_5V_ON,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=P60OpCodes.STACK_5V_OFF,
info=Info.STACK_5V_OFF,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="P60 Dock: Print Switches, Voltages, Currents",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="P60 Dock: Print Latchups",
)
add_op_code_entry(op_code_dict=op_code_dict, keys=P60OpCodes.TEST, info="P60 Tests")
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.P60DOCK.value,
info="P60 Device",
op_code_entry=op_code_dict,
)
def add_pdu1_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.TCS_BOARD_OFF.value,
info="PDU1: Turn TCS board off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.STAR_TRACKER_ON.value,
info="PDU1: Turn star tracker on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.STAR_TRACKER_OFF.value,
info="PDU1: Turn star tracker off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_ON.value,
info="PDU1: Turn SUS nominal on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SUS_NOMINAL_OFF.value,
info="PDU1: Turn SUS nominal off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_ON.value,
info="PDU1: Turn ACS A side on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.ACS_A_SIDE_OFF.value,
info="PDU1: Turn ACS A side off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_ON.value,
info="PDU1: Turn Syrlinks on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SYRLINKS_OFF.value,
info="PDU1: Turn Syrlinks off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_ON.value,
info="PDU1: Turn MGT on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.MGT_OFF.value,
info="PDU1: Turn MGT off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_ON.value,
info="PDU1: Turn PLOC on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.PLOC_OFF.value,
info="PDU1: Turn PLOC off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_ON.value,
info="PDU1: Turn Solar Cell Experiment on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.SCEX_OFF.value,
info="PDU1: Turn Solar Cell Experiment off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU1: Print Switches, Voltages, Currents",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu1OpCodes.TCS_BOARD_ON.value,
info="PDU1: Turn TCS board on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU1: Print Latchups",
)
add_op_code_entry(
op_code_dict=op_code_dict, keys=Pdu1OpCodes.TESTS.value, info="PDU1 Tests"
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.PDU1.value,
info="PDU1 Device",
op_code_entry=op_code_dict,
)
def add_pdu2_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU2 Tests")
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_ON.value,
info="PDU2: Turn ACS Side B on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value,
info="PDU2: Turn ACS Side B off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
info="PDU2: Turn SUS redundant on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
info="PDU2: Turn SUS redundant off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_ON.value,
info="PDU2: Turn reaction wheels on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_OFF.value,
info="PDU2: Turn reaction wheels off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value,
info="PDU2: Switch TCS Heater Input on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value,
info="PDU2: Switch TCS Heater Input off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_ON.value,
info="PDU2: Switch Solar Array Deployment On",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SOLAR_ARRAY_DEPL_OFF.value,
info="PDU2: Switch Solar Array Deployment Off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_ON.value,
info="PDU2: Turn payload camera on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_CAMERA_OFF.value,
info="PDU2: Turn payload camera off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU2: Print Switches, Voltages, Currents",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU2: Print Latchups",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name="pdu2",
info="PDU2 Device",
op_code_entry=op_code_dict,
)
def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
add_p60_cmds(cmd_dict)
add_pdu1_cmds(cmd_dict)
add_pdu2_cmds(cmd_dict)
add_acu_cmds(cmd_dict)

View File

@@ -54,13 +54,13 @@ class PDU1TestProcedure:
turn_channel_3_off = False
def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
def pack_pdu1_commands(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Commanding PDU1"))
objb = object_id.as_bytes
if op_code == Pdu1OpCodes.TCS_BOARD_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size,
Channel.on,
@@ -69,7 +69,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size,
Channel.off,
@@ -78,7 +78,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
@@ -87,7 +87,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
@@ -96,7 +96,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
@@ -105,7 +105,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
@@ -114,7 +114,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
@@ -123,7 +123,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
@@ -132,7 +132,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
@@ -143,7 +143,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment on")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size,
Channel.on,
@@ -154,7 +154,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU1: Turn Solar Cell Experiment off")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size,
Channel.off,
@@ -163,7 +163,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SYRLINKS_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.on,
@@ -172,7 +172,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SYRLINKS_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.off,
@@ -181,7 +181,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.MGT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
@@ -190,7 +190,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.MGT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,
@@ -199,7 +199,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.PLOC_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn PLOC on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.on,
@@ -208,7 +208,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.PLOC_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn PLOC off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.off,
@@ -229,13 +229,13 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
)
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
@@ -246,7 +246,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
@@ -257,7 +257,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
@@ -268,7 +268,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
@@ -277,7 +277,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
@@ -286,7 +286,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,

View File

@@ -66,13 +66,13 @@ class PDU2TestProcedure:
request_hk_table = False
def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
def pack_pdu2_commands(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2"))
objb = object_id.as_bytes
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
@@ -82,7 +82,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
@@ -92,7 +92,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.Q7S_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "Turning off Q7S OBC"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size,
Channel.off,
@@ -101,7 +101,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
@@ -110,7 +110,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
@@ -119,7 +119,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.RW_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
@@ -128,7 +128,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.RW_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
@@ -139,7 +139,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 on")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.on,
@@ -150,7 +150,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 off")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.off,
@@ -161,7 +161,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 on")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.off,
@@ -172,7 +172,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 off")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.off,
@@ -181,7 +181,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
@@ -190,7 +190,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,
@@ -201,7 +201,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn Solar Array Deployment On")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size,
Channel.on,
@@ -212,7 +212,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Turn Solar Array Deployment Off")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_5.parameter_address,
PDUConfigTable.out_en_5.parameter_size,
Channel.off,
@@ -221,7 +221,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.PL_CAMERA_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera on"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_8.parameter_address,
PDUConfigTable.out_en_8.parameter_size,
Channel.on,
@@ -230,7 +230,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu2OpCodes.PL_CAMERA_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera off"))
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_8.parameter_address,
PDUConfigTable.out_en_8.parameter_size,
Channel.off,
@@ -251,13 +251,13 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")
)
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
@@ -269,7 +269,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")
)
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size,
@@ -294,7 +294,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
@@ -303,7 +303,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading"))
command = pack_get_param_command(
object_id,
objb,
TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
@@ -314,7 +314,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)")
)
command = pack_get_param_command(
object_id,
objb,
TableIds.config,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
@@ -328,7 +328,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
)
command = pack_get_param_command(
object_id,
objb,
TableIds.config,
PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size,
@@ -339,7 +339,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")
)
command = pack_set_param_command(
object_id,
objb,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,

View File

@@ -7,11 +7,37 @@
"""
import struct
from tmtccmd.config.definitions import QueueCommands
from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT, OpCodeDictKeys
from tmtccmd.tc.packer import TcQueueT
from spacepackets.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data, Modes
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from tmtccmd.utility import ObjectId
class SetIds:
HK = 3
class OpCodes:
ON = ["0", "on"]
NORMAL = ["1", "normal"]
OFF = ["2", "off"]
REQ_HK_ONCE = ["3", "hk-os"]
DEBUG_ON = ["10", "dbg-on"]
DEBUG_OFF = ["11", "dbg-off"]
class Info:
ON = "Switch Rad Sensor on"
NORMAL = "Switch Rad Sensor normal"
OFF = "Switch Rad sensor off"
REQ_OS_HK = "Request one-shot HK"
DEBUG_ON = "Switch debug output on"
DEBUG_OFF = "Switch debug output off"
class CommandIds:
@@ -21,52 +47,64 @@ class CommandIds:
DISABLE_DEBUG_OUTPUT = 5
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft(
(
QueueCommands.PRINT,
"Testing radiation sensor handler with object id: 0x" + object_id.hex(),
)
def add_rad_sens_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(op_code_dict=op_code_dict, info=Info.ON, keys=OpCodes.ON)
add_op_code_entry(op_code_dict=op_code_dict, info=Info.OFF, keys=OpCodes.OFF)
add_op_code_entry(op_code_dict=op_code_dict, info=Info.NORMAL, keys=OpCodes.NORMAL)
add_op_code_entry(
op_code_dict=op_code_dict, info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE
)
add_op_code_entry(
op_code_dict=op_code_dict, info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON
)
add_op_code_entry(
op_code_dict=op_code_dict, info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.RAD_SENSOR.value,
info="Radiation Sensor",
op_code_entry=op_code_dict,
)
if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode on"))
mode_data = pack_mode_data(object_id, Modes.ON, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode normal"))
mode_data = pack_mode_data(object_id, Modes.NORMAL, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())
def pack_rad_sensor_test_into(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft(
(QueueCommands.PRINT, f"Commanding Radiation sensor handler {object_id}")
)
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off"))
mode_data = pack_mode_data(object_id, Modes.OFF, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
if op_code in OpCodes.ON:
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, tc_queue)
if op_code in OpCodes.NORMAL:
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, tc_queue)
if op_code in OpCodes.OFF:
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, tc_queue)
if op_code in OpCodes.REQ_HK_ONCE:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.REQ_OS_HK}"))
cmd = generate_one_hk_command(
sid=make_sid(object_id.as_bytes, set_id=SetIds.HK), ssc=0
)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.DEBUG_ON:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_ON}"))
command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Start conversions"))
command = object_id + struct.pack("!I", CommandIds.START_CONVERSIONS)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Read conversions"))
command = object_id + struct.pack("!I", CommandIds.READ_CONVERSIONS)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Enable debug output"))
command = object_id + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
if op_code in OpCodes.DEBUG_OFF:
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {Info.DEBUG_OFF}"))
command = object_id.as_bytes + struct.pack(
"!I", CommandIds.DISABLE_DEBUG_OUTPUT
)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Disable debug output"))
command = object_id + struct.pack("!I", CommandIds.DISABLE_DEBUG_OUTPUT)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def rad_sensor_mode_cmd(
object_id: ObjectId, mode: Modes, info: str, tc_queue: TcQueueT
):
tc_queue.appendleft((QueueCommands.PRINT, f"Rad sensor: {info}"))
mode_data = pack_mode_data(object_id.as_bytes, mode, 0)
command = PusTelecommand(service=200, subservice=1, ssc=41, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple())

View File

@@ -2,7 +2,11 @@ from typing import Optional
from config.definitions import CustomServiceList
from spacepackets.ecss import PusTelecommand
from tmtccmd.config import ServiceOpCodeDictT, add_op_code_entry, add_service_op_code_entry
from tmtccmd.config import (
ServiceOpCodeDictT,
add_op_code_entry,
add_service_op_code_entry,
)
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.utility import ObjectId
from tmtccmd.tc.pus_200_fsfw_modes import Modes, pack_mode_data, Subservices
@@ -25,7 +29,7 @@ RTD_IDS = [
oids.RTD_12_ACU,
oids.RTD_13_PLPCDU_HSPD,
oids.RTD_14_TCS_BRD,
oids.RTD_15_IMTQ
oids.RTD_15_IMTQ,
]
@@ -43,26 +47,14 @@ class Info:
def specify_rtd_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.ON,
info=Info.ON
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.NORMAL,
info=Info.NORMAL
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.OFF,
info=Info.OFF
)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.ON, info=Info.ON)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.NORMAL, info=Info.NORMAL)
add_op_code_entry(op_code_dict=op_code_dict, keys=OpCodes.OFF, info=Info.OFF)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
op_code_entry=op_code_dict,
name=CustomServiceList.RTD.value,
info="RTD commands"
info="RTD commands",
)
@@ -75,27 +67,27 @@ def pack_rtd_commands(op_code: str, object_id: Optional[ObjectId], tc_queue: TcQ
object_id_dict = get_object_ids()
object_id = object_id_dict.get(RTD_IDS[tgt_rtd_idx])
if op_code in OpCodes.ON:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.ON, submode=0)
app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.ON, submode=0
)
cmd = PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.NORMAL:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0)
app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.NORMAL, submode=0
)
cmd = PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.OFF:
app_data = pack_mode_data(object_id=object_id.as_bytes, mode=Modes.OFF, submode=0)
app_data = pack_mode_data(
object_id=object_id.as_bytes, mode=Modes.OFF, submode=0
)
cmd = PusTelecommand(
service=200,
subservice=Subservices.TC_MODE_COMMAND,
app_data=app_data
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=app_data
)
tc_queue.appendleft(cmd.pack_command_tuple())

View File

@@ -1,5 +1,11 @@
from PyQt5.QtWidgets import (
QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QGroupBox, QGridLayout, QLineEdit
QDialog,
QDialogButtonBox,
QVBoxLayout,
QLabel,
QGroupBox,
QGridLayout,
QLineEdit,
)
from PyQt5 import QtCore
@@ -16,12 +22,13 @@ class Parameter:
self.widget = widget
self.value = self.defaultValue
self.widget.setPlaceholderText(self.defaultValue)
def reset(self):
self.value = self.defaultValue
self.widget.setPlaceholderText(self.defaultValue)
self.widget.setText("")
class ParameterDialog(QDialog):
def __init__(self):
super().__init__()
@@ -42,7 +49,7 @@ class ParameterDialog(QDialog):
self.rootLayout.addWidget(self.group)
self.rootLayout.addWidget(self.buttonBox)
self.setLayout(self.rootLayout)
self.groupLayout = QGridLayout()
self.group.setLayout(self.groupLayout)
@@ -59,7 +66,6 @@ class ParameterDialog(QDialog):
self.parameters[name] = parameter
def _reset(self):
for value in self.parameters.values():
value.reset()
@@ -80,14 +86,13 @@ class ParameterDialog(QDialog):
super().reject()
"""Prompt the user to specify additional Parameters
:param parameterList: array of dictionaries with name and defaultValue attributes
:return: dict with all names as key and user supplied input as value string
"""
def prompt_parameters(parameterList):
gui = get_global(CoreGlobalIds.GUI)
mode = get_global(CoreGlobalIds.MODE)
@@ -95,9 +100,10 @@ def prompt_parameters(parameterList):
# gui only works in cont mode right now
if gui and mode == CoreModeList.CONTINUOUS_MODE:
return _gui_prompt(parameterList)
else:
else:
return _cli_prompt(parameterList)
def _gui_prompt(parameterList):
dialog = ParameterDialog()
for parameter in parameterList:
@@ -105,11 +111,14 @@ def _gui_prompt(parameterList):
dialog.exec_()
return dialog.getParameters()
def _cli_prompt(parameterList):
result = {}
for parameter in parameterList:
userInput = input("Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"]))
userInput = input(
"Specify {} [{}]: ".format(parameter["name"], parameter["defaultValue"])
)
if userInput == "":
userInput = parameter["defaultValue"]
result[parameter["name"]] = userInput
return result
return result

View File

@@ -18,8 +18,12 @@ class Info:
def pack_controller_commands(tc_queue: TcQueueT, op_code: str):
parameters = prompt_parameters([{"name": "Mode", "defaultValue": "2"}, {
"name": "Submode", "defaultValue": "0"}])
parameters = prompt_parameters(
[
{"name": "Mode", "defaultValue": "2"},
{"name": "Submode", "defaultValue": "0"},
]
)
mode = int(parameters["Mode"])
if mode < 0 or mode > 2:
print("Invalid Mode, defaulting to OFF")

View File

@@ -1,6 +1,8 @@
import enum
from tmtccmd.config.definitions import QueueCommands
from config.definitions import CustomServiceList
from tmtccmd.config import add_op_code_entry, add_service_op_code_entry
from tmtccmd.config.definitions import QueueCommands, ServiceOpCodeDictT
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.logging import get_console_logger
@@ -19,7 +21,8 @@ class ActionIds(enum.IntEnum):
RESET_REBOOT_COUNTER_10 = 9
RESET_REBOOT_COUNTER_11 = 10
SET_MAX_REBOOT_CNT = 11
REBOOT = 32
XSC_REBOOT = 32
FULL_REBOOT = 34
class SetIds(enum.IntEnum):
@@ -27,21 +30,27 @@ class SetIds(enum.IntEnum):
class OpCodes:
REBOOT = ["0", "reboot"]
REBOOT_SELF = ["1", "reboot_self"]
REBOOT_0_0 = ["2", "reboot_0_0"]
REBOOT_0_1 = ["3", "reboot_0_1"]
REBOOT_1_0 = ["4", "reboot_1_0"]
REBOOT_1_1 = ["5", "reboot_1_1"]
ENABLE_REBOOT_FILE_HANDLING = ["6", "rbh-off"]
DISABLE_REBOOT_FILE_HANDLING = ["7", "rbh-on"]
RESET_ALL_REBOOT_COUNTERS = ["8", "rbh-reset-a"]
RESET_REBOOT_COUNTER_00 = ["9", "rbh-reset-00"]
RESET_REBOOT_COUNTER_01 = ["10", "rbh-reset-01"]
RESET_REBOOT_COUNTER_10 = ["11", "rbh-reset-10"]
RESET_REBOOT_COUNTER_11 = ["12", "rbh-reset-11"]
SET_MAX_REBOOT_CNT = ["13", "rbh-max-cnt"]
GET_HK = ["14", "get-hk"]
REBOOT_XSC = ["0", "reboot-xsc"]
XSC_REBOOT_SELF = ["1", "reboot-self"]
XSC_REBOOT_0_0 = ["2", "reboot-00"]
XSC_REBOOT_0_1 = ["3", "reboot-01"]
XSC_REBOOT_1_0 = ["4", "reboot-10"]
XSC_REBOOT_1_1 = ["5", "reboot-11"]
REBOOT_FULL = ["6", "reboot-regular"]
GET_HK = ["7", "get-hk"]
ENABLE_REBOOT_FILE_HANDLING = ["32", "rbh-off"]
DISABLE_REBOOT_FILE_HANDLING = ["33", "rbh-on"]
RESET_ALL_REBOOT_COUNTERS = ["34", "rbh-reset-a"]
RESET_REBOOT_COUNTER_00 = ["35", "rbh-reset-00"]
RESET_REBOOT_COUNTER_01 = ["36", "rbh-reset-01"]
RESET_REBOOT_COUNTER_10 = ["37", "rbh-reset-10"]
RESET_REBOOT_COUNTER_11 = ["38", "rbh-reset-11"]
SET_MAX_REBOOT_CNT = ["39", "rbh-max-cnt"]
class Info:
REBOOT_XSC = "XSC reboot with prompt"
REBOOT_FULL = "Full regular reboot"
class Chip(enum.IntEnum):
@@ -56,8 +65,65 @@ class Copy(enum.IntEnum):
NONE = 2
def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
od = dict()
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_XSC, info=Info.REBOOT_XSC)
add_op_code_entry(op_code_dict=od, keys=OpCodes.REBOOT_FULL, info=Info.REBOOT_FULL)
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_SELF, info="Reboot Self")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_0, info="Reboot 0 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_0_1, info="Reboot 0 1")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_0, info="Reboot 1 0")
add_op_code_entry(op_code_dict=od, keys=OpCodes.XSC_REBOOT_1_1, info="Reboot 1 1")
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.GET_HK,
info="Request housekeeping set",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.ENABLE_REBOOT_FILE_HANDLING,
info="Enable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.DISABLE_REBOOT_FILE_HANDLING,
info="Disable reboot file handling",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_ALL_REBOOT_COUNTERS,
info="Reset all reboot counters",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_00,
info="Reset reboot counter 0 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_01,
info="Reset reboot counter 0 1",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_10,
info="Reset reboot counter 1 0",
)
add_op_code_entry(
op_code_dict=od,
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
info="Core Controller",
op_code_entry=od,
)
def pack_core_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.REBOOT:
if op_code in OpCodes.REBOOT_XSC:
reboot_self, chip_select, copy_select = determine_reboot_params()
perform_reboot_cmd(
tc_queue=tc_queue,
@@ -65,31 +131,35 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
chip=chip_select,
copy=copy_select,
)
elif op_code in OpCodes.REBOOT_SELF:
if op_code in OpCodes.REBOOT_FULL:
tc_queue.appendleft((QueueCommands.PRINT, f"Core Command: {Info.REBOOT_FULL}"))
cmd = generate_action_command(object_id=CORE_CONTROLLER_ID, action_id=ActionIds.FULL_REBOOT)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in OpCodes.XSC_REBOOT_SELF:
perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True)
elif op_code in OpCodes.REBOOT_0_0:
if op_code in OpCodes.XSC_REBOOT_0_0:
perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_0_NOM
)
elif op_code in OpCodes.REBOOT_0_1:
if op_code in OpCodes.XSC_REBOOT_0_1:
perform_reboot_cmd(
tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD,
)
elif op_code in OpCodes.REBOOT_1_0:
if op_code in OpCodes.XSC_REBOOT_1_0:
perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_0_NOM
)
elif op_code in OpCodes.REBOOT_1_1:
if op_code in OpCodes.XSC_REBOOT_1_1:
perform_reboot_cmd(
tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD,
)
elif op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
if op_code in OpCodes.DISABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Disabling reboot file handling"))
app_data = bytearray([0])
generate_action_command(
@@ -97,7 +167,7 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
)
elif op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
if op_code in OpCodes.ENABLE_REBOOT_FILE_HANDLING:
tc_queue.appendleft((QueueCommands.PRINT, "Enabling reboot file handling"))
app_data = bytearray([1])
generate_action_command(
@@ -105,32 +175,32 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
action_id=ActionIds.SWITCH_REBOOT_FILE_HANDLING,
app_data=app_data,
)
elif op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
if op_code in OpCodes.RESET_ALL_REBOOT_COUNTERS:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting all reboot counters"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_ALL_REBOOT_COUNTERS
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_00:
if op_code in OpCodes.RESET_REBOOT_COUNTER_00:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 0"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_00
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_01:
if op_code in OpCodes.RESET_REBOOT_COUNTER_01:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 0 1"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_01
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_10:
if op_code in OpCodes.RESET_REBOOT_COUNTER_10:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 0"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_10
)
elif op_code in OpCodes.RESET_REBOOT_COUNTER_11:
if op_code in OpCodes.RESET_REBOOT_COUNTER_11:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counter 1 1"))
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11
)
elif op_code in OpCodes.GET_HK:
if op_code in OpCodes.GET_HK:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting housekeeping set"))
sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetIds.HK)
command = generate_one_hk_command(sid, 201)
@@ -192,7 +262,7 @@ def perform_reboot_cmd(
)
action_cmd = generate_action_command(
object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.REBOOT,
action_id=ActionIds.XSC_REBOOT,
app_data=tc_data,
ssc=0,
)

View File

@@ -21,7 +21,7 @@ from pus_tc.devs.p60dock import pack_p60dock_cmds
from pus_tc.devs.pdu2 import pack_pdu2_commands
from pus_tc.devs.pdu1 import pack_pdu1_commands
from pus_tc.devs.bpx_batt import pack_bpx_commands
from pus_tc.devs.acu import pack_acu_test_into
from pus_tc.devs.acu import pack_acu_commands
from pus_tc.devs.solar_array_deployment import pack_solar_array_deployment_test_into
from pus_tc.devs.imtq import pack_imtq_test_into
from pus_tc.devs.tmp1075 import pack_tmp1075_test_into
@@ -45,6 +45,7 @@ from pus_tc.system.proc import pack_proc_commands
from pus_tc.system.controllers import pack_controller_commands
from config.definitions import CustomServiceList
from config.object_ids import (
get_object_ids,
P60_DOCK_HANDLER,
PDU_1_HANDLER_ID,
PDU_2_HANDLER_ID,
@@ -70,6 +71,7 @@ from config.object_ids import (
SYRLINKS_HANDLER_ID,
SOLAR_ARRAY_DEPLOYMENT_ID,
RW_ASSEMBLY,
get_object_ids,
)
@@ -99,6 +101,7 @@ def pre_tc_send_cb(
def pack_service_queue_user(
service: Union[str, int], op_code: str, service_queue: TcQueueT
):
obj_id_man = get_object_ids()
if service == CoreServiceList.SERVICE_5.value:
return pack_generic_service5_test_into(tc_queue=service_queue)
if service == CoreServiceList.SERVICE_17.value:
@@ -108,25 +111,27 @@ def pack_service_queue_user(
if service == CoreServiceList.SERVICE_200.value:
return pack_service200_test_into(tc_queue=service_queue)
if service == CustomServiceList.P60DOCK.value:
object_id = P60_DOCK_HANDLER
object_id = obj_id_man.get(P60_DOCK_HANDLER)
return pack_p60dock_cmds(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.RTD.value:
return pack_rtd_commands(object_id=None, tc_queue=service_queue, op_code=op_code)
return pack_rtd_commands(
object_id=None, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU1.value:
object_id = PDU_1_HANDLER_ID
object_id = obj_id_man.get(PDU_1_HANDLER_ID)
return pack_pdu1_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU2.value:
object_id = PDU_2_HANDLER_ID
object_id = obj_id_man.get(PDU_2_HANDLER_ID)
return pack_pdu2_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.ACU.value:
object_id = ACU_HANDLER_ID
return pack_acu_test_into(
object_id = obj_id_man.get(ACU_HANDLER_ID)
return pack_acu_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.BPX_BATTERY.value:
@@ -173,7 +178,7 @@ def pack_service_queue_user(
object_id=RW4_ID, rw_idx=4, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.RAD_SENSOR.value:
object_id = RAD_SENSOR_ID
object_id = obj_id_man.get(RAD_SENSOR_ID)
return pack_rad_sensor_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)

View File

@@ -1,4 +1,5 @@
import struct
from typing import List, Tuple
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from pus_tm.defs import PrintWrapper
@@ -87,6 +88,50 @@ class WdtInfo:
return current_idx
class DevicesInfoParser:
def __init__(self):
self.dev_types = None
self.dev_statuses = None
def parse(self, hk_data: bytes, current_idx: int) -> int:
self.dev_types = []
self.dev_statuses = []
for idx in range(8):
self.dev_types.append(hk_data[current_idx])
current_idx += 1
for idx in range(8):
self.dev_statuses.append(hk_data[current_idx])
current_idx += 1
return current_idx
def print(self, pw: PrintWrapper):
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
for i in range(len(self.dev_types)):
pw.dlog(
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
)
@staticmethod
def map_idx_to_type(devtype: int) -> str:
if devtype == 0:
return "Reserved"
if devtype == 1:
return "ADC"
if devtype == 2:
return "ADC"
if devtype == 3:
return "DAC"
if devtype == 4:
return "Temperature Sensor"
if devtype == 5:
return "Temperature Sensor (Bat Pack)"
if devtype == 6:
return "RTC"
if devtype == 7:
return "FRAM"
return "Unknown Type"
def handle_pdu_data(
printer: FsfwTmTcPrinter, pdu_idx: int, set_id: int, hk_data: bytes
):
@@ -123,17 +168,13 @@ def handle_pdu_data(
)
pw.dlog(content_line)
current_idx += 2
device_types = []
for idx in range(len(PDU1_CHANNELS_NAMES)):
device_types.append(hk_data[current_idx])
current_idx += 1
device_statuses = []
for idx in range(len(PDU1_CHANNELS_NAMES)):
device_statuses.append(hk_data[current_idx])
current_idx += 1
dev_parser = DevicesInfoParser()
current_idx = dev_parser.parse(hk_data=hk_data, current_idx=current_idx)
wdt = WdtInfo(pw=pw)
current_idx = wdt.parse(wdt_data=hk_data[current_idx:], current_idx=current_idx)
wdt.print()
pw.dlog(f"PDU Device Types: 0:FRAM|1:ADC|2:ADC|3:TempSens|4,5,6,7:Reserved")
dev_parser.print(pw=pw)
if set_id == SetIds.PDU_1_CORE or set_id == SetIds.PDU_2_CORE:
pw.dlog(f"Received PDU HK from PDU {pdu_idx}")
current_list = []
@@ -153,8 +194,7 @@ def handle_pdu_data(
output_enb_list.append(hk_data[current_idx])
current_idx += 1
header_str = f"{'Name'.ljust(24)} | OutEnb | U [mV] | I [mA]"
print(header_str)
printer.file_logger.info(header_str)
pw.dlog(header_str)
for idx in range(len(PDU1_CHANNELS_NAMES)):
out_enb = f"{output_enb_list[idx]}".ljust(6)
content_line = (
@@ -196,8 +236,7 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
out_enb_list.append(hk_data[current_idx])
current_idx += 1
header_str = f"{'Name'.ljust(24)} | OutEnb | U [mV] | I [mA]"
print(header_str)
printer.file_logger.info(header_str)
pw.dlog(header_str)
for idx in range(13):
out_enb = f"{out_enb_list[idx]}".ljust(6)
content_line = (
@@ -262,14 +301,8 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
ar6_depl,
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len
device_types = []
device_statuses = []
for idx in range(8):
device_types.append(hk_data[current_idx])
current_idx += 1
for idx in range(8):
device_statuses.append(hk_data[current_idx])
current_idx += 1
dev_parser = DevicesInfoParser()
current_idx = dev_parser.parse(hk_data=hk_data, current_idx=current_idx)
util_info = (
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime}"
)
@@ -289,6 +322,104 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}"
)
pw.dlog(batt_info)
pw.dlog(
"P60 Dock Dev Types: 0:FRAM|1:ADC|2:ADC|3:ADC|4:TempSens|5:RTC|"
"6:TempSens(BatPack)|7:TempSens(BatPack)"
)
dev_parser.print(pw=pw)
printer.print_validity_buffer(
validity_buffer=hk_data[current_idx:], num_vars=27
)
def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[int]]:
u16_list = []
for idx in range(6):
u16_list.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0])
current_idx += 2
return current_idx, u16_list
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw = PrintWrapper(printer=printer)
if set_id == SetIds.ACU_CORE:
mppt_mode = hk_data[0]
current_idx = 1
current_idx, currents = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
current_idx, voltages = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
vcc = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
current_idx += 2
vbat = struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
current_idx += 2
current_idx, vboosts = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
current_idx, powers = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
fmt_str = "!HHHIIHH"
inc_len = struct.calcsize(fmt_str)
(tmp0, tmp1, tmp2, bootcnt, uptime, mppt_time, mppt_period) = struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)
current_idx += inc_len
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}")
header_str = (
f"Channel | Input U [mV] | Input I [mA] | U Boost [mV] | Power [mW]"
)
pw.dlog(header_str)
for i in range(6):
pw.dlog(
f"{i} | {str(voltages[i]).ljust(4)} | {str(currents[i]).ljust(4)} | "
f"{str(vboosts[i]).ljust(4)} | {str(powers[i]).ljust(2)}"
)
pw.dlog(
f"Temperatures in C: Ch0 {tmp0/10.0} | Ch1 {tmp1/10.0} | Ch2 {tmp2/10.0}"
)
pw.dlog(
f"Boot Count {bootcnt} | Uptime {uptime} sec | "
f"MPPT Time {mppt_time} msec | MPPT Period {mppt_period} msec"
)
printer.print_validity_buffer(
validity_buffer=hk_data[current_idx:], num_vars=12
)
if set_id == SetIds.ACU_AUX:
current_idx = 0
fmt_str = "!BBB"
inc_len = struct.calcsize(fmt_str)
enb_tuple = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
(dac_enb0, dac_enb1, dac_enb2) = enb_tuple
dac_enb_str = ["on" if entry == 1 else "off" for entry in enb_tuple]
current_idx += inc_len
current_idx, dac_channels_raw = gen_six_entry_u16_list(
hk_data=hk_data, current_idx=current_idx
)
fmt_str = "!IHII"
inc_len = struct.calcsize(fmt_str)
(boot_cause, reset_cause, wdt_cnt_gnd, wdt_gnd_time_left) = struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)
current_idx += inc_len
dev_parser = DevicesInfoParser()
current_idx = dev_parser.parse(hk_data=hk_data, current_idx=current_idx)
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
pw.dlog(
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | DAC 2 {dac_enb_str[2]}"
)
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
pw.dlog(
f"Ground WDT: Reboot Count {wdt_cnt_gnd} | Time Left {wdt_gnd_time_left} sec"
)
pw.dlog(
f"ACU Dev Types: 0:FRAM|1:ADC|2:ADC|3:DAC|4:DAC|"
f"5:DAC|6:TempSens|7:Reserved"
)
dev_parser.print(pw=pw)
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=8)

24
pus_tm/devs/rad_sensor.py Normal file
View File

@@ -0,0 +1,24 @@
import struct
from pus_tm.defs import PrintWrapper
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
from pus_tc.devs.rad_sensor import SetIds
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
if set_id == SetIds.HK:
pw = PrintWrapper(printer)
current_idx = 0
pw.dlog("Received Radiation Sensor HK data")
fmt_str = "!fHHHHHH"
inc_len = struct.calcsize(fmt_str)
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
fmt_str, hk_data[current_idx : current_idx + inc_len]
)
ain_dict = {0: ain0, 1: ain1, 4: ain4, 5: ain5, 6: ain6, 7: ain7}
pw.dlog(f"Temperature: {temp} C")
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
for idx, val in ain_dict.items():
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
current_idx += inc_len
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)

View File

@@ -1,6 +1,7 @@
"""HK Handling for EIVE OBSW"""
import struct
from pus_tm.devs.rad_sensor import handle_rad_sensor_data
from pus_tm.system.tcs import handle_thermal_controller_hk_data, TM_TCP_SERVER
from tmtccmd.config.definitions import HkReplyUnpacked
from tmtccmd.tm.pus_3_fsfw_hk import (
@@ -15,7 +16,7 @@ from pus_tm.devs.bpx_bat import handle_bpx_hk_data
from pus_tm.devs.gps import handle_gps_data
from pus_tm.devs.gyros import handle_gyros_hk_data
from pus_tm.devs.imtq_mgt import handle_self_test_data
from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data
from pus_tm.devs.pcdu import handle_pdu_data, handle_p60_hk_data, handle_acu_hk_data
from pus_tm.devs.syrlinks import handle_syrlinks_hk_data
from pus_tc.devs.imtq import ImtqSetIds
from pus_tm.devs.reaction_wheels import handle_rw_hk_data
@@ -48,12 +49,17 @@ def handle_hk_packet(
set_id=tm_packet.set_id,
hk_data=hk_data,
)
handle_regular_hk_print(
printer=printer,
object_id=named_obj_id,
hk_packet=tm_packet,
hk_data=hk_data,
)
try:
handle_regular_hk_print(
printer=printer,
object_id=named_obj_id,
hk_packet=tm_packet,
hk_data=hk_data,
)
except ValueError as e:
LOGGER.exception(
f"{e} error when parsing HK data coming from {named_obj_id}"
)
if tm_packet.subservice == 10 or tm_packet.subservice == 12:
LOGGER.warning("HK definitions printout not implemented yet")
@@ -92,6 +98,10 @@ def handle_regular_hk_print(
return handle_pdu_data(
printer=printer, pdu_idx=2, set_id=set_id, hk_data=hk_data
)
if objb == obj_ids.ACU_HANDLER_ID:
return handle_acu_hk_data(printer=printer, hk_data=hk_data, set_id=set_id)
if objb == obj_ids.RAD_SENSOR_ID:
return handle_rad_sensor_data(printer=printer, hk_data=hk_data, set_id=set_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=printer, object_id=object_id, set_id=set_id, hk_data=hk_data

Submodule tmtccmd updated: 0e193f9c76...0adb957c50

View File

@@ -2,10 +2,11 @@
"""TMTC commander for EIVE"""
from tmtcc import tmtcc_post_args, tmtcc_pre_args
from tmtccmd.config.args import (
create_default_args_parser,
add_gui_tmtccmd_args,
parse_gui_input_arguments,
)
create_default_args_parser,
add_gui_tmtccmd_args,
parse_gui_input_arguments,
)
def main():
hook_obj = tmtcc_pre_args()