update for tmp1075 code
This commit is contained in:
parent
b474841d69
commit
fc5e3c88ff
@ -13,6 +13,7 @@ list yields a list of all related PRs for each release.
|
||||
## Fixed
|
||||
|
||||
- TMP1075 comands: Implement proper prompt for device select.
|
||||
- TMP1075 commands: Add OFF, ON, NORMAL, and HK command
|
||||
|
||||
# [v2.10.0] 2023-02-03
|
||||
|
||||
|
@ -38,8 +38,6 @@ class CustomServiceList(str, enum.Enum):
|
||||
ACS = "acs"
|
||||
COM_SS = "com"
|
||||
BPX_BATTERY = "bpx"
|
||||
TMP1075_1 = "tmp1075_1"
|
||||
TMP1075_2 = "tmp1075_2"
|
||||
HEATER = "heater"
|
||||
IMTQ = "imtq"
|
||||
PLOC_SUPV = "ploc_supv"
|
||||
|
@ -23,14 +23,6 @@ def get_eive_service_op_code_dict() -> TmtcDefinitionWrapper:
|
||||
return def_wrapper
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add("0", "TMP1075 Tests")
|
||||
defs.add_service(CustomServiceList.TMP1075_1.value, "TMP1075 1", oce)
|
||||
defs.add_service(CustomServiceList.TMP1075_2.value, "TMP1075 2", oce)
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_pdec_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
|
@ -7,27 +7,31 @@
|
||||
"""
|
||||
import enum
|
||||
|
||||
from eive_tmtc.config.definitions import CustomServiceList
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.config.tmtc import (
|
||||
tmtc_definitions_provider,
|
||||
TmtcDefinitionWrapper,
|
||||
OpCodeEntry,
|
||||
)
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_mode import Mode, pack_mode_data
|
||||
from tmtccmd.pus.s8_fsfw_funccmd import make_action_id
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import create_request_one_hk_command, make_sid
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
class Tmp1075TestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the Tmp1075.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
class OpCode:
|
||||
OFF = "off"
|
||||
ON = "on"
|
||||
NML = "nml"
|
||||
HK = "hk"
|
||||
|
||||
all = False
|
||||
start_adc_conversion = False
|
||||
get_temp = False
|
||||
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
|
||||
|
||||
class Info:
|
||||
OFF = "Off"
|
||||
ON = "On"
|
||||
NML = "Normal"
|
||||
HK = "HK"
|
||||
|
||||
|
||||
class Tmp1075ActionId(enum.IntEnum):
|
||||
@ -35,6 +39,10 @@ class Tmp1075ActionId(enum.IntEnum):
|
||||
START_ADC_CONV = 2
|
||||
|
||||
|
||||
class SetId:
|
||||
TMEPERATURE = 1
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(
|
||||
object_id: ObjectIdU32, op_code: str, q: DefaultPusQueueHelper
|
||||
):
|
||||
@ -42,23 +50,29 @@ def pack_tmp1075_test_into(
|
||||
f"Testing Tmp1075 Temperature Sensor Handler with object id: {object_id.as_hex_string}"
|
||||
)
|
||||
obyt = object_id.as_bytes
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
|
||||
q.add_log_cmd("TMP1075: Starting new temperature conversion")
|
||||
command = obyt + make_action_id(Tmp1075ActionId.GET_TEMP)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
|
||||
q.add_log_cmd("TMP1075: Read temperature")
|
||||
command = obyt + make_action_id(Tmp1075ActionId.START_ADC_CONV)
|
||||
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=command))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_normal:
|
||||
if op_code == OpCode.OFF:
|
||||
q.add_log_cmd("TMP1075: Set Normal Off")
|
||||
mode_data = pack_mode_data(obyt, Mode.OFF, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
if op_code == OpCode.NML:
|
||||
q.add_log_cmd("TMP1075: Set Mode Normal")
|
||||
mode_data = pack_mode_data(obyt, Mode.NORMAL, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_on:
|
||||
if op_code == OpCode.ON:
|
||||
q.add_log_cmd("TMP1075: Set Mode On")
|
||||
mode_data = pack_mode_data(obyt, Mode.ON, 0)
|
||||
q.add_pus_tc(PusTelecommand(service=200, subservice=1, app_data=mode_data))
|
||||
|
||||
if op_code == OpCode.HK:
|
||||
q.add_log_cmd("TMP1075: Request One-Shot HK")
|
||||
q.add_pus_tc(create_request_one_hk_command(make_sid(obyt, SetId.TMEPERATURE)))
|
||||
return q
|
||||
|
||||
|
||||
@tmtc_definitions_provider
|
||||
def add_tmp_sens_cmds(defs: TmtcDefinitionWrapper):
|
||||
oce = OpCodeEntry()
|
||||
oce.add(OpCode.OFF, Info.OFF)
|
||||
oce.add(OpCode.ON, Info.ON)
|
||||
oce.add(OpCode.NML, Info.NML)
|
||||
oce.add(OpCode.HK, Info.HK)
|
||||
defs.add_service(CustomServiceList.TMP1075.value, "TMP1075 Temperature Sensor", oce)
|
||||
|
Loading…
Reference in New Issue
Block a user