From f3ccbf04187b37f24f3ff0a7a491a7a0f3ab1ab0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 Oct 2022 17:10:33 +0200 Subject: [PATCH] add better op codes --- pus_tc/devs/imtq.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pus_tc/devs/imtq.py b/pus_tc/devs/imtq.py index 7d376ab..46f532d 100644 --- a/pus_tc/devs/imtq.py +++ b/pus_tc/devs/imtq.py @@ -18,6 +18,12 @@ from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes from tmtccmd.util import ObjectIdU32 +class OpCodes: + ON = ["on"] + NORMAL = ["normal"] + OFF = ["off"] + + class ImtqSetIds: ENG_HK_SET = 1 CAL_MTM_SET = 2 @@ -49,15 +55,15 @@ def pack_imtq_test_into(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_cod f"Testing ISIS IMTQ handler with object id: {object_id.as_hex_string}" ) - if op_code == "0": + if op_code in OpCodes.OFF: q.add_log_cmd("IMTQ: Set mode off") command = pack_mode_data(object_id.as_bytes, Modes.OFF, 0) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command)) - if op_code == "1": + if op_code in OpCodes.ON: q.add_log_cmd("IMTQ: Set mode on") command = pack_mode_data(object_id.as_bytes, Modes.ON, 0) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command)) - if op_code == "2": + if op_code in OpCodes.NORMAL: q.add_log_cmd("IMTQ: Mode Normal") command = pack_mode_data(object_id.as_bytes, Modes.NORMAL, 0) q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=command))