fixed merge conflicts
This commit is contained in:
67
pus_tc/ploc.py
Normal file
67
pus_tc/ploc.py
Normal file
@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file ploc.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
"""
|
||||
import struct
|
||||
|
||||
from tmtccmd.core.definitions import QueueCommands
|
||||
|
||||
from tmtccmd.pus_tc.packer import TcQueueT
|
||||
from tmtccmd.ecss.tc import PusTelecommand
|
||||
|
||||
|
||||
class PlocTestProcedure:
|
||||
"""
|
||||
@brief Use this class to define the tests to perform for the PLOC.
|
||||
@details Setting all to True will run all tests.
|
||||
Setting all to False will only run the tests set to True.
|
||||
"""
|
||||
all = False
|
||||
test_tc_mem_write = False
|
||||
test_tc_mem_read = True
|
||||
|
||||
|
||||
class PlocActionIds:
|
||||
tc_mem_write = bytearray([0x0, 0x0, 0x0, 0x1])
|
||||
tc_mem_read = bytearray([0x0, 0x0, 0x0, 0x2])
|
||||
|
||||
|
||||
class PlocReplyIds:
|
||||
tm_mem_read_report = 6
|
||||
|
||||
|
||||
def pack_ploc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT,
|
||||
"Testing PLOC Handler with object id: 0x" + object_id.hex())
|
||||
)
|
||||
|
||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test"))
|
||||
memory_address = int(input("Type memory address: 0x"), 16)
|
||||
memory_data = int(input("Type memory data: 0x"), 16)
|
||||
command = generateWriteMemCommand(object_id, struct.pack('!I', memory_address), memory_data)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test"))
|
||||
memory_address = int(input("Type memory address: 0x"), 16)
|
||||
command = object_id + PlocActionIds.tc_mem_read + struct.pack('!I', memory_address)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
||||
|
||||
|
||||
def generateWriteMemCommand(object_id: bytearray, memory_address: bytearray, memory_data: int) -> bytearray:
|
||||
""" This function generates the command to write to a memory address within the PLOC
|
||||
@param object_id The object id of the PlocHandler
|
||||
@param memory_address The PLOC memory address where to write to.
|
||||
@param memory_data The data to write to the memory address specified by the bytearray memory_address.
|
||||
"""
|
||||
command = object_id + PlocActionIds.tc_mem_write + memory_address + struct.pack('!I', memory_data)
|
||||
return command
|
@ -21,6 +21,7 @@ from pus_tc.pdu1 import pack_pdu1_test_into
|
||||
from pus_tc.acu import pack_acu_test_into
|
||||
from pus_tc.imtq import pack_imtq_test_into
|
||||
from pus_tc.tmp1075 import pack_tmp1075_test_into
|
||||
from pus_tc.ploc import pack_ploc_test_into
|
||||
from pus_tc.heater import pack_heater_test_into
|
||||
from config.definitions import CustomServiceList
|
||||
from config.object_ids import ObjIdIds
|
||||
@ -60,6 +61,9 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
|
||||
if service == CustomServiceList.IMTQ.value:
|
||||
object_id = get_object_id(ObjIdIds.IMTQ_HANDLER_ID)
|
||||
return pack_imtq_test_into(object_id, service_queue)
|
||||
if service == CustomServiceList.PLOC.value:
|
||||
object_id = get_object_id(ObjIdIds.PLOC_ID)
|
||||
return pack_ploc_test_into(object_id, service_queue)
|
||||
LOGGER.warning("Invalid Service !")
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file tmtcc_tc_tmp1075.py
|
||||
@file tmp1075.py
|
||||
@brief TMP1075 tests
|
||||
@author J. Meier
|
||||
@date 06.01.2021
|
||||
|
Reference in New Issue
Block a user