tmp1075 tests
This commit is contained in:
parent
eb9deae5ab
commit
6b840eff43
@ -32,6 +32,7 @@ class ServiceList(enum.Enum):
|
||||
PDU1 = auto()
|
||||
PDU2 = auto()
|
||||
ACU = auto()
|
||||
TMP1075 = auto()
|
||||
|
||||
|
||||
class SerialConfig(enum.Enum):
|
||||
|
@ -154,6 +154,8 @@ def add_globals_post_args_parsing(args: argparse.Namespace):
|
||||
service = ServiceList.PDU2
|
||||
elif service == "acu":
|
||||
service = ServiceList.ACU
|
||||
elif service == "tmp1075":
|
||||
service = ServiceList.TMP1075
|
||||
else:
|
||||
logger.warning("Service not known! Setting standard service 17")
|
||||
service = ServiceList.SERVICE_17
|
||||
|
@ -16,6 +16,8 @@ class ObjectIds(enum.Enum):
|
||||
PDU1_HANDLER_ID = auto()
|
||||
PDU2_HANDLER_ID = auto()
|
||||
ACU_HANDLER_ID = auto()
|
||||
TMP1075_1_HANDLER_ID = auto()
|
||||
TMP1075_2_HANDLER_ID = auto()
|
||||
|
||||
|
||||
def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
|
||||
@ -27,5 +29,7 @@ def set_object_ids(object_id_dict: Dict[ObjectIds, bytearray]):
|
||||
o_ids.PDU1_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x2]),
|
||||
o_ids.PDU2_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x3]),
|
||||
o_ids.ACU_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x4]),
|
||||
o_ids.TMP1075_1_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x5]),
|
||||
o_ids.TMP1075_2_HANDLER_ID: bytearray([0x44, 0x00, 0x00, 0x6]),
|
||||
}
|
||||
)
|
||||
|
@ -10,6 +10,8 @@ from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from gomspace.gomspace_common import *
|
||||
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
|
||||
from config.tmtcc_object_ids import ObjectIds
|
||||
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
||||
|
||||
|
||||
class ACUTestProcedure:
|
||||
@ -54,7 +56,8 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing ACU"))
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Enabling ACU connected to X1 slot (channel 0)"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_0.parameter_address,
|
||||
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
||||
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address,
|
||||
P60DockConfigTable.out_en_0.parameter_size, Channel.on)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
@ -113,7 +116,7 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
tc_queue.appendleft(("print", "P60 Dock: Turning off ACU"))
|
||||
command = pack_set_param_command(g.P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_0.parameter_address,
|
||||
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address,
|
||||
P60DockConfigTable.out_en_0.parameter_size, Channel.off)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
@ -19,6 +19,7 @@ from pus_tc.tmtcc_tc_pdu1 import pack_pdu1_test_into
|
||||
from pus_tc.tmtcc_tc_acu import pack_acu_test_into
|
||||
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
||||
from config.tmtcc_object_ids import ObjectIds
|
||||
from pus_tc.tmtcc_tc_tmp1075 import pack_tmp1075_test_into
|
||||
|
||||
LOGGER = get_logger()
|
||||
|
||||
@ -40,6 +41,9 @@ def pack_service_queue_user(service: Union[int, str], op_code: int, service_queu
|
||||
if service == ServiceList.ACU:
|
||||
object_id = get_object_id(ObjectIds.ACU_HANDLER_ID)
|
||||
return pack_acu_test_into(object_id, service_queue)
|
||||
if service == ServiceList.TMP1075:
|
||||
object_id = get_object_id(ObjectIds.TMP1075_1_HANDLER_ID)
|
||||
return pack_tmp1075_test_into(object_id, service_queue)
|
||||
LOGGER.warning("Invalid Service !")
|
||||
|
||||
|
||||
|
52
pus_tc/tmtcc_tc_service200_mode.py
Normal file
52
pus_tc/tmtcc_tc_service200_mode.py
Normal file
@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_service200_mode.py
|
||||
@brief PUS Service 200: PUS custom service 200: Mode commanding
|
||||
@author R. Mueller
|
||||
@date 02.05.2020
|
||||
"""
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
||||
from config.tmtcc_object_ids import ObjectIds
|
||||
import struct
|
||||
|
||||
TEST_DEVICE_ID = get_object_id(ObjectIds.TEST_DEVICE)
|
||||
|
||||
|
||||
def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing Service 200"))
|
||||
# Object ID: Dummy Device
|
||||
object_id = TEST_DEVICE_ID
|
||||
# Set On Mode
|
||||
tc_queue.appendleft(("print", "Testing Service 200: Set Mode On"))
|
||||
mode_data = pack_mode_data(object_id, 1, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=2000, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
# Set Normal mode
|
||||
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Normal"))
|
||||
mode_data = pack_mode_data(object_id, 2, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=2010, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
# Set Raw Mode
|
||||
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Raw"))
|
||||
mode_data = pack_mode_data(object_id, 3, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=2020, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
# Set Off Mode
|
||||
tc_queue.appendleft(("print", "Testing Service 200: Set Mode Off"))
|
||||
mode_data = pack_mode_data(object_id, 0, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=2030, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(("export", "log/tmtc_log_service200.txt"))
|
||||
return tc_queue
|
||||
|
||||
|
||||
# Mode 0: Off, Mode 1: Mode On, Mode 2: Mode Normal, Mode 3: Mode Raw
|
||||
def pack_mode_data(object_id: bytearray, mode_: int, submode_: int) -> bytearray:
|
||||
# Normal mode
|
||||
mode = struct.pack(">I", mode_)
|
||||
# Submode default
|
||||
submode = struct.pack('B', submode_)
|
||||
mode_data = object_id + mode + submode
|
||||
return mode_data
|
59
pus_tc/tmtcc_tc_tmp1075.py
Normal file
59
pus_tc/tmtcc_tc_tmp1075.py
Normal file
@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_tmp1075.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
"""
|
||||
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
||||
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
||||
from pus_tc.tmtcc_tc_service200_mode import pack_mode_data
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
all = True
|
||||
start_adc_conversion = False
|
||||
get_temp = False
|
||||
set_mode_normal = False # 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 Tmp1075ActionIds:
|
||||
get_temp = bytearray([0x0, 0x0, 0x0, 0x01])
|
||||
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
|
||||
|
||||
|
||||
def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(("print", "Testing Tmp1075 Temperature Sensor Handler"))
|
||||
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
|
||||
tc_queue.appendleft(("print", "TMP1075: Starting new temperature conversion"))
|
||||
command = object_id + Tmp1075ActionIds.start_adc_conversion
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.get_temp:
|
||||
tc_queue.appendleft(("print", "TMP1075: Read temperature"))
|
||||
command = object_id + Tmp1075ActionIds.get_temp
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_normal:
|
||||
tc_queue.appendleft(("print", "TMP1075:: Set Mode Normal"))
|
||||
mode_data = pack_mode_data(object_id, 2, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=220, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if Tmp1075TestProcedure.set_mode_on:
|
||||
tc_queue.appendleft(("print", "TMP1075: Set Mode On"))
|
||||
mode_data = pack_mode_data(object_id, 1, 0)
|
||||
command = PusTelecommand(service=200, subservice=1, ssc=221, app_data=mode_data)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
@ -1 +1 @@
|
||||
Subproject commit ed4b25ab449cae31ac720f52ad43d13b9d7ce4c5
|
||||
Subproject commit bdb8d5533a40c8396dedafc1844fe3645bcf8de3
|
Loading…
Reference in New Issue
Block a user