update availabe and watchdogs enable command

This commit is contained in:
Jakob.Meier 2021-07-26 16:29:54 +02:00
parent 6352a6f272
commit 75ae2c786b
2 changed files with 51 additions and 0 deletions

View File

@ -96,6 +96,8 @@ class EiveHookObject(TmTcHookBase):
"11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
"12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}),
"13": ("PLOC Supervisor: Request boot status report", {OpCodeDictKeys.TIMEOUT: 2.0}),
"14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}),
"15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)

View File

@ -26,6 +26,8 @@ class SupvActionIds:
SET_TIME_REF = 9
DISABLE_HK = 10
GET_BOOT_STATUS_REPORT = 11
UPDATE_AVAILABLE = 12
WATCHDOGS_ENABLE = 13
class SupvHkIds:
@ -100,6 +102,16 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = object_id + struct.pack('!I', SupvActionIds.GET_BOOT_STATUS_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update available"))
command = pack_update_available_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "15":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Watchdogs Enable"))
command = pack_watchdogs_enable_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
@ -119,3 +131,40 @@ def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int,
command = command + struct.pack('!B', bp1)
command = command + struct.pack('!B', bp2)
return command
def pack_update_available_cmd(object_id: bytearray) -> bytearray:
"""
@brief This function packs the udpate availabe command.
@param object_id The object id of the PLOC supervisor handler.
"""
image_select = 1
image_partition = 0
image_size = 222
image_crc = 0x0
number_of_packets = 150
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.UPDATE_AVAILABLE)
command = command + struct.pack('!B', image_select)
command = command + struct.pack('!B', image_partition)
command = command + struct.pack('!I', image_size)
command = command + struct.pack('!I', image_crc)
command = command + struct.pack('!I', number_of_packets)
return command
def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray:
"""
@brief This function packs the command to enable or disable watchdogs on the PLOC.
@param object_id The object id of the PLOC supervisor handler.
@note Enable = 1, Disable = 0
"""
watchdog_ps = 1
watchdog_pl = 1
watchdog_int = 0
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_ENABLE)
command = command + struct.pack('!B', watchdog_ps)
command = command + struct.pack('!B', watchdog_pl)
command = command + struct.pack('!B', watchdog_int)
return command