Skip to content

Commit

Permalink
various smaller updates and changes
Browse files Browse the repository at this point in the history
  • Loading branch information
robamu committed Jul 3, 2022
1 parent dd56396 commit 4d34585
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 72 deletions.
3 changes: 1 addition & 2 deletions tmtccmd/config/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ def get_tmtc_definitions(self) -> TmTcDefWrapper:

return get_default_tmtc_defs()

@abstractmethod
def perform_mode_operation(self, tmtc_backend: BackendBase, mode: int):
"""Perform custom mode operations.
:param tmtc_backend:
:param mode:
:return:
"""
pass
print("No custom mode operation implemented")

def get_retval_dict(self) -> RetvalDictT:
from tmtccmd import get_console_logger
Expand Down
2 changes: 1 addition & 1 deletion tmtccmd/config/tmtc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def info(self, op_code: str) -> Optional[str]:
return entry_tuple[0]

def __repr__(self):
return f"{self.__class__.__name__}(init_dict={self._op_code_dict!r}"
return f"{self.__class__.__name__}(init_dict={self._op_code_dict!r})"

@property
def op_code_dict(self):
Expand Down
1 change: 0 additions & 1 deletion tmtccmd/gui/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def __start_ui(self):
win.setLayout(grid)
row = 0
self.setWindowTitle(self._app_name)
print(self.logo_path)
self.setWindowIcon(QIcon(self.logo_path.as_posix()))

add_pixmap = False
Expand Down
29 changes: 7 additions & 22 deletions tmtccmd/pus/pus_17_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import annotations
import enum

from spacepackets.ecss import PusTelecommand
from spacepackets.ecss.conf import get_default_tc_apid
from spacepackets.ecss import PusTelecommand, PusServices
from spacepackets.ecss.pus_17_test import Subservices
from tmtccmd.tc.queue import QueueHelper

Expand All @@ -11,43 +10,29 @@ class CustomSubservices(enum.IntEnum):
TC_GEN_EVENT = 128


def pack_service_17_ping_command(ssc: int, apid: int = -1) -> PusTelecommand:
def pack_service_17_ping_command() -> PusTelecommand:
"""Generate a simple ping PUS telecommand packet"""
if apid == -1:
apid = get_default_tc_apid()
return PusTelecommand(
service=17, subservice=Subservices.TC_PING.value, seq_count=ssc, apid=apid
service=PusServices.S17_TEST, subservice=Subservices.TC_PING.value
)


def pack_generic_service17_test(init_ssc: int, q: QueueHelper, apid: int = -1) -> int:
if apid == -1:
apid = get_default_tc_apid()
new_ssc = init_ssc
def pack_generic_service17_test(q: QueueHelper):
q.add_log_cmd("Testing Service 17")
# ping test
q.add_log_cmd("Testing Service 17: Ping Test")
q.add_pus_tc(pack_service_17_ping_command(ssc=new_ssc))
new_ssc += 1
q.add_pus_tc(pack_service_17_ping_command())
# enable event
q.add_log_cmd("Testing Service 17: Enable Event")
q.add_pus_tc(PusTelecommand(service=5, subservice=5, seq_count=new_ssc, apid=apid))
new_ssc += 1
q.add_pus_tc(PusTelecommand(service=5, subservice=5))
# test event
q.add_log_cmd("Testing Service 17: Trigger event")
q.add_pus_tc(
PusTelecommand(
service=17,
subservice=CustomSubservices.TC_GEN_EVENT,
seq_count=new_ssc,
apid=apid,
)
)
new_ssc += 1
# invalid subservice
q.add_log_cmd("Testing Service 17: Invalid subservice")
q.add_pus_tc(
PusTelecommand(service=17, subservice=243, seq_count=new_ssc, apid=apid)
)
new_ssc += 1
return new_ssc
q.add_pus_tc(PusTelecommand(service=17, subservice=243))
44 changes: 9 additions & 35 deletions tmtccmd/tc/pus_11_tc_sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,53 +4,27 @@
from tmtccmd.pus.pus_11_tc_sched import Subservices


def __generic_param_less_tc_sched_cmd(
subservice: int, ssc: int, apid: int = -1
) -> PusTelecommand:
return PusTelecommand(
service=PusServices.S11_TC_SCHED,
subservice=subservice,
seq_count=ssc,
apid=apid,
)
def __generic_param_less_tc_sched_cmd(subservice: int) -> PusTelecommand:
return PusTelecommand(service=PusServices.S11_TC_SCHED, subservice=subservice)


