consistency change for enum names

This commit is contained in:
2023-01-16 14:13:06 +01:00
parent 87f5bf83d1
commit e7609f02b9
44 changed files with 605 additions and 614 deletions

View File

@ -18,11 +18,11 @@ from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from tmtccmd.util import ObjectIdU32
class SetIds:
class SetId:
HK = 3
class OpCodes:
class OpCode:
ON = ["0", "on"]
NORMAL = ["1", "normal"]
OFF = ["2", "off"]
@ -40,7 +40,7 @@ class Info:
DEBUG_OFF = "Switch debug output off"
class CommandIds:
class CommandId:
START_CONVERSIONS = 2
READ_CONVERSIONS = 3
ENABLE_DEBUG_OUTPUT = 4
@ -50,12 +50,12 @@ class CommandIds:
@tmtc_definitions_provider
def add_rad_sens_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(info=Info.ON, keys=OpCodes.ON)
oce.add(info=Info.OFF, keys=OpCodes.OFF)
oce.add(info=Info.NORMAL, keys=OpCodes.NORMAL)
oce.add(info=Info.REQ_OS_HK, keys=OpCodes.REQ_HK_ONCE)
oce.add(info=Info.DEBUG_ON, keys=OpCodes.DEBUG_ON)
oce.add(info=Info.DEBUG_OFF, keys=OpCodes.DEBUG_OFF)
oce.add(info=Info.ON, keys=OpCode.ON)
oce.add(info=Info.OFF, keys=OpCode.OFF)
oce.add(info=Info.NORMAL, keys=OpCode.NORMAL)
oce.add(info=Info.REQ_OS_HK, keys=OpCode.REQ_HK_ONCE)
oce.add(info=Info.DEBUG_ON, keys=OpCode.DEBUG_ON)
oce.add(info=Info.DEBUG_OFF, keys=OpCode.DEBUG_OFF)
defs.add_service(
name=CustomServiceList.RAD_SENSOR.value,
info="Radiation Sensor",
@ -68,26 +68,24 @@ def pack_rad_sensor_test_into(
):
q.add_log_cmd(f"Commanding Radiation sensor handler {object_id}")
if op_code in OpCodes.ON:
if op_code in OpCode.ON:
rad_sensor_mode_cmd(object_id, Modes.ON, Info.ON, q)
if op_code in OpCodes.NORMAL:
if op_code in OpCode.NORMAL:
rad_sensor_mode_cmd(object_id, Modes.NORMAL, Info.NORMAL, q)
if op_code in OpCodes.OFF:
if op_code in OpCode.OFF:
rad_sensor_mode_cmd(object_id, Modes.OFF, Info.OFF, q)
if op_code in OpCodes.REQ_HK_ONCE:
if op_code in OpCode.REQ_HK_ONCE:
q.add_log_cmd(f"Rad sensor: {Info.REQ_OS_HK}")
q.add_pus_tc(
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetIds.HK))
generate_one_hk_command(sid=make_sid(object_id.as_bytes, set_id=SetId.HK))
)
if op_code in OpCodes.DEBUG_ON:
if op_code in OpCode.DEBUG_ON:
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_ON}")
command = object_id.as_bytes + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT)
command = object_id.as_bytes + struct.pack("!I", CommandId.ENABLE_DEBUG_OUTPUT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
if op_code in OpCodes.DEBUG_OFF:
if op_code in OpCode.DEBUG_OFF:
q.add_log_cmd(f"Rad sensor: {Info.DEBUG_OFF}")
command = object_id.as_bytes + struct.pack(
"!I", CommandIds.DISABLE_DEBUG_OUTPUT
)
command = object_id.as_bytes + struct.pack("!I", CommandId.DISABLE_DEBUG_OUTPUT)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))