v1.9.0 #53
202
LICENSE
Normal file
202
LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
13
NOTICE
Normal file
13
NOTICE
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2021 Institute of Space Systems (IRS), University of Stuttgart
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -12,4 +12,3 @@ def command_preparation_hook() -> PusTelecommand:
|
||||
class instance
|
||||
"""
|
||||
return PusTelecommand(service=17, subservice=1, ssc=20)
|
||||
|
||||
|
@ -11,7 +11,7 @@ PUS_APID = 0x65
|
||||
|
||||
|
||||
class CustomServiceList(enum.Enum):
|
||||
TEST_DEVICE = "test",
|
||||
TEST_DEVICE = "test"
|
||||
P60DOCK = "p60dock"
|
||||
PDU1 = "pdu1"
|
||||
PDU2 = "pdu2"
|
||||
@ -22,7 +22,7 @@ class CustomServiceList(enum.Enum):
|
||||
HEATER = "heater"
|
||||
IMTQ = "imtq"
|
||||
PLOC = "ploc"
|
||||
PCDU = "pcdu",
|
||||
PCDU = "pcdu"
|
||||
SA_DEPLYOMENT = "sa_depl"
|
||||
REACTION_WHEEL_1 = "reaction_wheel_1"
|
||||
REACTION_WHEEL_2 = "reaction_wheel_2"
|
||||
@ -34,9 +34,9 @@ class CustomServiceList(enum.Enum):
|
||||
GPS_0 = "gps0"
|
||||
GPS_1 = "gps1"
|
||||
PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
|
||||
CORE = 'core'
|
||||
STAR_TRACKER = 'star_tracker'
|
||||
CCSDS_HANDLER = 'ccsds_handler'
|
||||
PDEC_HANDLER = 'pdec_handler'
|
||||
STR_IMG_HELPER = 'str_img_helper'
|
||||
SYRLINKS = 'syrlinks'
|
||||
CORE = "core"
|
||||
STAR_TRACKER = "star_tracker"
|
||||
CCSDS_HANDLER = "ccsds_handler"
|
||||
PDEC_HANDLER = "pdec_handler"
|
||||
STR_IMG_HELPER = "str_img_helper"
|
||||
SYRLINKS = "syrlinks"
|
||||
|
@ -12,8 +12,10 @@ import argparse
|
||||
from config.definitions import CustomServiceList, PUS_APID
|
||||
from config.custom_mode_op import CustomModeList
|
||||
from tmtccmd.config.definitions import CoreComInterfaces
|
||||
from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \
|
||||
set_default_globals_post_args_parsing
|
||||
from tmtccmd.config.globals import (
|
||||
set_default_globals_pre_args_parsing,
|
||||
set_default_globals_post_args_parsing,
|
||||
)
|
||||
from tmtccmd.utility.logger import get_console_logger
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
@ -21,16 +23,23 @@ LOGGER = get_console_logger()
|
||||
|
||||
class CustomGlobalIds(enum.Enum):
|
||||
from enum import auto
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def set_globals_pre_args_parsing(gui: bool = False):
|
||||
set_default_globals_pre_args_parsing(
|
||||
gui=gui, tc_apid=PUS_APID, tm_apid=PUS_APID, com_if_id=CoreComInterfaces.TCPIP_UDP.value)
|
||||
gui=gui,
|
||||
tc_apid=PUS_APID,
|
||||
tm_apid=PUS_APID,
|
||||
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
|
||||
)
|
||||
|
||||
|
||||
def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str):
|
||||
set_default_globals_post_args_parsing(
|
||||
args=args, custom_services_list=[CustomServiceList],
|
||||
custom_modes_list=[CustomModeList], json_cfg_path=json_cfg_path
|
||||
args=args,
|
||||
custom_services_list=[CustomServiceList],
|
||||
custom_modes_list=[CustomModeList],
|
||||
json_cfg_path=json_cfg_path,
|
||||
)
|
||||
|
@ -8,16 +8,20 @@ from tmtccmd.com_if.com_interface_base import CommunicationInterface
|
||||
from tmtccmd.core.backend import TmTcHandler
|
||||
from tmtccmd.config.hook import TmTcHookBase
|
||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter
|
||||
from tmtccmd.config.globals import OpCodeDictKeys
|
||||
from tmtccmd.config.globals import (
|
||||
OpCodeDictKeys,
|
||||
add_op_code_entry,
|
||||
add_service_op_code_entry,
|
||||
)
|
||||
from config.object_ids import RW1_ID
|
||||
|
||||
from config.definitions import CustomServiceList
|
||||
|
||||
|
||||
class EiveHookObject(TmTcHookBase):
|
||||
|
||||
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
|
||||
from tmtccmd.config.globals import get_default_service_op_code_dict
|
||||
|
||||
service_op_code_dict = get_default_service_op_code_dict()
|
||||
|
||||
get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
|
||||
@ -33,37 +37,51 @@ class EiveHookObject(TmTcHookBase):
|
||||
|
||||
def add_globals_pre_args_parsing(self, gui: bool = False):
|
||||
from config.globals_config import set_globals_pre_args_parsing
|
||||
|
||||
set_globals_pre_args_parsing(gui=gui)
|
||||
|
||||
def add_globals_post_args_parsing(self, args: argparse.Namespace):
|
||||
from config.globals_config import add_globals_post_args_parsing
|
||||
add_globals_post_args_parsing(args=args, json_cfg_path=self.get_json_config_file_path())
|
||||
|
||||
def assign_communication_interface(self, com_if_key: str, tmtc_printer: TmTcPrinter) -> \
|
||||
Union[CommunicationInterface, None]:
|
||||
add_globals_post_args_parsing(
|
||||
args=args, json_cfg_path=self.get_json_config_file_path()
|
||||
)
|
||||
|
||||
def assign_communication_interface(
|
||||
self, com_if_key: str, tmtc_printer: TmTcPrinter
|
||||
) -> Union[CommunicationInterface, None]:
|
||||
from tmtccmd.config.com_if import create_communication_interface_default
|
||||
|
||||
return create_communication_interface_default(
|
||||
com_if_key=com_if_key, tmtc_printer=tmtc_printer,
|
||||
json_cfg_path=self.get_json_config_file_path(), space_packet_ids=(0x0865,)
|
||||
com_if_key=com_if_key,
|
||||
tmtc_printer=tmtc_printer,
|
||||
json_cfg_path=self.get_json_config_file_path(),
|
||||
space_packet_ids=(0x0865,),
|
||||
)
|
||||
|
||||
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
|
||||
from config.custom_mode_op import custom_mode_operation
|
||||
|
||||
custom_mode_operation(mode=mode, tmtc_backend=tmtc_backend)
|
||||
|
||||
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
|
||||
from pus_tc.tc_packer_hook import pack_service_queue_user
|
||||
pack_service_queue_user(service=service, op_code=op_code, service_queue=service_queue)
|
||||
|
||||
pack_service_queue_user(
|
||||
service=service, op_code=op_code, service_queue=service_queue
|
||||
)
|
||||
|
||||
def get_object_ids(self) -> Dict[bytes, list]:
|
||||
from config.object_ids import get_object_ids
|
||||
|
||||
return get_object_ids()
|
||||
|
||||
@staticmethod
|
||||
def handle_service_8_telemetry(
|
||||
object_id: bytes, action_id: int, custom_data: bytearray
|
||||
object_id: bytes, action_id: int, custom_data: bytearray
|
||||
) -> Tuple[list, list]:
|
||||
from pus_tm.service_8_hook import user_analyze_service_8_data
|
||||
|
||||
return user_analyze_service_8_data(
|
||||
object_id=object_id, action_id=action_id, custom_data=custom_data
|
||||
)
|
||||
@ -73,13 +91,17 @@ class EiveHookObject(TmTcHookBase):
|
||||
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
|
||||
) -> Tuple[list, list, bytearray, int]:
|
||||
from pus_tm.hk_handling import handle_user_hk_packet
|
||||
|
||||
return handle_user_hk_packet(
|
||||
object_id=object_id, set_id=set_id, hk_data=hk_data, service3_packet=service3_packet
|
||||
object_id=object_id,
|
||||
set_id=set_id,
|
||||
hk_data=hk_data,
|
||||
service3_packet=service3_packet,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def handle_service_5_event(
|
||||
object_id: bytes, event_id: int, param_1: int, param_2: int
|
||||
object_id: bytes, event_id: int, param_1: int, param_2: int
|
||||
) -> str:
|
||||
if object_id == RW1_ID:
|
||||
if event_id == 1:
|
||||
@ -93,21 +115,22 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
from pus_tc.p60dock import P60OpCodes
|
||||
from gomspace.gomspace_common import GomspaceOpCodes
|
||||
from pus_tc.gps import GpsOpCodes
|
||||
|
||||
op_code_dict = {
|
||||
'reboot': ('Reboot with Prompt', {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
'reboot_self': ('Reboot Self', {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
'reboot_0_0': ('Reboot 0 0', {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
'reboot_0_1': ('Reboot 0 1', {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
'reboot_1_0': ('Reboot 1 0', {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
'reboot_1_1': ('Reboot 1 1', {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
"reboot": ("Reboot with Prompt", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"reboot_self": ("Reboot Self", {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
"reboot_0_0": ("Reboot 0 0", {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
"reboot_0_1": ("Reboot 0 1", {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
"reboot_1_0": ("Reboot 1 0", {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
"reboot_1_1": ("Reboot 1 1", {OpCodeDictKeys.TIMEOUT: 4.0}),
|
||||
}
|
||||
service_tuple = ('Core Controller', op_code_dict)
|
||||
service_tuple = ("Core Controller", op_code_dict)
|
||||
service_op_code_dict[CustomServiceList.CORE.value] = service_tuple
|
||||
|
||||
op_code_dict = {
|
||||
GpsOpCodes.RESET_GNSS.value: ('Reset GPS', {OpCodeDictKeys.TIMEOUT: 2.0})
|
||||
GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0})
|
||||
}
|
||||
service_tuple = ('GPS 0', op_code_dict)
|
||||
service_tuple = ("GPS 0", op_code_dict)
|
||||
service_op_code_dict[CustomServiceList.GPS_0.value] = service_tuple
|
||||
service_op_code_dict[CustomServiceList.GPS_1.value] = service_tuple
|
||||
|
||||
@ -126,62 +149,170 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
service_tuple = ("TMP1075 2", op_code_dict)
|
||||
service_op_code_dict[CustomServiceList.TMP1075_2.value] = service_tuple
|
||||
|
||||
op_code_dict_srv_p60 = {
|
||||
"0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
P60OpCodes.STACK_3V3_ON.value:
|
||||
("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
P60OpCodes.STACK_3V3_OFF.value:
|
||||
("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
("P60 Dock: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
}
|
||||
service_p60_tuple = ("P60 Device", op_code_dict_srv_p60)
|
||||
op_code_dict = dict()
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys="0",
|
||||
info="P60 Tests",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=P60OpCodes.STACK_3V3_ON.value,
|
||||
info="P60 Dock: Turn stack 3V3 on",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=P60OpCodes.STACK_3V3_OFF.value,
|
||||
info="P60 Dock: Turn stack 3V3 off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=P60OpCodes.STACK_5V_ON.value,
|
||||
info="P60 Dock: Turn stack 5V on",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=P60OpCodes.STACK_5V_OFF.value,
|
||||
info="P60 Dock: Turn stack 5V off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value,
|
||||
info="P60 Dock: Print Switches, Voltages, Currents",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_service_op_code_entry(
|
||||
srv_op_code_dict=service_op_code_dict,
|
||||
name=CustomServiceList.P60DOCK.value,
|
||||
info="P60 Device",
|
||||
op_code_entry=op_code_dict,
|
||||
)
|
||||
|
||||
op_code_dict_srv_pdu1 = {
|
||||
"0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.TCS_BOARD_ON.value:
|
||||
("PDU1: Turn TCS board on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.TCS_BOARD_OFF.value:
|
||||
("PDU1: Turn TCS board off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.STAR_TRACKER_ON.value:
|
||||
("PDU1: Turn star tracker on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.STAR_TRACKER_OFF.value:
|
||||
("PDU1: Turn star tracker off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.SUS_NOMINAL_ON.value:
|
||||
("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.SUS_NOMINAL_OFF.value:
|
||||
("PDU1: Turn SUS nominal off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.ACS_A_SIDE_ON.value:
|
||||
("PDU1: Turn ACS Side A on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.ACS_A_SIDE_OFF.value:
|
||||
("PDU1: Turn ACS Side A off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.SYRLINKS_ON.value:
|
||||
("PDU1: Turn Syrlinks on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.SYRLINKS_OFF.value:
|
||||
("PDU1: Turn Syrlinks off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu1OpCodes.TCS_BOARD_ON.value: (
|
||||
"PDU1: Turn TCS board on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.TCS_BOARD_OFF.value: (
|
||||
"PDU1: Turn TCS board off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.STAR_TRACKER_ON.value: (
|
||||
"PDU1: Turn star tracker on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.STAR_TRACKER_OFF.value: (
|
||||
"PDU1: Turn star tracker off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.SUS_NOMINAL_ON.value: (
|
||||
"PDU1: Turn SUS nominal on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.SUS_NOMINAL_OFF.value: (
|
||||
"PDU1: Turn SUS nominal off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.ACS_A_SIDE_ON.value: (
|
||||
"PDU1: Turn ACS Side A on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.ACS_A_SIDE_OFF.value: (
|
||||
"PDU1: Turn ACS Side A off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.SYRLINKS_ON.value: (
|
||||
"PDU1: Turn Syrlinks on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.SYRLINKS_OFF.value: (
|
||||
"PDU1: Turn Syrlinks off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.MGT_ON.value: (
|
||||
"PDU1: Turn MGT on",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
Pdu1OpCodes.MGT_OFF.value: (
|
||||
"PDU1: Turn MGT off",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
GomspaceOpCodes.PRINT_SWITCH_V_I.value: (
|
||||
"PDU1: Print Switches, Voltages, Currents",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
}
|
||||
service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1)
|
||||
|
||||
op_code_dict_srv_pdu2 = {
|
||||
"0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.ACS_SIDE_B_ON.value:
|
||||
("PDU2: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.ACS_SIDE_B_OFF.value:
|
||||
("PDU2: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.SUS_REDUNDANT_ON.value:
|
||||
("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
|
||||
("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.RW_ON.value:
|
||||
("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
Pdu2OpCodes.RW_OFF.value:
|
||||
("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0})
|
||||
}
|
||||
service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2)
|
||||
op_code_dict = dict()
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys="0",
|
||||
info="PDU2 Tests",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.ACS_SIDE_B_ON.value,
|
||||
info="PDU2: Turn ACS Side B on",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value,
|
||||
info="PDU2: Turn ACS Side B off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
|
||||
info="PDU2: Turn SUS redundant on",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
|
||||
info="PDU2: Turn SUS redundant off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.RW_ON.value,
|
||||
info="PDU2: Turn reaction wheels on",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.RW_OFF.value,
|
||||
info="PDU2: Turn reaction wheels off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=Pdu2OpCodes.Q7S_OFF.value,
|
||||
info="Q7S Off",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
add_op_code_entry(
|
||||
op_code_dict=op_code_dict,
|
||||
keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value,
|
||||
info="PDU2: Print Switches, Voltages, Currents",
|
||||
options={OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
)
|
||||
|
||||
add_service_op_code_entry(
|
||||
srv_op_code_dict=service_op_code_dict,
|
||||
name="pdu2",
|
||||
info="PDU2 Device",
|
||||
op_code_entry=op_code_dict,
|
||||
)
|
||||
# service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2)
|
||||
|
||||
op_code_dict_srv_heater = {
|
||||
"0": ("Heater Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
@ -207,7 +338,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": ("Reaction Wheel: Send get-telemetry-command", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": (
|
||||
"Reaction Wheel: Send get-telemetry-command",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
}
|
||||
service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw)
|
||||
|
||||
@ -221,7 +355,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
op_code_dict_ploc_mem_dumper = {
|
||||
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
}
|
||||
service_ploc_memory_dumper_tuple = ("Radiation Sensor", op_code_dict_ploc_mem_dumper)
|
||||
service_ploc_memory_dumper_tuple = (
|
||||
"Radiation Sensor",
|
||||
op_code_dict_ploc_mem_dumper,
|
||||
)
|
||||
|
||||
op_code_dict_srv_ploc_supv = {
|
||||
"0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
@ -231,28 +368,49 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"7": ("PLOC Supervisor: Select MPSoC boot image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"7": (
|
||||
"PLOC Supervisor: Select MPSoC boot image",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"13": ("PLOC Supervisor: Request boot status report", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"13": (
|
||||
"PLOC Supervisor: Request boot status report",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"16": ("PLOC Supervisor: Watchdog Configure Timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"16": (
|
||||
"PLOC Supervisor: Watchdog Configure Timeout",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"23": ("PLOC Supervisor: Set ADC enabled channels", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"24": ("PLOC Supervisor: Set ADC window and stride", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"23": (
|
||||
"PLOC Supervisor: Set ADC enabled channels",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"24": (
|
||||
"PLOC Supervisor: Set ADC window and stride",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"26": ("PLOC Supervisor: Request latchup status report", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"26": (
|
||||
"PLOC Supervisor: Request latchup status report",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"28": ("PLOC Supervisor: Enable/Disable NVM0/1/3", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"28": (
|
||||
"PLOC Supervisor: Enable/Disable NVM0/1/3",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
@ -261,24 +419,55 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"38": ("PLOC Supervisor: Factory reset clear all", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"39": ("PLOC Supervisor: Factory reset clear mirror entries",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"40": ("PLOC Supervisor: Factory reset clear circular entries",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"38": (
|
||||
"PLOC Supervisor: Factory reset clear all",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"39": (
|
||||
"PLOC Supervisor: Factory reset clear mirror entries",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"40": (
|
||||
"PLOC Supervisor: Factory reset clear circular entries",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
}
|
||||
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)
|
||||
|
||||
op_code_dict_srv_ploc_updater = {
|
||||
"0": ("Ploc Updater: Update uboot on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"1": ("Ploc Updater: Update bitstream on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"2": ("Ploc Updater: Update linux on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"3": ("Ploc Updater: Update application on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"4": ("Ploc Updater: Update uboot on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": ("Ploc Updater: Update bitstream on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"6": ("Ploc Updater: Update linux on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"7": ("Ploc Updater: Update application on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"0": (
|
||||
"Ploc Updater: Update uboot on partition A",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"1": (
|
||||
"Ploc Updater: Update bitstream on partition A",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"2": (
|
||||
"Ploc Updater: Update linux on partition A",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"3": (
|
||||
"Ploc Updater: Update application on partition A",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"4": (
|
||||
"Ploc Updater: Update uboot on partition B",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"5": (
|
||||
"Ploc Updater: Update bitstream on partition B",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"6": (
|
||||
"Ploc Updater: Update linux on partition B",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"7": (
|
||||
"Ploc Updater: Update application on partition B",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
}
|
||||
service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater)
|
||||
|
||||
@ -288,13 +477,19 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"2": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"3": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"4": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": ("Star Tracker: Switch to bootloader program", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": (
|
||||
"Star Tracker: Switch to bootloader program",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"6": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"7": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"8": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"9": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"10": ("Star Tracker: Subscribe to telemetry", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"11": ("Star Tracker: Boot image (requires bootloader mode)", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"11": (
|
||||
"Star Tracker: Boot image (requires bootloader mode)",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"12": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"13": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"14": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
@ -312,7 +507,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"26": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"27": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"28": ("Star Tracker: Reset error signal", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"29": ("Star Tracker: Set name of download image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"29": (
|
||||
"Star Tracker: Set name of download image",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"30": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"31": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"32": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
@ -322,15 +520,25 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"36": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"37": ("Star Tracker: Set time", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"38": ("Star Tracker: Download centroid", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"39": ("Star Tracker: Upload centroid (not implemented by arcsec?)", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"39": (
|
||||
"Star Tracker: Upload centroid (not implemented?)",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"40": ("Star Tracker: Download matched star", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"41": ("Star Tracker: Download DB Image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"42": ("Star Tracker: Download Blob Pixel", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"43": ("Star Tracker: Download FPGA Image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"44": ("Star Tracker: Change download FPGA image name", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"44": (
|
||||
"Star Tracker: Change download FPGA image name",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"45": ("Star Tracker: Upload FPGA image", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"46": ("Star Tracker: FPGA action", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"47": ("Star Tracker: Set image processor parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"47": ("Star Tracker: Unlock", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"48": ("Star Tracker: Request camera parameter", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"49": ("Star Tracker: Request limits", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"50": ("Star Tracker: Request blob parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"51": ("Star Tracker: Set image processor parameters", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
}
|
||||
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)
|
||||
|
||||
@ -359,14 +567,22 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
"2": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"5": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"6": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"7": ("Syrlinks Handler: Read TX AGC value high byte ", {OpCodeDictKeys.TIMEOUT: 2.0}),
|
||||
"8": ("Syrlinks Handler: Read TX AGC value low byte ", {OpCodeDictKeys.TIMEOUT: 2.0})
|
||||
"7": (
|
||||
"Syrlinks Handler: Read TX AGC value high byte ",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
"8": (
|
||||
"Syrlinks Handler: Read TX AGC value low byte ",
|
||||
{OpCodeDictKeys.TIMEOUT: 2.0},
|
||||
),
|
||||
}
|
||||
service_syrlinks_handler_tuple = ("Syrlinks Handler", op_code_dict_srv_syrlinks_handler)
|
||||
service_syrlinks_handler_tuple = (
|
||||
"Syrlinks Handler",
|
||||
op_code_dict_srv_syrlinks_handler,
|
||||
)
|
||||
|
||||
service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple
|
||||
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple
|
||||
service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
|
||||
# service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
|
||||
service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
|
||||
service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
|
||||
service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple
|
||||
@ -375,9 +591,21 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
|
||||
service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple
|
||||
service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
|
||||
service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
|
||||
service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple
|
||||
service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple
|
||||
service_op_code_dict[CustomServiceList.PLOC_MEMORY_DUMPER.value] = service_ploc_memory_dumper_tuple
|
||||
service_op_code_dict[CustomServiceList.CCSDS_HANDLER.value] = service_ccsds_handler_tuple
|
||||
service_op_code_dict[CustomServiceList.PDEC_HANDLER.value] = service_pdec_handler_tuple
|
||||
service_op_code_dict[CustomServiceList.SYRLINKS.value] = service_syrlinks_handler_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.PLOC_UPDATER.value
|
||||
] = service_ploc_updater_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.STAR_TRACKER.value
|
||||
] = service_star_tracker_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.PLOC_MEMORY_DUMPER.value
|
||||
] = service_ploc_memory_dumper_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.CCSDS_HANDLER.value
|
||||
] = service_ccsds_handler_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.PDEC_HANDLER.value
|
||||
] = service_pdec_handler_tuple
|
||||
service_op_code_dict[
|
||||
CustomServiceList.SYRLINKS.value
|
||||
] = service_syrlinks_handler_tuple
|
||||
|
@ -58,30 +58,30 @@ PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
|
||||
|
||||
|
||||
def get_object_ids() -> Dict[bytes, list]:
|
||||
object_id_dict = ({
|
||||
PUS_SERVICE_17_ID: "PUS Service 17",
|
||||
TEST_DEVICE_ID: "Test Device",
|
||||
P60_DOCK_HANDLER: "P60",
|
||||
PDU_1_HANDLER_ID: "PCDU PDU1 Handler",
|
||||
PDU_2_HANDLER_ID: "PCDU PDU2 Handler",
|
||||
ACU_HANDLER_ID: "ACU Handler",
|
||||
TMP_1075_1_HANDLER_ID: "TMP 1075 Handler 1",
|
||||
TMP_1075_2_HANDLER_ID: "TMP 1075 Handler 2",
|
||||
HEATER_ID: "Heater",
|
||||
PCDU_HANDLER_ID: "PCDU",
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID: "Solar Array Deployment",
|
||||
RW1_ID: "Reaction Wheel 1",
|
||||
RW2_ID: "Reaction Wheel 2",
|
||||
RW3_ID: "Reaction Wheel 3",
|
||||
RW4_ID: "Reaction Wheel 4",
|
||||
GPS_HANDLER_0_ID: "GPS 0",
|
||||
GPS_HANDLER_1_ID: "GPS 1",
|
||||
RAD_SENSOR_ID: "Radiation Sensor",
|
||||
PLOC_SUPV_ID: "PLOC Supervisor",
|
||||
PLOC_MPSOC_ID: "PLOC MPSoC",
|
||||
CORE_CONTROLLER_ID: "Core Controller",
|
||||
CCSDS_HANDLER_ID: "CCSDS Handler",
|
||||
PDEC_HANDLER_ID: "PDEC Handler",
|
||||
STAR_TRACKER_ID: "Star Tracker Handler",
|
||||
})
|
||||
object_id_dict = {
|
||||
PUS_SERVICE_17_ID: "PUS Service 17",
|
||||
TEST_DEVICE_ID: "Test Device",
|
||||
P60_DOCK_HANDLER: "P60",
|
||||
PDU_1_HANDLER_ID: "PCDU PDU1 Handler",
|
||||
PDU_2_HANDLER_ID: "PCDU PDU2 Handler",
|
||||
ACU_HANDLER_ID: "ACU Handler",
|
||||
TMP_1075_1_HANDLER_ID: "TMP 1075 Handler 1",
|
||||
TMP_1075_2_HANDLER_ID: "TMP 1075 Handler 2",
|
||||
HEATER_ID: "Heater",
|
||||
PCDU_HANDLER_ID: "PCDU",
|
||||
SOLAR_ARRAY_DEPLOYMENT_ID: "Solar Array Deployment",
|
||||
RW1_ID: "Reaction Wheel 1",
|
||||
RW2_ID: "Reaction Wheel 2",
|
||||
RW3_ID: "Reaction Wheel 3",
|
||||
RW4_ID: "Reaction Wheel 4",
|
||||
GPS_HANDLER_0_ID: "GPS 0",
|
||||
GPS_HANDLER_1_ID: "GPS 1",
|
||||
RAD_SENSOR_ID: "Radiation Sensor",
|
||||
PLOC_SUPV_ID: "PLOC Supervisor",
|
||||
PLOC_MPSOC_ID: "PLOC MPSoC",
|
||||
CORE_CONTROLLER_ID: "Core Controller",
|
||||
CCSDS_HANDLER_ID: "CCSDS Handler",
|
||||
PDEC_HANDLER_ID: "PDEC Handler",
|
||||
STAR_TRACKER_ID: "Star Tracker Handler",
|
||||
}
|
||||
return object_id_dict
|
||||
|
@ -47,9 +47,9 @@ class Channel:
|
||||
|
||||
|
||||
def pack_get_param_command(
|
||||
object_id: bytearray, table_id: int, memory_address: bytearray, parameter_size: int
|
||||
object_id: bytearray, 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.
|
||||
"""Function to generate a command to retrieve parameters like the temperature from a gomspace device.
|
||||
@param object_id: The object id of the gomspace device handler.
|
||||
@param table_id: The table id of the gomspace device
|
||||
@param memory_address: Address offset within table of the value to read.
|
||||
@ -61,15 +61,20 @@ def pack_get_param_command(
|
||||
app_data.extend(memory_address)
|
||||
app_data.append(parameter_size)
|
||||
return generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.PARAM_GET, app_data=app_data
|
||||
object_id=object_id,
|
||||
action_id=GomspaceDeviceActionIds.PARAM_GET,
|
||||
app_data=app_data,
|
||||
)
|
||||
|
||||
|
||||
def pack_set_param_command(
|
||||
object_id: bytearray, memory_address: bytearray, parameter_size: int, parameter: int,
|
||||
ssc: int = 0
|
||||
object_id: bytearray,
|
||||
memory_address: bytearray,
|
||||
parameter_size: int,
|
||||
parameter: int,
|
||||
ssc: int = 0,
|
||||
) -> PusTelecommand:
|
||||
""" Function to generate a command to set a parameter
|
||||
"""Function to generate a command to set a parameter
|
||||
:param object_id: The object id of the gomspace device handler.
|
||||
:param memory_address: Address offset within table of the value to set.
|
||||
:param parameter: The parameter value to set.
|
||||
@ -104,7 +109,7 @@ def pack_set_param_command(
|
||||
|
||||
|
||||
def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
|
||||
"""" Function to generate the command to ping a gomspace device
|
||||
""" " Function to generate the command to ping a gomspace device
|
||||
@param object_id Object Id of the gomspace device handler.
|
||||
@param data Bytearray containing the bytes to send to the gomspace device. For now the on board software
|
||||
supports only the handling of up to 33 bytes.
|
||||
@ -117,21 +122,25 @@ def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
|
||||
|
||||
|
||||
def pack_gnd_wdt_reset_command(object_id: bytearray) -> PusTelecommand:
|
||||
"""" Function to generate the command to reset the watchdog of a gomspace device.
|
||||
""" " 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)
|
||||
return generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.WDT_RESET
|
||||
)
|
||||
|
||||
|
||||
def pack_reboot_command(object_id: bytearray) -> PusTelecommand:
|
||||
""" Function to generate the command which triggers a reboot of a gomspace device
|
||||
"""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)
|
||||
return generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.REBOOT
|
||||
)
|
||||
|
||||
|
||||
def pack_request_full_hk_table_command(object_id: bytearray) -> PusTelecommand:
|
||||
""" Function to generate the command to request the full housekeeping table from a gomspace
|
||||
"""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.
|
||||
"""
|
||||
|
16
lint.py
16
lint.py
@ -5,18 +5,18 @@ import sys
|
||||
|
||||
def main():
|
||||
# Ignore folder created by venv
|
||||
exclude_dirs_flag = '--exclude bin,lib'
|
||||
additional_flags_both_steps = '--count --statistics'
|
||||
additional_flags_first_step = '--select=E9,F63,F7,F82 --show-source'
|
||||
flake8_first_step_cmd = \
|
||||
f'flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}'
|
||||
exclude_dirs_flag = "--exclude bin,lib"
|
||||
additional_flags_both_steps = "--count --statistics"
|
||||
additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
|
||||
flake8_first_step_cmd = f"flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}"
|
||||
status = os.system(flake8_first_step_cmd)
|
||||
if os.WEXITSTATUS(status) != 0:
|
||||
print("Flake8 linter errors")
|
||||
sys.exit(0)
|
||||
flake8_second_step_cmd = \
|
||||
f'flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 ' \
|
||||
f'--max-line-length=127 {exclude_dirs_flag}'
|
||||
flake8_second_step_cmd = (
|
||||
f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
|
||||
f"--max-line-length=127 {exclude_dirs_flag}"
|
||||
)
|
||||
os.system(flake8_second_step_cmd)
|
||||
|
||||
|
||||
|
@ -4,7 +4,12 @@ from spacepackets.ecss.definitions import PusServices
|
||||
|
||||
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
|
||||
from tmtccmd.tc.packer import PusTelecommand
|
||||
from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID
|
||||
from config.object_ids import (
|
||||
MGM_0_HANDLER_ID,
|
||||
MGM_1_HANDLER_ID,
|
||||
MGM_2_HANDLER_ID,
|
||||
MGM_3_HANDLER_ID,
|
||||
)
|
||||
from pus_tc.pdu1 import pack_pdu1_commands, Pdu1OpCodes
|
||||
from pus_tc.pdu2 import pack_pdu2_commands, Pdu2OpCodes
|
||||
|
||||
|
@ -20,6 +20,7 @@ class ACUTestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
@ -56,12 +57,14 @@ class CommandId:
|
||||
PRINT_CHANNEL_STATS = 51
|
||||
|
||||
|
||||
def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
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 = 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
|
||||
@ -72,10 +75,14 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
|
||||
# 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"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "ACU: Reading ground watchdog timer value")
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, ACUHkTable.wdt_gnd_left.parameter_address,
|
||||
ACUHkTable.wdt_gnd_left.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
ACUHkTable.wdt_gnd_left.parameter_address,
|
||||
ACUHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -92,38 +99,62 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
|
||||
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, ACUHkTable.temperature3.parameter_address,
|
||||
ACUHkTable.temperature3.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
ACUHkTable.temperature3.parameter_address,
|
||||
ACUHkTable.temperature3.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
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, ACUConfigTable.vboost.parameter_address,
|
||||
ACUConfigTable.vboost.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.config,
|
||||
ACUConfigTable.vboost.parameter_address,
|
||||
ACUConfigTable.vboost.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
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, ACUConfigTable.vbat_max_hi.parameter_address,
|
||||
ACUConfigTable.vbat_max_hi.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.config,
|
||||
ACUConfigTable.vbat_max_hi.parameter_address,
|
||||
ACUConfigTable.vbat_max_hi.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
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, ACUConfigTable.vbat_max_lo.parameter_address,
|
||||
ACUConfigTable.vbat_max_lo.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.config,
|
||||
ACUConfigTable.vbat_max_lo.parameter_address,
|
||||
ACUConfigTable.vbat_max_lo.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
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, ACUConfigTable.ov_mode.parameter_address,
|
||||
ACUConfigTable.ov_mode.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
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 = 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())
|
||||
|
||||
|
@ -32,10 +32,14 @@ class CommandIds:
|
||||
UPDATE_ON_FALLING_EDGE = 8
|
||||
|
||||
|
||||
def pack_ccsds_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_ccsds_handler_test(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing CCSDS handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing CCSDS handler with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
if op_code == "0":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Set low rate"))
|
||||
@ -58,7 +62,9 @@ def pack_ccsds_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: s
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "4":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Set arbitrary bitrate"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "CCSDS Handler: Set arbitrary bitrate")
|
||||
)
|
||||
bitrate = int(input("Specify bit rate (bps): "))
|
||||
command = object_id + struct.pack('!I', CommandIds.ARBITRARY_BITRATE) + struct.pack('!I', bitrate)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
|
@ -14,12 +14,12 @@ class ActionIds(enum.IntEnum):
|
||||
|
||||
|
||||
class OpCodes(enum.Enum):
|
||||
REBOOT = 'reboot'
|
||||
REBOOT_SELF = 'reboot_self'
|
||||
REBOOT_0_0 = 'reboot_0_0'
|
||||
REBOOT_0_1 = 'reboot_0_1'
|
||||
REBOOT_1_0 = 'reboot_1_0'
|
||||
REBOOT_1_1 = 'reboot_1_1'
|
||||
REBOOT = "reboot"
|
||||
REBOOT_SELF = "reboot_self"
|
||||
REBOOT_0_0 = "reboot_0_0"
|
||||
REBOOT_0_1 = "reboot_0_1"
|
||||
REBOOT_1_0 = "reboot_1_0"
|
||||
REBOOT_1_1 = "reboot_1_1"
|
||||
|
||||
|
||||
class Chip(enum.IntEnum):
|
||||
@ -38,7 +38,10 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
|
||||
if op_code == OpCodes.REBOOT.value:
|
||||
reboot_self, chip_select, copy_select = determine_reboot_params()
|
||||
perform_reboot_cmd(
|
||||
tc_queue=tc_queue, reboot_self=reboot_self, chip=chip_select, copy=copy_select
|
||||
tc_queue=tc_queue,
|
||||
reboot_self=reboot_self,
|
||||
chip=chip_select,
|
||||
copy=copy_select,
|
||||
)
|
||||
elif op_code == OpCodes.REBOOT_SELF.value:
|
||||
perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True)
|
||||
@ -48,7 +51,10 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
|
||||
)
|
||||
elif op_code == OpCodes.REBOOT_0_1.value:
|
||||
perform_reboot_cmd(
|
||||
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_1_GOLD
|
||||
tc_queue=tc_queue,
|
||||
reboot_self=False,
|
||||
chip=Chip.CHIP_0,
|
||||
copy=Copy.COPY_1_GOLD,
|
||||
)
|
||||
elif op_code == OpCodes.REBOOT_1_0.value:
|
||||
perform_reboot_cmd(
|
||||
@ -56,57 +62,70 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
|
||||
)
|
||||
elif op_code == OpCodes.REBOOT_1_1.value:
|
||||
perform_reboot_cmd(
|
||||
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_1_GOLD
|
||||
tc_queue=tc_queue,
|
||||
reboot_self=False,
|
||||
chip=Chip.CHIP_1,
|
||||
copy=Copy.COPY_1_GOLD,
|
||||
)
|
||||
|
||||
|
||||
def determine_reboot_params() -> (bool, Chip, Copy):
|
||||
chip_select = -1
|
||||
copy_select = -1
|
||||
reboot_self = input('Reboot self? [y/n]: ')
|
||||
if reboot_self in ['y', 'yes', '1']:
|
||||
LOGGER.info('Rebooting currently running image')
|
||||
reboot_self = input("Reboot self? [y/n]: ")
|
||||
if reboot_self in ["y", "yes", "1"]:
|
||||
LOGGER.info("Rebooting currently running image")
|
||||
return True, chip_select, copy_select
|
||||
LOGGER.info('Rebooting image specified by chip and copy')
|
||||
LOGGER.info("Rebooting image specified by chip and copy")
|
||||
while True:
|
||||
chip_select = input('Chip select [0/1]: ')
|
||||
if chip_select in ['0', '1']:
|
||||
if chip_select == '0':
|
||||
chip_select = input("Chip select [0/1]: ")
|
||||
if chip_select in ["0", "1"]:
|
||||
if chip_select == "0":
|
||||
chip_select = Chip.CHIP_0
|
||||
else:
|
||||
chip_select = Chip.CHIP_1
|
||||
break
|
||||
else:
|
||||
LOGGER.warning('Invalid chip select value. Try again')
|
||||
LOGGER.warning("Invalid chip select value. Try again")
|
||||
while True:
|
||||
copy_select = input('Copy select [0/1]: ')
|
||||
if copy_select in ['0', '1']:
|
||||
if copy_select == '0':
|
||||
copy_select = input("Copy select [0/1]: ")
|
||||
if copy_select in ["0", "1"]:
|
||||
if copy_select == "0":
|
||||
copy_select = Copy.COPY_0_NOM
|
||||
else:
|
||||
copy_select = Copy.COPY_1_GOLD
|
||||
break
|
||||
else:
|
||||
LOGGER.warning('Invalid copy select value. Try again')
|
||||
LOGGER.warning("Invalid copy select value. Try again")
|
||||
return False, chip_select, copy_select
|
||||
|
||||
|
||||
def perform_reboot_cmd(
|
||||
tc_queue: TcQueueT, reboot_self: bool, chip: Chip = Chip.NONE, copy: Copy = Copy.NONE
|
||||
tc_queue: TcQueueT,
|
||||
reboot_self: bool,
|
||||
chip: Chip = Chip.NONE,
|
||||
copy: Copy = Copy.NONE,
|
||||
):
|
||||
tc_data = bytearray()
|
||||
if reboot_self:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, 'Packing reboot command for current image'))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Packing reboot command for current image")
|
||||
)
|
||||
tc_data.append(True)
|
||||
else:
|
||||
tc_data.append(False)
|
||||
tc_data.append(chip)
|
||||
tc_data.append(copy)
|
||||
tc_queue.append(
|
||||
(QueueCommands.PRINT, f'Packing reboot command for chip {chip} and copy {copy}')
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
f"Packing reboot command for chip {chip} and copy {copy}",
|
||||
)
|
||||
)
|
||||
action_cmd = generate_action_command(
|
||||
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.REBOOT, app_data=tc_data, ssc=0
|
||||
object_id=CORE_CONTROLLER_ID,
|
||||
action_id=ActionIds.REBOOT,
|
||||
app_data=tc_data,
|
||||
ssc=0,
|
||||
)
|
||||
tc_queue.appendleft(action_cmd.pack_command_tuple())
|
||||
|
||||
|
@ -43,8 +43,10 @@ def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
|
||||
def pack_switch_heater_command(object_id: bytearray, switch_nr: int, switch_action: int) -> bytearray:
|
||||
""" Function to generate the command switch a heater
|
||||
def pack_switch_heater_command(
|
||||
object_id: bytearray, switch_nr: int, switch_action: int
|
||||
) -> bytearray:
|
||||
"""Function to generate the command switch a heater
|
||||
@param object_id The object id of the HeaterHandler object.
|
||||
@param switch_nr The switch number identifying the heater to switch
|
||||
@param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.
|
||||
|
110
pus_tc/imtq.py
110
pus_tc/imtq.py
@ -38,10 +38,14 @@ class ImtqActionIds:
|
||||
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
|
||||
|
||||
|
||||
def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_imtq_test_into(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing ISIS IMTQ handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing ISIS IMTQ handler with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0" or op_code == "1":
|
||||
@ -50,12 +54,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive x self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of positive x self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive x self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with positive x self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.POSITIVE_X_TEST)
|
||||
command = generate_one_hk_command(sid, 24)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -66,12 +80,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative x self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of negative x self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative x self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with negative x self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_X_TEST)
|
||||
command = generate_one_hk_command(sid, 27)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -82,12 +106,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive y self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of positive y self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive y self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with positive y self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
|
||||
command = generate_one_hk_command(sid, 30)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -98,12 +132,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative y self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of negative y self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative y self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with negative y self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Y_TEST)
|
||||
command = generate_one_hk_command(sid, 33)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -114,12 +158,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive z self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of positive z self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive z self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with positive z self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
|
||||
command = generate_one_hk_command(sid, 36)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -130,12 +184,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative z self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Initiate reading of negative z self test results",
|
||||
)
|
||||
)
|
||||
command = object_id + ImtqActionIds.read_self_test_results
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative z self test results"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"IMTQ: Request dataset with negative z self test results",
|
||||
)
|
||||
)
|
||||
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Z_TEST)
|
||||
command = generate_one_hk_command(sid, 37)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -145,7 +209,7 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
x_dipole = 0
|
||||
y_dipole = 0
|
||||
z_dipole = 0
|
||||
duration = 0 # ms
|
||||
duration = 0 # ms
|
||||
command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -159,8 +223,10 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
|
||||
return tc_queue
|
||||
|
||||
|
||||
def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int) -> bytearray:
|
||||
""" This function packs the command causing the ISIS IMTQ to generate a dipole.
|
||||
def pack_dipole_command(
|
||||
object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int
|
||||
) -> bytearray:
|
||||
"""This function packs the command causing the ISIS IMTQ to generate a dipole.
|
||||
@param object_id The object id of the IMTQ handler.
|
||||
@param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000)
|
||||
@param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000)
|
||||
@ -172,8 +238,8 @@ def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_di
|
||||
action_id = ImtqActionIds.start_actuation_dipole
|
||||
command = bytearray()
|
||||
command = object_id + action_id
|
||||
command.extend(x_dipole.to_bytes(length=2, byteorder='big'))
|
||||
command.extend(y_dipole.to_bytes(length=2, byteorder='big'))
|
||||
command.extend(z_dipole.to_bytes(length=2, byteorder='big'))
|
||||
command.extend(duration.to_bytes(length=2, byteorder='big'))
|
||||
command.extend(x_dipole.to_bytes(length=2, byteorder="big"))
|
||||
command.extend(y_dipole.to_bytes(length=2, byteorder="big"))
|
||||
command.extend(z_dipole.to_bytes(length=2, byteorder="big"))
|
||||
command.extend(duration.to_bytes(length=2, byteorder="big"))
|
||||
return command
|
||||
|
@ -14,6 +14,8 @@ class P60OpCodes(enum.Enum):
|
||||
TEST = "0"
|
||||
STACK_3V3_ON = "1"
|
||||
STACK_3V3_OFF = "2"
|
||||
STACK_5V_ON = "3"
|
||||
STACK_5V_OFF = "4"
|
||||
|
||||
|
||||
class P60DockTestProcedure:
|
||||
@ -22,18 +24,23 @@ class P60DockTestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
gnd_wdt_reset = False
|
||||
ping = False
|
||||
channel_3_off = False # pdu2
|
||||
read_temperature1 = True
|
||||
read_temperature1 = False
|
||||
read_channel_3_state = False # pdu2
|
||||
read_cur_lu_lim_0 = False
|
||||
channel_3_on = False # pdu2
|
||||
invalid_table_id_test = False # Test to check if software properly handles invalid table ids
|
||||
invalid_address_test = False # Test to check if software properly handles invalid addresses
|
||||
invalid_table_id_test = (
|
||||
False # Test to check if software properly handles invalid table ids
|
||||
)
|
||||
invalid_address_test = (
|
||||
False # Test to check if software properly handles invalid addresses
|
||||
)
|
||||
invalid_parameter_size_test = False
|
||||
|
||||
|
||||
@ -49,8 +56,12 @@ class P60DockConfigTable:
|
||||
out_en_8 = TableEntry(bytearray([0x00, 0x70]), TableEntry.uint8_size) # Stack VBAT
|
||||
out_en_9 = TableEntry(bytearray([0x00, 0x71]), TableEntry.uint8_size) # Stack 3V3
|
||||
out_en_10 = TableEntry(bytearray([0x00, 0x72]), TableEntry.uint8_size) # Stack 5V
|
||||
out_en_11 = TableEntry(bytearray([0x00, 0x73]), TableEntry.uint8_size) # GS 3V3 (unused)
|
||||
out_en_12 = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint8_size) # GS 5V (unused)
|
||||
out_en_11 = TableEntry(
|
||||
bytearray([0x00, 0x73]), TableEntry.uint8_size
|
||||
) # GS 3V3 (unused)
|
||||
out_en_12 = TableEntry(
|
||||
bytearray([0x00, 0x74]), TableEntry.uint8_size
|
||||
) # GS 5V (unused)
|
||||
# When channel consumes more than cur_lu_lim, channel is turned of immediately
|
||||
cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size)
|
||||
|
||||
@ -66,21 +77,43 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
|
||||
if op_code == P60OpCodes.STACK_3V3_ON.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on"))
|
||||
command = pack_set_param_command(
|
||||
object_id, P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size, Channel.on
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return
|
||||
if op_code == P60OpCodes.STACK_3V3_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off"))
|
||||
command = pack_set_param_command(
|
||||
object_id, P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size, Channel.off
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == P60OpCodes.STACK_5V_ON.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 5V on"))
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == P60OpCodes.STACK_5V_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 5V off"))
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return
|
||||
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")
|
||||
)
|
||||
command = generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
@ -92,15 +125,21 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset")
|
||||
)
|
||||
command = 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())
|
||||
@ -111,86 +150,141 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")
|
||||
)
|
||||
parameter = 0 # set channel off
|
||||
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size, parameter)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing temperature reading"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing temperature reading")
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft((QueueCommands.PRINT,
|
||||
"P60 Dock: Testing Output Channel 3 state (PDU2)"))
|
||||
command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing Output Channel 3 state (PDU2)")
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
|
||||
tc_queue.appendleft((QueueCommands.PRINT,
|
||||
"P60 Dock: Reading current limit value of output channel 0"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Reading current limit value of output channel 0",
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size
|
||||
object_id,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")
|
||||
)
|
||||
parameter = 1 # set channel on
|
||||
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size, parameter)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")
|
||||
)
|
||||
table_id_invalid = 5
|
||||
command = pack_get_param_command(
|
||||
object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size
|
||||
object_id,
|
||||
table_id_invalid,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
|
||||
tc_queue.appendleft((QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in get param command"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in get param command",
|
||||
)
|
||||
)
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
command = pack_get_param_command(object_id, TableIds.hk, invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size)
|
||||
command = pack_get_param_command(
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft((QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in set param command"))
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in set param command",
|
||||
)
|
||||
)
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
parameter_size = 2
|
||||
parameter = 1
|
||||
command = pack_set_param_command(object_id, invalid_address, parameter_size, parameter)
|
||||
command = pack_set_param_command(
|
||||
object_id, invalid_address, parameter_size, parameter
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter sizes in get-param command")
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter sizes in get-param command",
|
||||
)
|
||||
)
|
||||
invalid_size = 5
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, invalid_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
invalid_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter size in set-param command")
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter size in set-param command",
|
||||
)
|
||||
)
|
||||
parameter = 1
|
||||
command = pack_set_param_command(
|
||||
object_id, P60DockConfigTable.out_en_3.parameter_address, invalid_size, parameter
|
||||
object_id,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
invalid_size,
|
||||
parameter,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -12,15 +12,17 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
|
||||
class CommandIds:
|
||||
# prints the clcw to the console. Useful for debugging
|
||||
PRINT_CLCW = byteCrray([0x0, 0x0, 0x0, 0x0])
|
||||
PRINT_CLCW = bytearray([0x0, 0x0, 0x0, 0x0])
|
||||
# Print PDEC monitor register
|
||||
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
|
||||
|
||||
|
||||
def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PDEC handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing PDEC handler with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
@ -30,7 +32,9 @@ def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: st
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if op_code == "1":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register")
|
||||
)
|
||||
command = object_id + CommandIds.PRINT_PDEC_MON
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
136
pus_tc/pdu1.py
136
pus_tc/pdu1.py
@ -25,6 +25,8 @@ class Pdu1OpCodes(enum.Enum):
|
||||
ACS_A_SIDE_OFF = "8"
|
||||
SYRLINKS_ON = "9"
|
||||
SYRLINKS_OFF = "10"
|
||||
MGT_ON = "11"
|
||||
MGT_OFF = "12"
|
||||
|
||||
|
||||
class PDU1TestProcedure:
|
||||
@ -33,11 +35,12 @@ class PDU1TestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
reboot = False
|
||||
ping = False
|
||||
read_temperature = False
|
||||
turn_channel_2_on = False # Star Tracker connected to this channel (5V)
|
||||
turn_channel_2_on = False # Star Tracker connected to this channel (5V)
|
||||
turn_channel_2_off = False
|
||||
turn_channel_3_on = False # MTQ connected to this channel (5V)
|
||||
turn_channel_3_off = False
|
||||
@ -49,64 +52,88 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
||||
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, PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size, Channel.on)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
|
||||
)
|
||||
command = generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
@ -114,18 +141,39 @@ 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, PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == Pdu1OpCodes.SYRLINKS_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off"))
|
||||
command = pack_set_param_command(
|
||||
object_id, PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_1.parameter_address,
|
||||
PDUConfigTable.out_en_1.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == Pdu1OpCodes.MGT_ON.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT on"))
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == Pdu1OpCodes.MGT_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn MGT off"))
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
@ -134,35 +182,49 @@ 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, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)")
|
||||
)
|
||||
command = pack_set_param_command(
|
||||
object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)")
|
||||
)
|
||||
command = pack_set_param_command(
|
||||
object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_3.parameter_address,
|
||||
PDUConfigTable.out_en_3.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
136
pus_tc/pdu2.py
136
pus_tc/pdu2.py
@ -19,6 +19,8 @@ class Pdu2OpCodes(enum.Enum):
|
||||
SUS_REDUNDANT_OFF = "4"
|
||||
RW_ON = "5"
|
||||
RW_OFF = "6"
|
||||
# There is not really a point of the on command, the SW can not be commanded if the OBC is off
|
||||
Q7S_OFF = "7"
|
||||
|
||||
|
||||
class PDU2TestProcedure:
|
||||
@ -27,6 +29,7 @@ class PDU2TestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
reboot = False
|
||||
read_gnd_wdt = False
|
||||
@ -37,55 +40,88 @@ class PDU2TestProcedure:
|
||||
read_channel_2_state = False # Reaction wheels 5V
|
||||
read_cur_lu_lim_0 = False # OBC
|
||||
channel_2_on = False # Reaction wheels 5V
|
||||
invalid_table_id_test = False # Test to check if software properly handles invalid table ids
|
||||
invalid_address_test = False # Test to check if software properly handles invalid addresses
|
||||
invalid_table_id_test = (
|
||||
False # Test to check if software properly handles invalid table ids
|
||||
)
|
||||
invalid_address_test = (
|
||||
False # Test to check if software properly handles invalid addresses
|
||||
)
|
||||
invalid_parameter_size_test = False
|
||||
request_hk_table = False
|
||||
|
||||
|
||||
def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2"))
|
||||
|
||||
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, PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return tc_queue
|
||||
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, PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size, Channel.off
|
||||
object_id,
|
||||
PDUConfigTable.out_en_7.parameter_address,
|
||||
PDUConfigTable.out_en_7.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return tc_queue
|
||||
if op_code == Pdu2OpCodes.Q7S_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Turning off Q7S OBC"))
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_0.parameter_address,
|
||||
PDUConfigTable.out_en_0.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size, Channel.on)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
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, PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size, Channel.off)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_4.parameter_address,
|
||||
PDUConfigTable.out_en_4.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == Pdu2OpCodes.RW_ON.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on"))
|
||||
command = pack_set_param_command(
|
||||
object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == Pdu2OpCodes.RW_OFF.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off"))
|
||||
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")
|
||||
)
|
||||
command = generate_action_command(
|
||||
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
@ -96,14 +132,20 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
|
||||
command = pack_reboot_command(object_id)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address,
|
||||
PDUHkTable.wdt_gnd_left.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
PDUHkTable.wdt_gnd_left.parameter_address,
|
||||
PDUHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing ground watchdog reset"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Testing ground watchdog reset")
|
||||
)
|
||||
command = pack_gnd_wdt_reset_command(object_id)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.ping:
|
||||
@ -113,16 +155,25 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 on (TCS Heater)")
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"PDU2: Testing setting output channel 2 on (TCS Heater)",
|
||||
)
|
||||
)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.on)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading"))
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size
|
||||
object_id,
|
||||
TableIds.hk,
|
||||
PDUHkTable.temperature.parameter_address,
|
||||
PDUHkTable.temperature.parameter_size,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
|
||||
@ -130,27 +181,40 @@ 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, TableIds.config, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size
|
||||
object_id,
|
||||
TableIds.config,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Reading current limit value of output channel 0 (OBC)")
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"PDU2: Reading current limit value of output channel 0 (OBC)",
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_size
|
||||
object_id,
|
||||
TableIds.config,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_address,
|
||||
PDUConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off"))
|
||||
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size, Channel.off)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")
|
||||
)
|
||||
command = pack_set_param_command(
|
||||
object_id,
|
||||
PDUConfigTable.out_en_2.parameter_address,
|
||||
PDUConfigTable.out_en_2.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting housekeeping table"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PDU2: Requesting housekeeping table")
|
||||
)
|
||||
command = pack_request_full_hk_table_command(object_id)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
||||
|
@ -18,10 +18,14 @@ class ActionIds:
|
||||
DUMP_MRAM = 1
|
||||
|
||||
|
||||
def pack_ploc_memory_dumper_cmd(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_ploc_memory_dumper_cmd(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC memory dumper with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing PLOC memory dumper with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
@ -35,7 +39,7 @@ def pack_mram_dump_cmd(object_id: bytearray) -> bytearray:
|
||||
start = int(input("Start address: 0x"), 16)
|
||||
end = int(input("End address: 0x"), 16)
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', ActionIds.DUMP_MRAM)
|
||||
command = command + struct.pack('!I', start)
|
||||
command = command + struct.pack('!I', end)
|
||||
command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM)
|
||||
command = command + struct.pack("!I", start)
|
||||
command = command + struct.pack("!I", end)
|
||||
return command
|
||||
|
@ -20,6 +20,7 @@ class PlocTestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
test_tc_mem_write = False
|
||||
test_tc_mem_read = True
|
||||
@ -36,33 +37,43 @@ class PlocReplyIds:
|
||||
|
||||
def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC MPSoC with object id: 0x" + object_id.hex())
|
||||
(QueueCommands.PRINT, "Testing PLOC MPSoC with object id: 0x" + object_id.hex())
|
||||
)
|
||||
|
||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test"))
|
||||
memory_address = int(input("PLOC Tc Mem Write: Type memory address: 0x"), 16)
|
||||
memory_data = int(input("PLOC Tc Mem Write: Type memory data: 0x"), 16)
|
||||
command = generate_write_mem_command(object_id, struct.pack('!I', memory_address), memory_data)
|
||||
command = generate_write_mem_command(
|
||||
object_id, struct.pack("!I", memory_address), memory_data
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test"))
|
||||
memory_address = int(input("PLOC Tc Mem Read: Type memory address: 0x"), 16)
|
||||
command = object_id + PlocActionIds.tc_mem_read + struct.pack('!I', memory_address)
|
||||
command = (
|
||||
object_id + PlocActionIds.tc_mem_read + struct.pack("!I", memory_address)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
||||
|
||||
|
||||
def generate_write_mem_command(object_id: bytearray, memory_address: bytearray, memory_data: int) -> bytearray:
|
||||
""" This function generates the command to write to a memory address within the PLOC
|
||||
def generate_write_mem_command(
|
||||
object_id: bytearray, memory_address: bytearray, memory_data: int
|
||||
) -> bytearray:
|
||||
"""This function generates the command to write to a memory address within the PLOC
|
||||
@param object_id The object id of the PlocHandler
|
||||
@param memory_address The PLOC memory address where to write to.
|
||||
@param memory_data The data to write to the memory address specified by the bytearray memory_address.
|
||||
"""
|
||||
command = object_id + PlocActionIds.tc_mem_write + memory_address + struct.pack('!I', memory_data)
|
||||
command = (
|
||||
object_id
|
||||
+ PlocActionIds.tc_mem_write
|
||||
+ memory_address
|
||||
+ struct.pack("!I", memory_data)
|
||||
)
|
||||
return command
|
||||
|
@ -17,14 +17,15 @@ from tmtccmd.utility.logger import get_console_logger
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
latchup_id_dict = {
|
||||
"0": "0.85V",
|
||||
"1": "1.8V",
|
||||
"2": "MISC",
|
||||
"3": "3.3V",
|
||||
"4": "NVM_4XO",
|
||||
"5": "MISSION",
|
||||
"6": "SAFECOTS"
|
||||
}
|
||||
"0": "0.85V",
|
||||
"1": "1.8V",
|
||||
"2": "MISC",
|
||||
"3": "3.3V",
|
||||
"4": "NVM_4XO",
|
||||
"5": "MISSION",
|
||||
"6": "SAFECOTS",
|
||||
}
|
||||
|
||||
|
||||
class SupvActionIds:
|
||||
HK_REPORT = 1
|
||||
@ -75,34 +76,40 @@ class SupvHkIds:
|
||||
BOOT_STATUS_REPORT = 53
|
||||
|
||||
|
||||
def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_ploc_supv_test_into(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC Supervisor with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing PLOC Supervisor with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "3":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "4":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart MPSoC"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.RESTART_MPSOC)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.RESTART_MPSOC)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "5":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.START_MPSOC)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "6":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Shutdown MPSoC"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SHUTWOWN_MPSOC)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "7":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image")
|
||||
)
|
||||
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1):"))
|
||||
bp0 = int(input("BP0 (0 or 1):"))
|
||||
bp1 = int(input("BP1 (0 or 1):"))
|
||||
@ -111,35 +118,49 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "8":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries")
|
||||
)
|
||||
restart_tries = int(input("Set maximum restart tries:"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_MAX_RESTART_TRIES) + struct.pack('!B', restart_tries)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
|
||||
+ struct.pack("!B", restart_tries)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "9":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset MPSoC"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.RESET_MPSOC)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.RESET_MPSOC)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "10":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set time reference"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_TIME_REF)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set time reference")
|
||||
)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_TIME_REF)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "11":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
|
||||
boot_timeout = int(input("Specify boot timeout [ms]:"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_BOOT_TIMEOUT) + struct.pack('!I', boot_timeout)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
|
||||
+ struct.pack("!I", boot_timeout)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "12":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable HK"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_HK)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_HK)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "13":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request boot status report"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.GET_BOOT_STATUS_REPORT)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Request boot status report")
|
||||
)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.GET_BOOT_STATUS_REPORT)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "14":
|
||||
@ -153,22 +174,30 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "16":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Watchdog configure timeout"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Watchdog configure timeout")
|
||||
)
|
||||
command = pack_watchdog_config_timeout_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "17":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert")
|
||||
)
|
||||
command = pack_lachtup_alert_cmd(object_id, True)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "18":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable latchup alert"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Disable latchup alert")
|
||||
)
|
||||
command = pack_lachtup_alert_cmd(object_id, False)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "19":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Auto calibrate alert"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Auto calibrate alert")
|
||||
)
|
||||
command = pack_auto_calibrate_alert_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -178,22 +207,30 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "21":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set alert irq filter"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set alert irq filter")
|
||||
)
|
||||
command = pack_set_alert_irq_filter_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "22":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC sweep period"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC sweep period")
|
||||
)
|
||||
command = pack_set_adc_sweep_period_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "23":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels")
|
||||
)
|
||||
command = pack_set_adc_enabled_channels_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "24":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC window and stride"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC window and stride")
|
||||
)
|
||||
command = pack_set_adc_window_and_stride_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -203,17 +240,23 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "26":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.GET_LATCHUP_STATUS_REPORT)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report")
|
||||
)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.GET_LATCHUP_STATUS_REPORT)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "27":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM"))
|
||||
command = object_id + struct.pack('!I', SupvActionIds.COPY_ADC_DATA_TO_MRAM)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM")
|
||||
)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "28":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enalbe/Disable NVMs"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Enalbe/Disable NVMs")
|
||||
)
|
||||
command = pack_enable_nvms_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -238,7 +281,9 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "34":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity")
|
||||
)
|
||||
command = pack_set_debug_verbosity_cmd(object_id)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -253,36 +298,59 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "37":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor"))
|
||||
command = command = object_id + struct.pack('!I', SupvActionIds.RESTART_SUPERVISOR)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")
|
||||
)
|
||||
command = command = object_id + struct.pack(
|
||||
"!I", SupvActionIds.RESTART_SUPERVISOR
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "38":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all"))
|
||||
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_ALL)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")
|
||||
)
|
||||
command = command = object_id + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "39":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries"))
|
||||
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_MIRROR)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries")
|
||||
)
|
||||
command = command = object_id + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "40":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear circular entries"))
|
||||
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR)
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"PLOC Supervisor: Factory reset clear circular entries",
|
||||
)
|
||||
)
|
||||
command = command = object_id + struct.pack(
|
||||
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
elif op_code == "41":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: CAN loopback test"))
|
||||
command = command = object_id + struct.pack('!I', SupvActionIds.CAN_LOOPBACK_TEST)
|
||||
command = command = object_id + struct.pack(
|
||||
"!I", SupvActionIds.CAN_LOOPBACK_TEST
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
||||
|
||||
|
||||
def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int) -> bytearray:
|
||||
""" This function can be used to generate the command to select the image from which the MPSoC will boot
|
||||
def pack_sel_boot_image_cmd(
|
||||
object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int
|
||||
) -> bytearray:
|
||||
"""This function can be used to generate the command to select the image from which the MPSoC will boot
|
||||
@param object_id The object id of the PLOC supervisor handler.
|
||||
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
|
||||
@param bp0 Partition pin 0
|
||||
@ -290,11 +358,11 @@ def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int,
|
||||
@param bp2 Partition pin 2
|
||||
"""
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = command + struct.pack('!B', mem)
|
||||
command = command + struct.pack('!B', bp0)
|
||||
command = command + struct.pack('!B', bp1)
|
||||
command = command + struct.pack('!B', bp2)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
|
||||
command = command + struct.pack("!B", mem)
|
||||
command = command + struct.pack("!B", bp0)
|
||||
command = command + struct.pack("!B", bp1)
|
||||
command = command + struct.pack("!B", bp2)
|
||||
return command
|
||||
|
||||
|
||||
@ -309,12 +377,12 @@ def pack_update_available_cmd(object_id: bytearray) -> bytearray:
|
||||
image_crc = 0x0
|
||||
number_of_packets = 150
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.UPDATE_AVAILABLE)
|
||||
command = command + struct.pack('!B', image_select)
|
||||
command = command + struct.pack('!B', image_partition)
|
||||
command = command + struct.pack('!I', image_size)
|
||||
command = command + struct.pack('!I', image_crc)
|
||||
command = command + struct.pack('!I', number_of_packets)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
|
||||
command = command + struct.pack("!B", image_select)
|
||||
command = command + struct.pack("!B", image_partition)
|
||||
command = command + struct.pack("!I", image_size)
|
||||
command = command + struct.pack("!I", image_crc)
|
||||
command = command + struct.pack("!I", number_of_packets)
|
||||
return command
|
||||
|
||||
|
||||
@ -328,10 +396,10 @@ def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray:
|
||||
watchdog_pl = 1
|
||||
watchdog_int = 0
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_ENABLE)
|
||||
command = command + struct.pack('!B', watchdog_ps)
|
||||
command = command + struct.pack('!B', watchdog_pl)
|
||||
command = command + struct.pack('!B', watchdog_int)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_ENABLE)
|
||||
command = command + struct.pack("!B", watchdog_ps)
|
||||
command = command + struct.pack("!B", watchdog_pl)
|
||||
command = command + struct.pack("!B", watchdog_int)
|
||||
return command
|
||||
|
||||
|
||||
@ -343,9 +411,9 @@ def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray:
|
||||
watchdog = int(input("Specify watchdog (0 - PS, 1 - PL, 2 - INT):"))
|
||||
timeout = int(input("Specify timeout (1000 ms - 360000 ms):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
|
||||
command = command + struct.pack('!B', watchdog)
|
||||
command = command + struct.pack('!I', timeout)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
|
||||
command = command + struct.pack("!B", watchdog)
|
||||
command = command + struct.pack("!I", timeout)
|
||||
return command
|
||||
|
||||
|
||||
@ -358,10 +426,10 @@ def pack_lachtup_alert_cmd(object_id: bytearray, state: bool) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
command = bytearray()
|
||||
if state:
|
||||
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_LATCHUP_ALERT)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_LATCHUP_ALERT)
|
||||
else:
|
||||
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_LATCHUP_ALERT)
|
||||
command = command + struct.pack('!B', latchup_id)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
return command
|
||||
|
||||
|
||||
@ -373,9 +441,9 @@ def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
mg = int(input("Specify MG:"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.AUTO_CALIBRATE_ALERT)
|
||||
command = command + struct.pack('!B', latchup_id)
|
||||
command = command + struct.pack('!I', mg)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.AUTO_CALIBRATE_ALERT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!I", mg)
|
||||
return command
|
||||
|
||||
|
||||
@ -403,9 +471,9 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
|
||||
latchup_id = get_latchup_id()
|
||||
dutycycle = int(input("Specify dutycycle:"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_LIMIT)
|
||||
command = command + struct.pack('!B', latchup_id)
|
||||
command = command + struct.pack('!I', dutycycle)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!I", dutycycle)
|
||||
return command
|
||||
|
||||
|
||||
@ -418,10 +486,10 @@ def pack_set_alert_irq_filter_cmd(object_id: bytearray) -> bytearray:
|
||||
tp = int(input("Specify filter type (TP):"))
|
||||
div = int(input("Specify clock divider (DIV):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_IRQ_FILTER)
|
||||
command = command + struct.pack('!B', latchup_id)
|
||||
command = command + struct.pack('!B', tp)
|
||||
command = command + struct.pack('!B', div)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_IRQ_FILTER)
|
||||
command = command + struct.pack("!B", latchup_id)
|
||||
command = command + struct.pack("!B", tp)
|
||||
command = command + struct.pack("!B", div)
|
||||
return command
|
||||
|
||||
|
||||
@ -432,8 +500,8 @@ def pack_set_adc_sweep_period_cmd(object_id: bytearray) -> bytearray:
|
||||
"""
|
||||
sweep_period = int(input("Specify sweep period (min 21 us):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_SWEEP_PERIOD)
|
||||
command = command + struct.pack('!I', sweep_period)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_SWEEP_PERIOD)
|
||||
command = command + struct.pack("!I", sweep_period)
|
||||
return command
|
||||
|
||||
|
||||
@ -444,8 +512,8 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray:
|
||||
"""
|
||||
ch = int(input("Specify ch:"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_ENABLED_CHANNELS)
|
||||
command = command + struct.pack('!H', ch)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
|
||||
command = command + struct.pack("!H", ch)
|
||||
return command
|
||||
|
||||
|
||||
@ -453,17 +521,17 @@ def pack_set_adc_window_and_stride_cmd(object_id: bytearray) -> bytearray:
|
||||
window_size = int(input("Specify window size:"))
|
||||
striding_step_size = int(input("Specify striding step size:"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = command + struct.pack('!H', window_size)
|
||||
command = command + struct.pack('!H', striding_step_size)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
|
||||
command = command + struct.pack("!H", window_size)
|
||||
command = command + struct.pack("!H", striding_step_size)
|
||||
return command
|
||||
|
||||
|
||||
def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray:
|
||||
threshold = int(input("Specify threshold:"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_THRESHOLD)
|
||||
command = command + struct.pack('!I', threshold)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
|
||||
command = command + struct.pack("!I", threshold)
|
||||
return command
|
||||
|
||||
|
||||
@ -471,25 +539,25 @@ def pack_enable_nvms_cmd(object_id: bytearray) -> bytearray:
|
||||
n01 = int(input("NVM0/1 (0 - off, 1 - on):"))
|
||||
n3 = int(input("NVM3 (0 - off, 1 - on):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_NVMS)
|
||||
command = command + struct.pack('!B', n01)
|
||||
command = command + struct.pack('!B', n3)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
|
||||
command = command + struct.pack("!B", n01)
|
||||
command = command + struct.pack("!B", n3)
|
||||
return command
|
||||
|
||||
|
||||
def pack_select_nvm_cmd(object_id: bytearray) -> bytearray:
|
||||
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SELECT_NVM)
|
||||
command = command + struct.pack('!B', mem)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
|
||||
command = command + struct.pack("!B", mem)
|
||||
return command
|
||||
|
||||
|
||||
def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray:
|
||||
test = int(input("Specify test (1 - complete, 2 - short):"))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.RUN_AUTO_EM_TESTS)
|
||||
command = command + struct.pack('!B', test)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
|
||||
command = command + struct.pack("!B", test)
|
||||
return command
|
||||
|
||||
|
||||
@ -497,25 +565,25 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray:
|
||||
start = int(input("Start address: 0x"), 16)
|
||||
stop = int(input("Stop address: 0x"), 16)
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.WIPE_MRAM)
|
||||
command = command + struct.pack('!I', start)
|
||||
command = command + struct.pack('!I', stop)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
|
||||
command = command + struct.pack("!I", start)
|
||||
command = command + struct.pack("!I", stop)
|
||||
return command
|
||||
|
||||
|
||||
def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray:
|
||||
en = 1
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.PRINT_CPU_STATS)
|
||||
command = command + struct.pack('!B', en)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.PRINT_CPU_STATS)
|
||||
command = command + struct.pack("!B", en)
|
||||
return command
|
||||
|
||||
|
||||
def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray:
|
||||
command = bytearray()
|
||||
verbosity = get_debug_verbosity()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_DBG_VERBOSITY)
|
||||
command = command + struct.pack('!B', verbosity)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_DBG_VERBOSITY)
|
||||
command = command + struct.pack("!B", verbosity)
|
||||
return command
|
||||
|
||||
|
||||
@ -530,7 +598,7 @@ def get_debug_verbosity() -> int:
|
||||
2: "Warn",
|
||||
3: "Info",
|
||||
}
|
||||
print("{:<6} | {}".format('Key', 'Description'))
|
||||
print("{:<6} | {}".format("Key", "Description"))
|
||||
for entry in verbosity_options_dict.items():
|
||||
print("{:<6} | {}".format(entry[0], entry[1]))
|
||||
verbosity = int(input("Specify verbosity key: "))
|
||||
@ -549,10 +617,10 @@ def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
|
||||
pin = int(input("Specify pin: "))
|
||||
val = int(input("Specify val: "))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.SET_GPIO)
|
||||
command = command + struct.pack('!B', port)
|
||||
command = command + struct.pack('!B', pin)
|
||||
command = command + struct.pack('!B', val)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
command = command + struct.pack("!B", val)
|
||||
return command
|
||||
|
||||
|
||||
@ -560,9 +628,7 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
|
||||
port = int(input("Specify port: "))
|
||||
pin = int(input("Specify pin: "))
|
||||
command = bytearray()
|
||||
command = object_id + struct.pack('!I', SupvActionIds.READ_GPIO)
|
||||
command = command + struct.pack('!B', port)
|
||||
command = command + struct.pack('!B', pin)
|
||||
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
|
||||
command = command + struct.pack("!B", port)
|
||||
command = command + struct.pack("!B", pin)
|
||||
return command
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ latchup_id_dict = {
|
||||
"3": "3.3V",
|
||||
"4": "NVM_4XO",
|
||||
"5": "MISSION",
|
||||
"6": "SAFECOTS"
|
||||
"6": "SAFECOTS",
|
||||
}
|
||||
|
||||
|
||||
@ -48,57 +48,101 @@ class ImagePathDefs:
|
||||
imageBappsw = "/mnt/sd0/ploc/updateBappsw.bin"
|
||||
|
||||
|
||||
def pack_ploc_updater_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_ploc_updater_test_into(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC updater with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing PLOC updater with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_UBOOT) + \
|
||||
bytearray(ImagePathDefs.imageAuboot, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_UBOOT)
|
||||
+ bytearray(ImagePathDefs.imageAuboot, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "1":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_BITSTREAM) + \
|
||||
bytearray(ImagePathDefs.imageAbitsream, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_BITSTREAM)
|
||||
+ bytearray(ImagePathDefs.imageAbitsream, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "2":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_LINUX) + \
|
||||
bytearray(ImagePathDefs.imageAlinux, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_LINUX)
|
||||
+ bytearray(ImagePathDefs.imageAlinux, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "3":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_APP_SW) + \
|
||||
bytearray(ImagePathDefs.imageAappsw, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_APP_SW)
|
||||
+ bytearray(ImagePathDefs.imageAappsw, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "4":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_UBOOT) + \
|
||||
bytearray(ImagePathDefs.imageBuboot, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_UBOOT)
|
||||
+ bytearray(ImagePathDefs.imageBuboot, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "5":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_BITSTREAM) + \
|
||||
bytearray(ImagePathDefs.imageBbitsream, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_BITSTREAM)
|
||||
+ bytearray(ImagePathDefs.imageBbitsream, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "6":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_LINUX) + \
|
||||
bytearray(ImagePathDefs.imageBlinux, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_LINUX)
|
||||
+ bytearray(ImagePathDefs.imageBlinux, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "7":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B"))
|
||||
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_APP_SW) + \
|
||||
bytearray(ImagePathDefs.imageBappsw, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_APP_SW)
|
||||
+ bytearray(ImagePathDefs.imageBappsw, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -13,10 +13,14 @@ from spacepackets.ecss.tc import PusTelecommand
|
||||
from pus_tc.service_200_mode import pack_mode_data
|
||||
|
||||
|
||||
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_rad_sensor_test_into(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing radiation sensor handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing radiation sensor handler with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
|
@ -38,10 +38,14 @@ class RampTime:
|
||||
MS_1000 = 1000
|
||||
|
||||
|
||||
def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_single_rw_test_into(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing reaction wheel handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing reaction wheel handler with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0" or op_code == "1":
|
||||
@ -59,7 +63,9 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if op_code == "3":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Switch to mode normal"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Reaction Wheel: Switch to mode normal")
|
||||
)
|
||||
mode_data = pack_mode_data(object_id, 2, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -71,15 +77,19 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if op_code == "5":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Send get-telemetry-command"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Reaction Wheel: Send get-telemetry-command")
|
||||
)
|
||||
command = object_id + RwCommandIds.GET_TM
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
return tc_queue
|
||||
|
||||
|
||||
def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> bytearray:
|
||||
""" With this function a command is packed to set the speed of a reaction wheel
|
||||
def pack_set_speed_command(
|
||||
object_id: bytearray, speed: int, ramp_time: int
|
||||
) -> bytearray:
|
||||
"""With this function a command is packed to set the speed of a reaction wheel
|
||||
@param object_id The object id of the reaction wheel handler.
|
||||
@param speed Valid speeds are [-65000, -1000] and [1000, 65000]. Values are specified in 0.1 * RPM
|
||||
@param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are
|
||||
@ -88,6 +98,6 @@ def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) ->
|
||||
command_id = RwCommandIds.SET_SPEED
|
||||
command = bytearray()
|
||||
command = object_id + command_id
|
||||
command = command + struct.pack('!i', speed)
|
||||
command = command + ramp_time.to_bytes(length=2, byteorder='big')
|
||||
command = command + struct.pack("!i", speed)
|
||||
command = command + ramp_time.to_bytes(length=2, byteorder="big")
|
||||
return command
|
||||
|
@ -20,6 +20,7 @@ class StarTrackerActionIds:
|
||||
REQ_VERSION = 2
|
||||
REQ_INTERFACE = 3
|
||||
REQ_TIME = 4
|
||||
UNLOCK = 6
|
||||
SWITCH_TO_BOOTLOADER_PROGRAM = 7
|
||||
REQ_POWER = 11
|
||||
TAKE_IMAGE = 15
|
||||
@ -59,6 +60,9 @@ class StarTrackerActionIds:
|
||||
CHANGE_FPGA_DOWNLOAD_FILE = 64
|
||||
UPLOAD_FPGA_IMAGE = 65
|
||||
FPGA_ACTION = 66
|
||||
REQ_CAMERA_PARAMS = 67
|
||||
REQ_LIMITS = 68
|
||||
REQ_BLOB_PARAMS = 69
|
||||
|
||||
|
||||
class ImagePathDefs:
|
||||
@ -89,10 +93,14 @@ class PartitionSize:
|
||||
FREE_2 = 896000
|
||||
|
||||
|
||||
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_star_tracker_commands(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Generate command for star tracker with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Generate command for star tracker with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
@ -117,164 +125,224 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "4":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.PING)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.PING)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "5":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Switch to bootloader program"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM)
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Switch to bootloader program")
|
||||
)
|
||||
command = object_id + struct.pack(
|
||||
"!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "6":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TEMPERATURE)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "7":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_VERSION)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VERSION)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "8":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_INTERFACE)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "9":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_POWER)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_POWER)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "10":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Subscribe to telemetry"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Subscribe to telemetry")
|
||||
)
|
||||
tm_id = int(input("Specify Id of tm: "))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.SUBSCRIBE_TO_TM) + struct.pack('B', tm_id)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIBE_TO_TM)
|
||||
+ struct.pack("B", tm_id)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "11":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.BOOT)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.BOOT)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "12":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TIME)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TIME)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "13":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_SOLUTION)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "14":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_IMAGE) + \
|
||||
bytearray(ImagePathDefs.uploadFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
|
||||
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "15":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_IMAGE) + \
|
||||
bytearray(ImagePathDefs.downloadPath, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
|
||||
+ bytearray(ImagePathDefs.downloadPath, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "16":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.LIMITS) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.LIMITS)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "17":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set tracking parameters"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.TRACKING) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Set tracking parameters")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.TRACKING)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "18":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.MOUNTING) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.MOUNTING)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "19":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "20":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Blob"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.BLOB) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.BLOB)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "21":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CENTROIDING) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "22":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.LISA) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.LISA)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "23":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.MATCHING) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.MATCHING)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "24":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.VALIDATION) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.VALIDATION)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "25":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.ALGO) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.ALGO)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "26":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image"))
|
||||
actionid = int(input("Specify parameter ID (nominal - 4): "))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.TAKE_IMAGE) + struct.pack('!B', actionid)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE)
|
||||
+ struct.pack("!B", actionid)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "27":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop str helper"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.STOP_STR_HELPER)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "28":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Reset error signal"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.RESET_ERROR)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.RESET_ERROR)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "29":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set name of download image"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Set name of download image")
|
||||
)
|
||||
filename = input("Specify download image name: ")
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE) + \
|
||||
bytearray(filename, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "30":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request histogram"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_HISTOGRAM)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "31":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request contrast"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_CONTRAST)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "32":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_JSON_FILE_NAME) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME)
|
||||
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "33":
|
||||
@ -290,7 +358,11 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
|
||||
if op_code == "35":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set read filename"))
|
||||
filename = input("Specify filename: ")
|
||||
command = object_id + StarTrackerActionIds.SET_READ_FILENAME + bytearray(filename, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ StarTrackerActionIds.SET_READ_FILENAME
|
||||
+ bytearray(filename, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "36":
|
||||
@ -301,71 +373,134 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
|
||||
if op_code == "37":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time"))
|
||||
unix_time = 1640783543
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_TIME) + struct.pack('!Q', unix_time)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.SET_TIME)
|
||||
+ struct.pack("!Q", unix_time)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "38":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid"))
|
||||
id = 0
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_CENTROID) + struct.pack('!B', id)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "39":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload Centroid"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_CENTROID) + \
|
||||
bytearray(ImagePathDefs.uploadCentroidJson, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_CENTROID)
|
||||
+ bytearray(ImagePathDefs.uploadCentroidJson, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "40":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download matched star"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Download matched star")
|
||||
)
|
||||
id = 0
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_MATCHED_STAR) + \
|
||||
struct.pack('!B', id)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "41":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image"))
|
||||
id = 0
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_DBIMAGE) + \
|
||||
struct.pack('!B', id)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "42":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel"))
|
||||
id = 0
|
||||
type = 1 # 0 - normal, 1 - fast
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_BLOBPIXEL) + \
|
||||
struct.pack('!B', id) + struct.pack('!B', type)
|
||||
type = 1 # 0 - normal, 1 - fast
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL)
|
||||
+ struct.pack("!B", id)
|
||||
+ struct.pack("!B", type)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "43":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image"))
|
||||
position = 0
|
||||
length = 4100
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE) + \
|
||||
struct.pack('!I', position) + struct.pack('!I', length) + bytearray(
|
||||
ImagePathDefs.downloadFpgaImagePath, 'utf-8')
|
||||
position = int(input("Start position: "))
|
||||
length = int(input("Size to download: "))
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE)
|
||||
+ struct.pack("!I", position)
|
||||
+ struct.pack("!I", length)
|
||||
+ bytearray(ImagePathDefs.downloadFpgaImagePath, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "44":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE) + \
|
||||
bytearray(ImagePathDefs.downloadFpgaImageName, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Change donwload FPGA image file name")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE)
|
||||
+ bytearray(ImagePathDefs.downloadFpgaImageName, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "45":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_FPGA_IMAGE) + \
|
||||
bytearray(ImagePathDefs.uploadFpgaImageName, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE)
|
||||
+ bytearray(ImagePathDefs.uploadFpgaImageName, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "46":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action"))
|
||||
id = 3
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.FPGA_ACTION) + struct.pack('!B', id)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.FPGA_ACTION)
|
||||
+ struct.pack("!B", id)
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "47":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Unlock"))
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.UNLOCK)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=70, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "48":
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Request camera parameters")
|
||||
)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CAMERA_PARAMS)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=71, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "49":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request limits"))
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_LIMITS)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=72, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "50":
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker: Request blob parameters")
|
||||
)
|
||||
command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_BLOB_PARAMS)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=73, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "51":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set image processor parameters"))
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.IMAGE_PROCESSOR) + \
|
||||
bytearray(ImagePathDefs.jsonFile, 'utf-8')
|
||||
@ -376,8 +511,13 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
|
||||
def pack_write_command(object_id: bytearray) -> bytearray:
|
||||
region = Region.FREE_1
|
||||
address = 0
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.WRITE) + struct.pack('!B', region) + \
|
||||
struct.pack('!I', address) + bytearray(ImagePathDefs.flashFile, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.WRITE)
|
||||
+ struct.pack("!B", region)
|
||||
+ struct.pack("!I", address)
|
||||
+ bytearray(ImagePathDefs.flashFile, "utf-8")
|
||||
)
|
||||
return command
|
||||
|
||||
|
||||
@ -385,8 +525,14 @@ def pack_read_command(object_id: bytearray) -> bytearray:
|
||||
region = Region.STAR_TRACKER_FIRMWARE
|
||||
address = 0
|
||||
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.READ) + struct.pack('!B', region) + \
|
||||
struct.pack('!I', address) + struct.pack('!I', size) + bytearray(ImagePathDefs.flashReadPath, 'utf-8')
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.READ)
|
||||
+ struct.pack("!B", region)
|
||||
+ struct.pack("!I", address)
|
||||
+ struct.pack("!I", size)
|
||||
+ bytearray(ImagePathDefs.flashReadPath, "utf-8")
|
||||
)
|
||||
return command
|
||||
|
||||
|
||||
@ -394,6 +540,11 @@ def pack_checksum_command(object_id: bytearray) -> bytearray:
|
||||
region = Region.STAR_TRACKER_FIRMWARE
|
||||
address = 0
|
||||
size = PartitionSize.STAR_TRACKER_FIRMWARE
|
||||
command = object_id + struct.pack('!I', StarTrackerActionIds.CHECKSUM) + struct.pack('!B', region) + \
|
||||
struct.pack('!I', address) + struct.pack('!I', size)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM)
|
||||
+ struct.pack("!B", region)
|
||||
+ struct.pack("!I", address)
|
||||
+ struct.pack("!I", size)
|
||||
)
|
||||
return command
|
||||
|
@ -25,14 +25,24 @@ class ImagePathDefs:
|
||||
uploadFile = "/mnt/sd0/startracker/gemma.bin"
|
||||
|
||||
|
||||
def pack_str_img_helper_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_str_img_helper_command(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing star tracker image helper object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing star tracker image helper object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker image helper: Upload image"))
|
||||
command = object_id + struct.pack('!I', Commands.UPLOAD_IMAGE) + bytearray(ImagePathDefs.uploadFile, 'utf-8')
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker image helper: Upload image")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", Commands.UPLOAD_IMAGE)
|
||||
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -27,10 +27,14 @@ class CommandIds:
|
||||
READ_TX_AGC_VALUE_LOW_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
|
||||
|
||||
|
||||
def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
|
||||
def pack_syrlinks_command(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC memory dumper with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing PLOC memory dumper with object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
@ -69,12 +73,16 @@ def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "7":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte")
|
||||
)
|
||||
command = object_id + CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code == "8":
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte")
|
||||
)
|
||||
command = object_id + CommandIds.READ_TX_AGC_VALUE_LOW_BYTE
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -32,62 +32,109 @@ from pus_tc.gps import pack_gps_command
|
||||
from pus_tc.acs import pack_acs_command
|
||||
from pus_tc.str_img_helper import pack_str_img_helper_command
|
||||
from config.definitions import CustomServiceList
|
||||
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, \
|
||||
ACU_HANDLER_ID, TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, \
|
||||
PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, \
|
||||
STAR_TRACKER_ID, PLOC_MEMORY_DUMPER_ID, GPS_HANDLER_0_ID, GPS_HANDLER_1_ID, CCSDS_HANDLER_ID, \
|
||||
PDEC_HANDLER_ID, STR_IMG_HELPER_ID, SYRLINKS_HANDLER_ID
|
||||
from config.object_ids import (
|
||||
P60_DOCK_HANDLER,
|
||||
PDU_1_HANDLER_ID,
|
||||
PDU_2_HANDLER_ID,
|
||||
ACU_HANDLER_ID,
|
||||
TMP_1075_1_HANDLER_ID,
|
||||
TMP_1075_2_HANDLER_ID,
|
||||
HEATER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
PLOC_MPSOC_ID,
|
||||
RW1_ID,
|
||||
RW2_ID,
|
||||
RW3_ID,
|
||||
RW4_ID,
|
||||
RAD_SENSOR_ID,
|
||||
PLOC_SUPV_ID,
|
||||
PLOC_UPDATER_ID,
|
||||
STAR_TRACKER_ID,
|
||||
PLOC_MEMORY_DUMPER_ID,
|
||||
GPS_HANDLER_0_ID,
|
||||
GPS_HANDLER_1_ID,
|
||||
CCSDS_HANDLER_ID,
|
||||
PDEC_HANDLER_ID,
|
||||
STR_IMG_HELPER_ID,
|
||||
SYRLINKS_HANDLER_ID,
|
||||
)
|
||||
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT):
|
||||
def pack_service_queue_user(
|
||||
service: Union[str, int], op_code: str, service_queue: TcQueueT
|
||||
):
|
||||
if service == CoreServiceList.SERVICE_5.value:
|
||||
return pack_generic_service5_test_into(tc_queue=service_queue)
|
||||
if service == CoreServiceList.SERVICE_17.value:
|
||||
return service_queue.appendleft(pack_service_17_ping_command(ssc=1700).pack_command_tuple())
|
||||
return service_queue.appendleft(
|
||||
pack_service_17_ping_command(ssc=1700).pack_command_tuple()
|
||||
)
|
||||
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
|
||||
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_p60dock_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PDU1.value:
|
||||
object_id = PDU_1_HANDLER_ID
|
||||
return pack_pdu1_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
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
|
||||
return pack_pdu2_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
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=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_acu_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.TMP1075_1.value:
|
||||
object_id = TMP_1075_1_HANDLER_ID
|
||||
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.TMP1075_2.value:
|
||||
object_id = TMP_1075_2_HANDLER_ID
|
||||
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_tmp1075_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.HEATER.value:
|
||||
object_id = HEATER_ID
|
||||
return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
|
||||
if service == CustomServiceList.IMTQ.value:
|
||||
object_id = IMTQ_HANDLER_ID
|
||||
return pack_imtq_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_imtq_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PLOC.value:
|
||||
object_id = PLOC_MPSOC_ID
|
||||
return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
|
||||
if service == CustomServiceList.REACTION_WHEEL_1.value:
|
||||
object_id = RW1_ID
|
||||
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_single_rw_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_2.value:
|
||||
object_id = RW2_ID
|
||||
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_single_rw_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_3.value:
|
||||
object_id = RW3_ID
|
||||
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_single_rw_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.REACTION_WHEEL_4.value:
|
||||
object_id = RW4_ID
|
||||
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_single_rw_test_into(
|
||||
object_id=object_id, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.RAD_SENSOR.value:
|
||||
object_id = RAD_SENSOR_ID
|
||||
return pack_rad_sensor_test_into(
|
||||
@ -123,15 +170,25 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
|
||||
if service == CustomServiceList.ACS.value:
|
||||
return pack_acs_command(tc_queue=service_queue, op_code=op_code)
|
||||
if service == CustomServiceList.GPS_0.value:
|
||||
return pack_gps_command(object_id=GPS_HANDLER_0_ID, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_gps_command(
|
||||
object_id=GPS_HANDLER_0_ID, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.GPS_1.value:
|
||||
return pack_gps_command(object_id=GPS_HANDLER_1_ID, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_gps_command(
|
||||
object_id=GPS_HANDLER_1_ID, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.CCSDS_HANDLER.value:
|
||||
return pack_ccsds_handler_test(object_id=CCSDS_HANDLER_ID, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_ccsds_handler_test(
|
||||
object_id=CCSDS_HANDLER_ID, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.PDEC_HANDLER.value:
|
||||
return pack_ccsds_handler_test(object_id=PDEC_HANDLER_ID, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_ccsds_handler_test(
|
||||
object_id=PDEC_HANDLER_ID, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
if service == CustomServiceList.SYRLINKS.value:
|
||||
return pack_syrlinks_command(object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code)
|
||||
return pack_syrlinks_command(
|
||||
object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code
|
||||
)
|
||||
LOGGER.warning("Invalid Service !")
|
||||
|
||||
|
||||
|
@ -18,10 +18,13 @@ class Tmp1075TestProcedure:
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
|
||||
all = False
|
||||
start_adc_conversion = False
|
||||
get_temp = False
|
||||
set_mode_normal = True # Setting mode to normal starts continuous temperature reading
|
||||
set_mode_normal = (
|
||||
True # Setting mode to normal starts continuous temperature reading
|
||||
)
|
||||
set_mode_on = False # If mode is MODE_ON, temperature will only be read on command
|
||||
|
||||
|
||||
@ -30,14 +33,21 @@ class Tmp1075ActionIds:
|
||||
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(object_id: bytearray, op_code: str, tc_queue: TcQueueT) -> TcQueueT:
|
||||
def pack_tmp1075_test_into(
|
||||
object_id: bytearray, op_code: str, tc_queue: TcQueueT
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex())
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x"
|
||||
+ object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Starting new temperature conversion"))
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "TMP1075: Starting new temperature conversion")
|
||||
)
|
||||
command = object_id + Tmp1075ActionIds.start_adc_conversion
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -11,14 +11,16 @@ from tmtccmd.pus.service_1_verification import Service1TMExtended
|
||||
from tmtccmd.pus.service_17_test import Service17TMExtended
|
||||
from tmtccmd.tm.service_3_housekeeping import Service3TM
|
||||
from tmtccmd.tm.service_5_event import Service5TM
|
||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter
|
||||
from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats
|
||||
|
||||
from config.definitions import PUS_APID
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None:
|
||||
def ccsds_tm_handler(
|
||||
apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter
|
||||
) -> None:
|
||||
if apid == PUS_APID:
|
||||
pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer)
|
||||
|
||||
@ -33,7 +35,9 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
||||
if service_type == 1:
|
||||
tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet)
|
||||
if service_type == 3:
|
||||
tm_packet = Service3TM.unpack(raw_telemetry=raw_tm_packet, custom_hk_handling=False)
|
||||
tm_packet = Service3TM.unpack(
|
||||
raw_telemetry=raw_tm_packet, custom_hk_handling=False
|
||||
)
|
||||
if service_type == 5:
|
||||
tm_packet = Service5TM.unpack(raw_telemetry=raw_tm_packet)
|
||||
if service_type == 8:
|
||||
@ -41,9 +45,14 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
|
||||
if service_type == 17:
|
||||
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
|
||||
if tm_packet is None:
|
||||
LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory')
|
||||
LOGGER.info(
|
||||
f"The service {service_type} is not implemented in Telemetry Factory"
|
||||
)
|
||||
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
|
||||
tmtc_printer.print_telemetry(packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False)
|
||||
tm_packet.print_source_data(PrintFormats.HEX)
|
||||
tmtc_printer.print_telemetry(
|
||||
packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False
|
||||
)
|
||||
except ValueError:
|
||||
# TODO: Log faulty packet
|
||||
LOGGER.warning("Invalid packet format detected")
|
||||
|
@ -8,17 +8,21 @@ from tmtccmd.tm.service_3_housekeeping import Service3Base
|
||||
from tmtccmd.utility.logger import get_console_logger
|
||||
from pus_tc.syrlinks_hk_handler import SetIds
|
||||
from pus_tc.imtq import ImtqSetIds
|
||||
from config.object_ids import SYRLINKS_HANDLER, IMTQ_HANDLER_ID, GPS_HANDLER_0_ID, GPS_HANDLER_1_ID
|
||||
from config.object_ids import (
|
||||
SYRLINKS_HANDLER_ID,
|
||||
IMTQ_HANDLER_ID,
|
||||
GPS_HANDLER_0_ID,
|
||||
GPS_HANDLER_1_ID,
|
||||
)
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def handle_user_hk_packet(
|
||||
object_id: bytes, set_id: int, hk_data: bytearray,
|
||||
service3_packet: Service3Base
|
||||
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
|
||||
) -> Tuple[list, list, bytearray, int]:
|
||||
"""This function is called when a Service 3 Housekeeping packet is received.
|
||||
"""
|
||||
if object_id == SYRLINKS_HANDLER:
|
||||
"""This function is called when a Service 3 Housekeeping packet is received."""
|
||||
if object_id == SYRLINKS_HANDLER_ID:
|
||||
if set_id == SetIds.RX_REGISTERS_DATASET:
|
||||
return handle_syrlinks_rx_registers_dataset(hk_data)
|
||||
elif set_id == SetIds.TX_REGISTERS_DATASET:
|
||||
@ -27,7 +31,9 @@ def handle_user_hk_packet(
|
||||
LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id")
|
||||
return [], [], bytearray(), 0
|
||||
elif object_id == IMTQ_HANDLER_ID:
|
||||
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (set_id <= ImtqSetIds.NEGATIVE_Z_TEST):
|
||||
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (
|
||||
set_id <= ImtqSetIds.NEGATIVE_Z_TEST
|
||||
):
|
||||
return handle_self_test_data(hk_data)
|
||||
else:
|
||||
LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id")
|
||||
@ -39,34 +45,54 @@ def handle_user_hk_packet(
|
||||
return [], [], bytearray(), 0
|
||||
|
||||
|
||||
def handle_syrlinks_rx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]:
|
||||
def handle_syrlinks_rx_registers_dataset(
|
||||
hk_data: bytearray,
|
||||
) -> Tuple[list, list, bytearray, int]:
|
||||
hk_header = []
|
||||
hk_content = []
|
||||
validity_buffer = bytearray()
|
||||
hk_header = ["RX Status", "RX Sensitivity", "RX Frequency Shift", "RX IQ Power", "RX AGC Value", "RX Demod Eb",
|
||||
"RX Demod N0", "RX Datarate"]
|
||||
hk_header = [
|
||||
"RX Status",
|
||||
"RX Sensitivity",
|
||||
"RX Frequency Shift",
|
||||
"RX IQ Power",
|
||||
"RX AGC Value",
|
||||
"RX Demod Eb",
|
||||
"RX Demod N0",
|
||||
"RX Datarate",
|
||||
]
|
||||
rx_status = hk_data[0]
|
||||
rx_sensitivity = struct.unpack('!I', hk_data[1:5])
|
||||
rx_frequency_shift = struct.unpack('!I', hk_data[5:9])
|
||||
rx_iq_power = struct.unpack('!H', hk_data[9:11])
|
||||
rx_agc_value = struct.unpack('!H', hk_data[11:13])
|
||||
rx_demod_eb = struct.unpack('!I', hk_data[13:17])
|
||||
rx_demod_n0 = struct.unpack('!I', hk_data[17:21])
|
||||
rx_sensitivity = struct.unpack("!I", hk_data[1:5])
|
||||
rx_frequency_shift = struct.unpack("!I", hk_data[5:9])
|
||||
rx_iq_power = struct.unpack("!H", hk_data[9:11])
|
||||
rx_agc_value = struct.unpack("!H", hk_data[11:13])
|
||||
rx_demod_eb = struct.unpack("!I", hk_data[13:17])
|
||||
rx_demod_n0 = struct.unpack("!I", hk_data[17:21])
|
||||
rx_data_rate = hk_data[21]
|
||||
hk_content = [rx_status, rx_sensitivity, rx_frequency_shift, rx_iq_power, rx_agc_value, rx_demod_eb, rx_demod_n0,
|
||||
rx_data_rate]
|
||||
hk_content = [
|
||||
rx_status,
|
||||
rx_sensitivity,
|
||||
rx_frequency_shift,
|
||||
rx_iq_power,
|
||||
rx_agc_value,
|
||||
rx_demod_eb,
|
||||
rx_demod_n0,
|
||||
rx_data_rate,
|
||||
]
|
||||
return hk_header, hk_content, validity_buffer, 8
|
||||
|
||||
|
||||
def handle_syrlinks_tx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]:
|
||||
def handle_syrlinks_tx_registers_dataset(
|
||||
hk_data: bytearray,
|
||||
) -> Tuple[list, list, bytearray, int]:
|
||||
hk_header = []
|
||||
hk_content = []
|
||||
validity_buffer = bytearray()
|
||||
hk_header = ["TX Status", "TX Waveform", "TX AGC value"]
|
||||
tx_status = hk_data[0]
|
||||
tx_waveform = hk_data[1]
|
||||
tx_agc_value = struct.unpack('!H', hk_data[2:4])
|
||||
hk_content = [tx_status, tx_waveform, tx_agc_value]
|
||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])
|
||||
hk_content = [tx_status, tx_waveform, tx_agc_value]
|
||||
return hk_header, hk_content, validity_buffer, 3
|
||||
|
||||
|
||||
@ -75,124 +101,179 @@ def handle_self_test_data(hk_data: bytearray) -> Tuple[list, list, bytearray, in
|
||||
hk_content = []
|
||||
validity_buffer = bytearray()
|
||||
hk_header = [
|
||||
"Init Err", "Init Raw Mag X [nT]", "Init Raw Mag Y [nT]", "Init Raw Mag Z [nT]",
|
||||
"Init Cal Mag X [nT]", "Init Cal Mag Y [nT]", "Init Cal Mag Z [nT]",
|
||||
"Init Coil X Current [mA]", "Init Coil Y Current [mA]", "Init Coil Z Current [mA]",
|
||||
"Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]",
|
||||
"Init Coil Z Temperature [°C]", "Err", "Raw Mag X [nT]", "Raw Mag Y [nT]", "Raw Mag Z [nT]",
|
||||
"Cal Mag X [nT]", "Cal Mag Y [nT]", "Cal Mag Z [nT]", "Coil X Current [mA]",
|
||||
"Coil Y Current [mA]", "Coil Z Current [mA]",
|
||||
"Coil X Temperature [°C]", "Coil Y Temperature [°C]", "Coil Z Temperature [°C]",
|
||||
"Fina Err", "Fina Raw Mag X [nT]", "Fina Raw Mag Y [nT]", "Fina Raw Mag Z [nT]",
|
||||
"Fina Cal Mag X [nT]", "Fina Cal Mag Y [nT]", "Fina Cal Mag Z [nT]",
|
||||
"Fina Coil X Current [mA]", "Fina Coil Y Current [mA]", "Fina Coil Z Current [mA]",
|
||||
"Fina Coil X Temperature [°C]", "Fina Coil Y Temperature [°C]",
|
||||
"Fina Coil Z Temperature [°C]"
|
||||
"Init Err",
|
||||
"Init Raw Mag X [nT]",
|
||||
"Init Raw Mag Y [nT]",
|
||||
"Init Raw Mag Z [nT]",
|
||||
"Init Cal Mag X [nT]",
|
||||
"Init Cal Mag Y [nT]",
|
||||
"Init Cal Mag Z [nT]",
|
||||
"Init Coil X Current [mA]",
|
||||
"Init Coil Y Current [mA]",
|
||||
"Init Coil Z Current [mA]",
|
||||
"Init Coil X Temperature [°C]",
|
||||
"Init Coil Y Temperature [°C]",
|
||||
"Init Coil Z Temperature [°C]",
|
||||
"Err",
|
||||
"Raw Mag X [nT]",
|
||||
"Raw Mag Y [nT]",
|
||||
"Raw Mag Z [nT]",
|
||||
"Cal Mag X [nT]",
|
||||
"Cal Mag Y [nT]",
|
||||
"Cal Mag Z [nT]",
|
||||
"Coil X Current [mA]",
|
||||
"Coil Y Current [mA]",
|
||||
"Coil Z Current [mA]",
|
||||
"Coil X Temperature [°C]",
|
||||
"Coil Y Temperature [°C]",
|
||||
"Coil Z Temperature [°C]",
|
||||
"Fina Err",
|
||||
"Fina Raw Mag X [nT]",
|
||||
"Fina Raw Mag Y [nT]",
|
||||
"Fina Raw Mag Z [nT]",
|
||||
"Fina Cal Mag X [nT]",
|
||||
"Fina Cal Mag Y [nT]",
|
||||
"Fina Cal Mag Z [nT]",
|
||||
"Fina Coil X Current [mA]",
|
||||
"Fina Coil Y Current [mA]",
|
||||
"Fina Coil Z Current [mA]",
|
||||
"Fina Coil X Temperature [°C]",
|
||||
"Fina Coil Y Temperature [°C]",
|
||||
"Fina Coil Z Temperature [°C]",
|
||||
]
|
||||
# INIT step (no coil actuation)
|
||||
init_err = hk_data[0]
|
||||
init_raw_mag_x = struct.unpack('!f', hk_data[1:5])[0]
|
||||
init_raw_mag_y = struct.unpack('!f', hk_data[5:9])[0]
|
||||
init_raw_mag_z = struct.unpack('!f', hk_data[9:13])[0]
|
||||
init_cal_mag_x = struct.unpack('!f', hk_data[13:17])[0]
|
||||
init_cal_mag_y = struct.unpack('!f', hk_data[17:21])[0]
|
||||
init_cal_mag_z = struct.unpack('!f', hk_data[21:25])[0]
|
||||
init_coil_x_current = struct.unpack('!f', hk_data[25:29])[0]
|
||||
init_coil_y_current = struct.unpack('!f', hk_data[29:33])[0]
|
||||
init_coil_z_current = struct.unpack('!f', hk_data[33:37])[0]
|
||||
init_coil_x_temperature = struct.unpack('!H', hk_data[37:39])[0]
|
||||
init_coil_y_temperature = struct.unpack('!H', hk_data[39:41])[0]
|
||||
init_coil_z_temperature = struct.unpack('!H', hk_data[41:43])[0]
|
||||
init_raw_mag_x = struct.unpack("!f", hk_data[1:5])[0]
|
||||
init_raw_mag_y = struct.unpack("!f", hk_data[5:9])[0]
|
||||
init_raw_mag_z = struct.unpack("!f", hk_data[9:13])[0]
|
||||
init_cal_mag_x = struct.unpack("!f", hk_data[13:17])[0]
|
||||
init_cal_mag_y = struct.unpack("!f", hk_data[17:21])[0]
|
||||
init_cal_mag_z = struct.unpack("!f", hk_data[21:25])[0]
|
||||
init_coil_x_current = struct.unpack("!f", hk_data[25:29])[0]
|
||||
init_coil_y_current = struct.unpack("!f", hk_data[29:33])[0]
|
||||
init_coil_z_current = struct.unpack("!f", hk_data[33:37])[0]
|
||||
init_coil_x_temperature = struct.unpack("!H", hk_data[37:39])[0]
|
||||
init_coil_y_temperature = struct.unpack("!H", hk_data[39:41])[0]
|
||||
init_coil_z_temperature = struct.unpack("!H", hk_data[41:43])[0]
|
||||
|
||||
# Actuation step
|
||||
err = hk_data[43]
|
||||
raw_mag_x = struct.unpack('!f', hk_data[44:48])[0]
|
||||
raw_mag_y = struct.unpack('!f', hk_data[48:52])[0]
|
||||
raw_mag_z = struct.unpack('!f', hk_data[52:56])[0]
|
||||
cal_mag_x = struct.unpack('!f', hk_data[56:60])[0]
|
||||
cal_mag_y = struct.unpack('!f', hk_data[60:64])[0]
|
||||
cal_mag_z = struct.unpack('!f', hk_data[64:68])[0]
|
||||
coil_x_current = struct.unpack('!f', hk_data[68:72])[0]
|
||||
coil_y_current = struct.unpack('!f', hk_data[72:76])[0]
|
||||
coil_z_current = struct.unpack('!f', hk_data[76:80])[0]
|
||||
coil_x_temperature = struct.unpack('!H', hk_data[80:82])[0]
|
||||
coil_y_temperature = struct.unpack('!H', hk_data[82:84])[0]
|
||||
coil_z_temperature = struct.unpack('!H', hk_data[84:86])[0]
|
||||
raw_mag_x = struct.unpack("!f", hk_data[44:48])[0]
|
||||
raw_mag_y = struct.unpack("!f", hk_data[48:52])[0]
|
||||
raw_mag_z = struct.unpack("!f", hk_data[52:56])[0]
|
||||
cal_mag_x = struct.unpack("!f", hk_data[56:60])[0]
|
||||
cal_mag_y = struct.unpack("!f", hk_data[60:64])[0]
|
||||
cal_mag_z = struct.unpack("!f", hk_data[64:68])[0]
|
||||
coil_x_current = struct.unpack("!f", hk_data[68:72])[0]
|
||||
coil_y_current = struct.unpack("!f", hk_data[72:76])[0]
|
||||
coil_z_current = struct.unpack("!f", hk_data[76:80])[0]
|
||||
coil_x_temperature = struct.unpack("!H", hk_data[80:82])[0]
|
||||
coil_y_temperature = struct.unpack("!H", hk_data[82:84])[0]
|
||||
coil_z_temperature = struct.unpack("!H", hk_data[84:86])[0]
|
||||
|
||||
# FINA step (no coil actuation)
|
||||
fina_err = hk_data[86]
|
||||
fina_raw_mag_x = struct.unpack('!f', hk_data[87:91])[0]
|
||||
fina_raw_mag_y = struct.unpack('!f', hk_data[91:95])[0]
|
||||
fina_raw_mag_z = struct.unpack('!f', hk_data[95:99])[0]
|
||||
fina_cal_mag_x = struct.unpack('!f', hk_data[99:103])[0]
|
||||
fina_cal_mag_y = struct.unpack('!f', hk_data[103:107])[0]
|
||||
fina_cal_mag_z = struct.unpack('!f', hk_data[107:111])[0]
|
||||
fina_coil_x_current = struct.unpack('!f', hk_data[111:115])[0]
|
||||
fina_coil_y_current = struct.unpack('!f', hk_data[115:119])[0]
|
||||
fina_coil_z_current = struct.unpack('!f', hk_data[119:123])[0]
|
||||
fina_coil_x_temperature = struct.unpack('!H', hk_data[123:125])[0]
|
||||
fina_coil_y_temperature = struct.unpack('!H', hk_data[125:127])[0]
|
||||
fina_coil_z_temperature = struct.unpack('!H', hk_data[127:129])[0]
|
||||
fina_raw_mag_x = struct.unpack("!f", hk_data[87:91])[0]
|
||||
fina_raw_mag_y = struct.unpack("!f", hk_data[91:95])[0]
|
||||
fina_raw_mag_z = struct.unpack("!f", hk_data[95:99])[0]
|
||||
fina_cal_mag_x = struct.unpack("!f", hk_data[99:103])[0]
|
||||
fina_cal_mag_y = struct.unpack("!f", hk_data[103:107])[0]
|
||||
fina_cal_mag_z = struct.unpack("!f", hk_data[107:111])[0]
|
||||
fina_coil_x_current = struct.unpack("!f", hk_data[111:115])[0]
|
||||
fina_coil_y_current = struct.unpack("!f", hk_data[115:119])[0]
|
||||
fina_coil_z_current = struct.unpack("!f", hk_data[119:123])[0]
|
||||
fina_coil_x_temperature = struct.unpack("!H", hk_data[123:125])[0]
|
||||
fina_coil_y_temperature = struct.unpack("!H", hk_data[125:127])[0]
|
||||
fina_coil_z_temperature = struct.unpack("!H", hk_data[127:129])[0]
|
||||
|
||||
hk_content = [
|
||||
init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y,
|
||||
init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current,
|
||||
init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature, err,
|
||||
raw_mag_x, init_raw_mag_y, raw_mag_z, cal_mag_x, cal_mag_y, cal_mag_z,
|
||||
coil_x_current, coil_y_current, coil_z_current,
|
||||
coil_x_temperature, coil_y_temperature, coil_z_temperature, fina_err,
|
||||
fina_raw_mag_x, fina_raw_mag_y, fina_raw_mag_z,
|
||||
fina_cal_mag_x, fina_cal_mag_y, fina_cal_mag_z,
|
||||
fina_coil_x_current, fina_coil_y_current, fina_coil_z_current,
|
||||
fina_coil_x_temperature, fina_coil_y_temperature, fina_coil_z_temperature
|
||||
init_err,
|
||||
init_raw_mag_x,
|
||||
init_raw_mag_y,
|
||||
init_raw_mag_z,
|
||||
init_cal_mag_x,
|
||||
init_cal_mag_y,
|
||||
init_cal_mag_z,
|
||||
init_coil_x_current,
|
||||
init_coil_y_current,
|
||||
init_coil_z_current,
|
||||
init_coil_x_temperature,
|
||||
init_coil_y_temperature,
|
||||
init_coil_z_temperature,
|
||||
err,
|
||||
raw_mag_x,
|
||||
init_raw_mag_y,
|
||||
raw_mag_z,
|
||||
cal_mag_x,
|
||||
cal_mag_y,
|
||||
cal_mag_z,
|
||||
coil_x_current,
|
||||
coil_y_current,
|
||||
coil_z_current,
|
||||
coil_x_temperature,
|
||||
coil_y_temperature,
|
||||
coil_z_temperature,
|
||||
fina_err,
|
||||
fina_raw_mag_x,
|
||||
fina_raw_mag_y,
|
||||
fina_raw_mag_z,
|
||||
fina_cal_mag_x,
|
||||
fina_cal_mag_y,
|
||||
fina_cal_mag_z,
|
||||
fina_coil_x_current,
|
||||
fina_coil_y_current,
|
||||
fina_coil_z_current,
|
||||
fina_coil_x_temperature,
|
||||
fina_coil_y_temperature,
|
||||
fina_coil_z_temperature,
|
||||
]
|
||||
|
||||
return hk_header, hk_content, validity_buffer, len(hk_header)
|
||||
|
||||
|
||||
def handle_gps_data(hk_data: bytearray) -> Tuple[list, list, bytearray, int]:
|
||||
LOGGER.info(f'Received GPS data, HK data length {len(hk_data)}')
|
||||
LOGGER.info(f"Received GPS data, HK data length {len(hk_data)}")
|
||||
var_index = 0
|
||||
header_array = []
|
||||
content_array = []
|
||||
latitude = struct.unpack('!d', hk_data[0:8])[0]
|
||||
header_array.append('Latitude')
|
||||
latitude = struct.unpack("!d", hk_data[0:8])[0]
|
||||
header_array.append("Latitude")
|
||||
content_array.append(latitude)
|
||||
longitude = struct.unpack('!d', hk_data[8:16])[0]
|
||||
header_array.append('Longitude')
|
||||
longitude = struct.unpack("!d", hk_data[8:16])[0]
|
||||
header_array.append("Longitude")
|
||||
content_array.append(longitude)
|
||||
altitude = struct.unpack('!d', hk_data[16:24])[0]
|
||||
header_array.append('Altitude')
|
||||
altitude = struct.unpack("!d", hk_data[16:24])[0]
|
||||
header_array.append("Altitude")
|
||||
content_array.append(altitude)
|
||||
fix_mode = hk_data[24]
|
||||
header_array.append('Fix Mode')
|
||||
header_array.append("Fix Mode")
|
||||
content_array.append(fix_mode)
|
||||
sat_in_use = hk_data[25]
|
||||
header_array.append('Sats in Use')
|
||||
header_array.append("Sats in Use")
|
||||
content_array.append(sat_in_use)
|
||||
year = struct.unpack('!H', hk_data[26:28])[0]
|
||||
year = struct.unpack("!H", hk_data[26:28])[0]
|
||||
month = hk_data[28]
|
||||
day = hk_data[29]
|
||||
hours = hk_data[30]
|
||||
minutes = hk_data[31]
|
||||
seconds = hk_data[32]
|
||||
header_array.append('Date')
|
||||
date_string = f'{day}.{month}.{year} {hours}:{minutes}:{seconds}'
|
||||
header_array.append("Date")
|
||||
date_string = f"{day}.{month}.{year} {hours}:{minutes}:{seconds}"
|
||||
content_array.append(date_string)
|
||||
unix_seconds = struct.unpack('!I', hk_data[33:37])[0]
|
||||
header_array.append('Unix Seconds')
|
||||
unix_seconds = struct.unpack("!I", hk_data[33:37])[0]
|
||||
header_array.append("Unix Seconds")
|
||||
content_array.append(unix_seconds)
|
||||
var_index += 13
|
||||
if not os.path.isfile('gps_log.txt'):
|
||||
if not os.path.isfile("gps_log.txt"):
|
||||
with open("gps_log.txt", "w") as gps_file:
|
||||
gps_file.write(
|
||||
'Time, Latitude [deg], Longitude [deg], Altitude [m], Fix Mode, Sats in Use, '
|
||||
'Date, Unix Seconds\n'
|
||||
"Time, Latitude [deg], Longitude [deg], Altitude [m], Fix Mode, Sats in Use, "
|
||||
"Date, Unix Seconds\n"
|
||||
)
|
||||
with open("gps_log.txt", "a") as gps_file:
|
||||
gps_file.write(
|
||||
f'{datetime.datetime.now()}, {latitude}, {longitude}, {altitude}, '
|
||||
f'{fix_mode}, {sat_in_use}, {date_string}, {unix_seconds}\n'
|
||||
f"{datetime.datetime.now()}, {latitude}, {longitude}, {altitude}, "
|
||||
f"{fix_mode}, {sat_in_use}, {date_string}, {unix_seconds}\n"
|
||||
)
|
||||
validity_buffer = hk_data[37:39]
|
||||
return header_array, content_array, validity_buffer, var_index
|
||||
|
@ -11,7 +11,8 @@ LOGGER = get_console_logger()
|
||||
|
||||
|
||||
def user_analyze_service_8_data(
|
||||
object_id: bytes, action_id: int, custom_data: bytearray) -> Tuple[list, list]:
|
||||
object_id: bytes, action_id: int, custom_data: bytearray
|
||||
) -> Tuple[list, list]:
|
||||
"""
|
||||
This function is called by the TMTC core if a Service 8 data reply (subservice 130)
|
||||
is received. The user can return a tuple of two lists, where the first list
|
||||
@ -24,13 +25,13 @@ def user_analyze_service_8_data(
|
||||
@return:
|
||||
"""
|
||||
if object_id == PDU_2_HANDLER_ID:
|
||||
header_list = ['PDU2 Service 8 Reply']
|
||||
header_list = ["PDU2 Service 8 Reply"]
|
||||
|
||||
data_string = str()
|
||||
for index in range(len(custom_data)):
|
||||
data_string += str(hex(custom_data[index])) + " , "
|
||||
data_string = data_string.rstrip()
|
||||
data_string = data_string.rstrip(',')
|
||||
data_string = data_string.rstrip(",")
|
||||
data_string = data_string.rstrip()
|
||||
content_list = [data_string]
|
||||
elif object_id == IMTQ_HANDLER_ID:
|
||||
@ -50,11 +51,11 @@ def user_analyze_service_8_data(
|
||||
def handle_imtq_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]:
|
||||
header_list = []
|
||||
content_list = []
|
||||
if action_id == struct.unpack('!I', ImtqActionIds.get_commanded_dipole)[0]:
|
||||
header_list = ['Commanded X-Dipole', 'Commanded Y-Dipole', 'Commanded Z-Dipole']
|
||||
x_dipole = struct.unpack('!H', custom_data[:2])
|
||||
y_dipole = struct.unpack('!H', custom_data[2:4])
|
||||
z_dipole = struct.unpack('!H', custom_data[4:6])
|
||||
if action_id == struct.unpack("!I", ImtqActionIds.get_commanded_dipole)[0]:
|
||||
header_list = ["Commanded X-Dipole", "Commanded Y-Dipole", "Commanded Z-Dipole"]
|
||||
x_dipole = struct.unpack("!H", custom_data[:2])
|
||||
y_dipole = struct.unpack("!H", custom_data[2:4])
|
||||
z_dipole = struct.unpack("!H", custom_data[4:6])
|
||||
content_list = [x_dipole[0], y_dipole[0], z_dipole[0]]
|
||||
|
||||
|
||||
@ -62,29 +63,35 @@ def handle_ploc_replies(action_id: int, custom_data: bytearray) -> Tuple[list, l
|
||||
header_list = []
|
||||
content_list = []
|
||||
if action_id == PlocReplyIds.tm_mem_read_report:
|
||||
header_list = ['PLOC Memory Address', 'PLOC Mem Len', 'PLOC Read Memory Data']
|
||||
header_list = ["PLOC Memory Address", "PLOC Mem Len", "PLOC Read Memory Data"]
|
||||
content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]]
|
||||
return header_list, content_list
|
||||
|
||||
|
||||
def handle_supervisor_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]:
|
||||
def handle_supervisor_replies(
|
||||
action_id: int, custom_data: bytearray
|
||||
) -> Tuple[list, list]:
|
||||
header_list = []
|
||||
content_list = []
|
||||
if action_id == SupvActionIds.DUMP_MRAM:
|
||||
header_list = ['MRAM Dump']
|
||||
content_list = [custom_data[:len(custom_data)]]
|
||||
header_list = ["MRAM Dump"]
|
||||
content_list = [custom_data[: len(custom_data)]]
|
||||
return header_list, content_list
|
||||
|
||||
|
||||
def handle_startracker_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]:
|
||||
def handle_startracker_replies(
|
||||
action_id: int, custom_data: bytearray
|
||||
) -> Tuple[list, list]:
|
||||
header_list = []
|
||||
content_list = []
|
||||
if action_id == StarTrackerActionIds.CHECKSUM:
|
||||
if len(custom_data) != 5:
|
||||
LOGGER.warning("Star tracker reply has invalid length {0}".format(len(custom_data)))
|
||||
LOGGER.warning(
|
||||
"Star tracker reply has invalid length {0}".format(len(custom_data))
|
||||
)
|
||||
return header_list, content_list
|
||||
header_list = ['Checksum', 'Checksum valid']
|
||||
header_list = ["Checksum", "Checksum valid"]
|
||||
print(custom_data[4])
|
||||
checksum_valid_flag = custom_data[4] >> 8
|
||||
content_list = ['0x' + custom_data[:4].hex(), checksum_valid_flag]
|
||||
content_list = ["0x" + custom_data[:4].hex(), checksum_valid_flag]
|
||||
return header_list, content_list
|
@ -1 +1 @@
|
||||
tmtccmd>=1.10.1
|
||||
tmtccmd>=1.10.2
|
||||
|
25
tmtccli.py
25
tmtccli.py
@ -27,18 +27,23 @@ limitations under the License.
|
||||
@author R. Mueller
|
||||
"""
|
||||
import sys
|
||||
|
||||
try:
|
||||
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler
|
||||
from tmtccmd.runner import (
|
||||
initialize_tmtc_commander,
|
||||
run_tmtc_commander,
|
||||
add_ccsds_handler,
|
||||
)
|
||||
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
||||
from tmtccmd.utility.logger import TMTC_LOGGER_NAME
|
||||
except ImportError as error:
|
||||
run_tmtc_commander = None
|
||||
initialize_tmtc_commander = None
|
||||
print(error)
|
||||
print('Python tmtccmd submodule could not be imported')
|
||||
print("Python tmtccmd submodule could not be imported")
|
||||
print(
|
||||
'Install with \"cd tmtccmd && python3 -m pip '
|
||||
'install -e .[gui]\" for interactive installation'
|
||||
'Install with "cd tmtccmd && python3 -m pip '
|
||||
'install -e .[gui]" for interactive installation'
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
@ -47,9 +52,9 @@ try:
|
||||
from spacepackets.log import set_custom_console_logger_name
|
||||
except ImportError as error:
|
||||
print(error)
|
||||
print('Python spacepackets module could not be imported')
|
||||
print("Python spacepackets module could not be imported")
|
||||
print(
|
||||
'Install with \"cd spacepackets && python3 -m pip intall -e .\" for interative installation'
|
||||
'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
@ -61,12 +66,14 @@ from pus_tm.factory_hook import ccsds_tm_handler
|
||||
|
||||
def main():
|
||||
hook_obj = EiveHookObject()
|
||||
print(f'-- eive tmtc version {__version__} --')
|
||||
print(f'-- spacepackets version {spacepackets.__version__} --')
|
||||
print(f"-- eive tmtc version {__version__} --")
|
||||
print(f"-- spacepackets version {spacepackets.__version__} --")
|
||||
set_custom_console_logger_name(logger_name=TMTC_LOGGER_NAME)
|
||||
initialize_tmtc_commander(hook_object=hook_obj)
|
||||
ccsds_handler = CcsdsTmHandler()
|
||||
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
|
||||
ccsds_handler.add_tm_handler(
|
||||
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
|
||||
)
|
||||
add_ccsds_handler(ccsds_handler)
|
||||
run_tmtc_commander(False)
|
||||
|
||||
|
17
tmtcgui.py
17
tmtcgui.py
@ -32,8 +32,13 @@ from config.hook_implementations import EiveHookObject
|
||||
from config.version import __version__
|
||||
from config.definitions import PUS_APID
|
||||
from pus_tm.factory_hook import ccsds_tm_handler
|
||||
|
||||
try:
|
||||
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler
|
||||
from tmtccmd.runner import (
|
||||
initialize_tmtc_commander,
|
||||
run_tmtc_commander,
|
||||
add_ccsds_handler,
|
||||
)
|
||||
from tmtccmd.ccsds.handler import CcsdsTmHandler
|
||||
import spacepackets
|
||||
except ImportError as error:
|
||||
@ -41,17 +46,21 @@ except ImportError as error:
|
||||
initialize_tmtc_commander = None
|
||||
print(error)
|
||||
print("Python tmtccmd submodule could not be imported")
|
||||
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation")
|
||||
print(
|
||||
'Install with "cd tmtccmd && python3 -m pip install -e ." for interactive installation'
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def main():
|
||||
hook_obj = EiveHookObject()
|
||||
print(f"-- eive tmtc version {__version__}")
|
||||
print(f'-- spacepackets version {spacepackets.__version__} --')
|
||||
print(f"-- spacepackets version {spacepackets.__version__} --")
|
||||
initialize_tmtc_commander(hook_object=hook_obj)
|
||||
ccsds_handler = CcsdsTmHandler()
|
||||
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50)
|
||||
ccsds_handler.add_tm_handler(
|
||||
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
|
||||
)
|
||||
add_ccsds_handler(ccsds_handler)
|
||||
run_tmtc_commander(use_gui=True)
|
||||
|
||||
|
@ -1,11 +1,12 @@
|
||||
|
||||
|
||||
def parse_input_arguments_user(print_known_args: bool = False, print_unknown_args: bool = False):
|
||||
def parse_input_arguments_user(
|
||||
print_known_args: bool = False, print_unknown_args: bool = False
|
||||
):
|
||||
"""
|
||||
This function by default will build the default argument parser. A custom CLI parser can be
|
||||
built in this function if required.
|
||||
"""
|
||||
from tmtccmd.config.args import parse_default_input_arguments
|
||||
|
||||
parse_default_input_arguments(
|
||||
print_known_args=print_known_args, print_unknown_args=print_unknown_args
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user