hate forgetting to push so much

This commit is contained in:
Robin Müller 2022-05-24 13:24:02 +02:00
parent 7d197dbe4b
commit 0064faf72d
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 21 additions and 11 deletions

View File

@ -2,9 +2,12 @@ from tmtccmd.config import (
ServiceOpCodeDictT,
add_op_code_entry,
add_service_op_code_entry,
generate_op_code_options,
OpCodeDictKeys,
)
from tmtccmd.config.definitions import OpCodeOptionsT
from tmtccmd.config.globals import get_default_service_op_code_dict
from common_tmtc.pus_tc.pus_11_tc_sched import OpCodes
def common_fsfw_service_op_code_dict() -> ServiceOpCodeDictT:
@ -25,7 +28,13 @@ def common_fsfw_service_op_code_dict() -> ServiceOpCodeDictT:
)
op_code = dict()
add_op_code_entry(op_code_dict=op_code, keys="test", info="TC Scheduling Test")
add_op_code_entry(
op_code_dict=op_code,
keys=OpCodes.INSERT,
info="Insertion Test",
options=generate_op_code_options(custom_timeout=0.5),
)
add_op_code_entry(op_code_dict=op_code, keys=OpCodes.DELETE, info="Deletion Test")
add_service_op_code_entry(
srv_op_code_dict=service_op_code_dict,
name="11",

View File

@ -26,18 +26,17 @@ def pack_service_11_commands(op_code: str, tc_queue: TcQueueT):
pack_service_17_ping_command(1701),
pack_service_17_ping_command(1702),
pack_service_17_ping_command(1703),
pack_service_17_ping_command(1704),
pack_service_17_ping_command(1705),
]
for idx, tc in enumerate(ping_tcs):
release_time = current_time + 20 + idx * 10
tc = PusTelecommand(
release_time = current_time + (idx + 1) * 5
time_tagged_tc = PusTelecommand(
service=11,
subservice=Subservices.TC_INSERT,
app_data=pack_insert_tc_app_data(release_time, tc),
app_data=pack_insert_tc_app_data(struct.pack("!I", release_time), tc),
)
tc_queue.appendleft(tc.pack_command_tuple())
if op_code in ["0", "del-test"]:
tc_queue.appendleft(time_tagged_tc.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 25))
if op_code in ["1", "del-test"]:
tc_queue.appendleft(
(QueueCommands.PRINT, "Testing Time-Tagged Command deletion")
)
@ -46,7 +45,9 @@ def pack_service_11_commands(op_code: str, tc_queue: TcQueueT):
time_tagged_tc = PusTelecommand(
service=11,
subservice=Subservices.TC_INSERT,
app_data=pack_insert_tc_app_data(current_time + 20, tc_to_schedule),
app_data=pack_insert_tc_app_data(
struct.pack("!I", current_time + 20), tc_to_schedule
),
)
tc_queue.appendleft(time_tagged_tc.pack_command_tuple())
del_time_tagged_tcs = PusTelecommand(
@ -83,10 +84,10 @@ def pack_service_11_commands(op_code: str, tc_queue: TcQueueT):
# this function packs another TC into an insert activity TC[11,4]
# parameter: release_time: Absolute time when TC shall be released/run
# parameter tc_to_insert: The TC which shall be inserted
def pack_insert_tc_app_data(release_time: int, tc_to_insert: PusTelecommand) -> bytes:
def pack_insert_tc_app_data(release_time: bytes, tc_to_insert: PusTelecommand) -> bytes:
app_data = bytearray()
# pack the release time
app_data.extend(struct.pack("!I", release_time))
app_data.extend(release_time)
# followed by the tc
app_data.extend(tc_to_insert.pack())
return app_data