supervisor event buffer request

This commit is contained in:
Jakob Meier
2022-04-14 07:53:18 +02:00
parent f2d3f8c68c
commit a3d9e83dc6
4 changed files with 79 additions and 12 deletions

View File

@ -34,6 +34,11 @@ update_file_dict = {
"2": ["/mnt/sd0/ploc/supervisor/update.bin", "/mnt/sd0/ploc/supervisor/update.bin"],
}
event_buffer_path_dict = {
MANUAL_INPUT: ["manual input", ""],
"2": ["/mnt/sd0/ploc/supervisor", "/mnt/sd0/ploc/supervisor"],
}
class SupvActionIds:
HK_REPORT = 1
@ -73,7 +78,7 @@ class SupvActionIds:
READ_GPIO = 35
RESTART_SUPERVISOR = 36
FACTORY_RESET_CLEAR_ALL = 37
REQUEST_LOGGING_DATA = 38
LOGGING_REQUEST_COUNTERS = 38
UPDATE_IMAGE_DATA = 39
FACTORY_RESET_CLEAR_MIRROR = 40
FACTORY_RESET_CLEAR_CIRCULAR = 41
@ -86,6 +91,10 @@ class SupvActionIds:
DISABLE_AUTO_TM = 51
ENABLE_ADC_MONITOR_TASK = 52
DISABLE_ADC_MONITOR_TASK = 53
LOGGING_REQUEST_EVENT_BUFFERS = 54
LOGGING_CLEAR_COUNTERS = 55
LOGGING_SET_TOPIC = 56
class SupvHkIds:
@ -437,6 +446,28 @@ def pack_ploc_supv_commands(
)
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "51":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request event buffers"))
command = pack_logging_buffer_request(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "52":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging clear counters"))
command = object_id + struct.pack(
"!I", SupvActionIds.LOGGING_CLEAR_COUNTERS
)
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "53":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging set topic"))
command = pack_logging_set_topic(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "54":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Logging request counters"))
command = object_id + struct.pack('!I', SupvActionIds.LOGGING_REQUEST_COUNTERS)
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
@ -705,6 +736,15 @@ def pack_set_shutdown_timeout_command(object_id: bytearray) -> bytearray:
return command
def pack_logging_buffer_request(object_id: bytearray) -> bytearray:
command = bytearray()
command += object_id
command += struct.pack('!I', SupvActionIds.LOGGING_REQUEST_EVENT_BUFFERS)
path = get_event_buffer_path()
command += bytearray(path, 'utf-8')
return command
def get_debug_verbosity() -> int:
tries = 0
while tries < 3:
@ -752,12 +792,30 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
return command
def pack_logging_set_topic(objetc_id: bytearray) -> bytearray:
command = objetc_id + struct.pack('!I', SupvActionIds.LOGGING_SET_TOPIC)
tpc = int(input("Specify logging topic: "))
command += struct.pack('!B', tpc)
return command
def get_update_file() -> str:
LOGGER.info("Specify update file ")
input_helper = InputHelper(update_file_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc MPSoC: Specify absolute name of update file: ")
file = input("Ploc Supervisor: Specify absolute name of update file: ")
else:
file = update_file_dict[key][1]
return file
def get_event_buffer_path() -> str:
LOGGER.info("Specify path where to store event buffer file ")
input_helper = InputHelper(event_buffer_path_dict)
key = input_helper.get_key()
if key == MANUAL_INPUT:
file = input("Ploc Supervisor: Specify path: ")
else:
file = event_buffer_path_dict[key][1]
return file