def generate_enable_tc_sched_cmd(
ssc: int, apid: int = FETCH_GLOBAL_APID
) -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(
subservice=Subservices.TC_ENABLE, ssc=ssc, apid=apid
)
def generate_enable_tc_sched_cmd() -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(subservice=Subservices.TC_ENABLE)


def generate_disable_tc_sched_cmd(
ssc: int, apid: int = FETCH_GLOBAL_APID
) -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(
subservice=Subservices.TC_DISABLE, ssc=ssc, apid=apid
)
def generate_disable_tc_sched_cmd() -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(subservice=Subservices.TC_DISABLE)


def generate_reset_tc_sched_cmd(
ssc: int, apid: int = FETCH_GLOBAL_APID
) -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(
subservice=Subservices.TC_RESET, ssc=ssc, apid=apid
)
def generate_reset_tc_sched_cmd() -> PusTelecommand:
return __generic_param_less_tc_sched_cmd(subservice=Subservices.TC_RESET)


def generate_time_tagged_cmd(
release_time: bytes,
tc_to_insert: PusTelecommand,
ssc: int,
apid: int = FETCH_GLOBAL_APID,
):
def generate_time_tagged_cmd(release_time: bytes, tc_to_insert: PusTelecommand):
return PusTelecommand(
service=PusServices.S11_TC_SCHED,
subservice=Subservices.TC_INSERT,
app_data=pack_time_tagged_tc_app_data(release_time, tc_to_insert),
seq_count=ssc,
apid=apid,
)


Expand Down
6 changes: 2 additions & 4 deletions tmtccmd/tc/pus_3_fsfw_hk.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,17 @@ def modify_collection_interval(
)


def generate_one_hk_command(sid: bytes, ssc: int) -> PusTelecommand:
def generate_one_hk_command(sid: bytes) -> PusTelecommand:
return PusTelecommand(
service=3,
subservice=Subservices.TC_GENERATE_ONE_PARAMETER_REPORT,
seq_count=ssc,
app_data=sid,
)


def generate_one_diag_command(sid: bytes, ssc: int) -> PusTelecommand:
def generate_one_diag_command(sid: bytes) -> PusTelecommand:
return PusTelecommand(
service=3,
subservice=Subservices.TC_GENERATE_ONE_DIAGNOSTICS_REPORT,
seq_count=ssc,
app_data=sid,
)
10 changes: 4 additions & 6 deletions tmtccmd/tc/pus_5_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@ def pack_disable_event_reporting_command(ssc: int, apid: int = -1):
)


def pack_generic_service5_test_into(q: QueueHelper, apid: int = -1):
if apid == -1:
apid = get_default_tc_apid()
def pack_generic_service_5_test_into(q: QueueHelper):
q.add_log_cmd("Testing Service 5")
# invalid subservice
q.add_log_cmd("Testing Service 5: Invalid subservice")
q.add_pus_tc(PusTelecommand(service=5, subservice=1, apid=apid, seq_count=500))
q.add_pus_tc(PusTelecommand(service=5, subservice=1))
# disable events
q.add_log_cmd("Testing Service 5: Disable event")
q.add_pus_tc(pack_disable_event_reporting_command(ssc=501))
# trigger event
q.add_log_cmd("Testing Service 5: Trigger event")
q.add_pus_tc(PusTelecommand(service=17, subservice=128, apid=apid, seq_count=510))
q.add_pus_tc(PusTelecommand(service=17, subservice=128))
# enable event
q.add_log_cmd("Testing Service 5: Enable event")
q.add_pus_tc(pack_enable_event_reporting_command(ssc=520))
# trigger event
q.add_log_cmd("Testing Service 5: Trigger another event")
q.add_pus_tc(PusTelecommand(service=17, subservice=128, apid=apid, seq_count=530))
q.add_pus_tc(PusTelecommand(service=17, subservice=128))
3 changes: 2 additions & 1 deletion tmtccmd/utility/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .obj_id import ObjectId
from .obj_id import ObjectId, ObjectIdDictT
from .retval import RetvalDictT

0 comments on commit 4d34585

Please sign in to comment.