Skip to content
Snippets Groups Projects
Commit 79745237 authored by Robin.Mueller's avatar Robin.Mueller
Browse files

some srv20 stuff

parent fe9099de
Branches
No related tags found
No related merge requests found
from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, Deque
from tc.obsw_tc_service8 import make_action_id from tc.obsw_tc_service8 import make_action_id
from tc.obsw_tc_service20 import pack_boolean_parameter_setting
from tmtc_core.utility.obsw_logger import get_logger from tmtc_core.utility.obsw_logger import get_logger
from config.obsw_config import SW_IMAGE_HANDLER_ID from config.obsw_config import SW_IMAGE_HANDLER_ID
...@@ -22,6 +23,10 @@ def generate_copy_obsw_sdc_to_flash_packet(ssc: int, slot: int, ...@@ -22,6 +23,10 @@ def generate_copy_obsw_sdc_to_flash_packet(ssc: int, slot: int,
app_data.append(slot) app_data.append(slot)
return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=app_data) return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=app_data)
def generate_param_packet_hamming_from_sdcard(enable: bool, ssc: int,
object_id: bytearray = SW_IMAGE_HANDLER_ID):
return pack_boolean_parameter_setting(object_id=object_id, domain_id=0, unique_id=0,
parameter=enable, ssc=ssc)
def generate_img_handler_packet(service_queue: Deque, op_code: int): def generate_img_handler_packet(service_queue: Deque, op_code: int):
# Action ID 4 (Copy SDC to Flash, Software Update Image) # Action ID 4 (Copy SDC to Flash, Software Update Image)
...@@ -29,9 +34,17 @@ def generate_img_handler_packet(service_queue: Deque, op_code: int): ...@@ -29,9 +34,17 @@ def generate_img_handler_packet(service_queue: Deque, op_code: int):
service_queue.appendleft(("print", "Generating command to copy SDC OBSW to flash.")) service_queue.appendleft(("print", "Generating command to copy SDC OBSW to flash."))
command = generate_copy_obsw_sdc_to_flash_packet(ssc=0, slot=2) command = generate_copy_obsw_sdc_to_flash_packet(ssc=0, slot=2)
service_queue.appendleft(command.pack_command_tuple()) service_queue.appendleft(command.pack_command_tuple())
# Action ID 11 (Copy bootloader from SDC to flash # Action ID 11 (Copy bootloader from SDC to flash
elif op_code == "A11S": elif op_code == "A11S":
service_queue.appendleft(("print", "Generating command to copy SDC bootloader to flash.")) service_queue.appendleft(("print", "Generating command to copy SDC bootloader to flash."))
command = generate_copy_bl_sdc_to_flash_packet(0) command = generate_copy_bl_sdc_to_flash_packet(0)
service_queue.appendleft(command.pack_command_tuple()) service_queue.appendleft(command.pack_command_tuple())
elif op_code == "P0":
service_queue.appendleft(("print", "Configrung hamming code to be taken from SD card"))
command = generate_param_packet_hamming_from_sdcard(enable=True, ssc=0)
service_queue.appendleft(command.pack_command_tuple())
elif op_code == "P1":
service_queue.appendleft(("print", "Configrung hamming code to be taken from FRAM"))
command = generate_param_packet_hamming_from_sdcard(enable=False, ssc=0)
service_queue.appendleft(command.pack_command_tuple())
...@@ -9,9 +9,46 @@ import struct ...@@ -9,9 +9,46 @@ import struct
from typing import Deque from typing import Deque
import config.obsw_config as g import config.obsw_config as g
from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand, TcQueueT
from tmtc_core.utility.obsw_logger import get_logger
from tc.obsw_tc_service200 import pack_mode_data from tc.obsw_tc_service200 import pack_mode_data
LOGGER = get_logger()
def pack_boolean_parameter_setting(object_id: bytearray, domain_id: int,
unique_id: int, parameter: bool, ssc: int):
"""
Generic function to pack a telecommand to tweak a boolean parameter
@param object_id:
@param domain_id:
@param unique_id:
@param parameter:
@param ssc:
@return:
"""
parameter_id = bytearray(4)
parameter_id[0] = domain_id
if unique_id > 255:
LOGGER.warning("Invalid unique ID, should be smaller than 255!")
return
parameter_id[1] = unique_id
parameter_id[2] = 0
parameter_id[3] = 0
data_to_pack = bytearray(object_id)
data_to_pack.extend(parameter_id)
# PTC and PFC for uint8_t according to CCSDS
ptc = 3
pfc = 4
rows = 0
columns = 0
data_to_pack.append(ptc)
data_to_pack.append(pfc)
data_to_pack.append(rows)
data_to_pack.append(columns)
data_to_pack.append(parameter)
return PusTelecommand(service=20, subservice=128, ssc=ssc, app_data=data_to_pack)
def pack_service20_test_into(tc_queue: Deque, called_externally: bool = False) -> Deque: def pack_service20_test_into(tc_queue: Deque, called_externally: bool = False) -> Deque:
# parameter IDs # parameter IDs
...@@ -75,6 +112,11 @@ def pack_service20_test_into(tc_queue: Deque, called_externally: bool = False) - ...@@ -75,6 +112,11 @@ def pack_service20_test_into(tc_queue: Deque, called_externally: bool = False) -
return tc_queue return tc_queue
def pack_service23_commands_into(tc_queue: TcQueueT, op_code: int):
if op_code == 0:
pack_service20_test_into(tc_queue=tc_queue)
""" """
#test checking Load for int32_t #test checking Load for int32_t
tc_queue.appendleft(("print", "Testing Service 20: Load int32_t")) tc_queue.appendleft(("print", "Testing Service 20: Load int32_t"))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment