new subsystem.csv
This commit is contained in:
@ -25,6 +25,7 @@ DATE_STRING_FULL = DATE_TODAY.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
PRINT_EVENTS = False
|
||||
PRINT_SUBSYSTEM_TABLE = False
|
||||
EXPORT_SUBSYSTEM_TABLE = True
|
||||
|
||||
GENERATE_CPP = True
|
||||
GENERATE_CPP_H = True
|
||||
@ -53,7 +54,9 @@ class BspConfig:
|
||||
|
||||
# Store this file in the root of the generators folder
|
||||
self.csv_filename = Path(f"{ROOT_DIR}/{self.bsp_dir_name}_events.csv")
|
||||
self.subsystems_csv_filename = Path(f"{ROOT_DIR}/{self.bsp_dir_name}_subsystems.csv")
|
||||
self.csv_copy_dest = Path(f"{OBSW_ROOT_DIR}/tmtc/eive_tmtc/config/events.csv")
|
||||
self.subsystem_csv_copy_dest = Path(f"{OBSW_ROOT_DIR}/tmtc/eive_tmtc/config/subsystems.csv")
|
||||
|
||||
if (
|
||||
self.bsp_select == BspType.BSP_Q7S
|
||||
@ -100,7 +103,7 @@ def parse_events(
|
||||
_LOGGER.info(f"EventParser: Parsing events for {bsp_type.name}")
|
||||
# Small delay for clean printout
|
||||
time.sleep(0.01)
|
||||
event_list = generate_event_list(bsp_cfg)
|
||||
event_list = generate_event_list(bsp_cfg, copy_csv_to_eive_tmtc)
|
||||
if PRINT_EVENTS:
|
||||
PrettyPrinter.pprint(event_list)
|
||||
# Delay for clean printout
|
||||
@ -136,12 +139,26 @@ def parse_events(
|
||||
_LOGGER.info(f"Parsing done for {bsp_type.name}")
|
||||
|
||||
|
||||
def generate_event_list(cfg: BspConfig) -> EventDictT:
|
||||
def generate_event_list(cfg: BspConfig, copy_csv_to_eive_tmtc: bool) -> EventDictT:
|
||||
subsystem_parser = SubsystemDefinitionParser(cfg.subsystem_defs_as_paths())
|
||||
subsystem_table = subsystem_parser.parse_files()
|
||||
_LOGGER.info(f"Found {len(subsystem_table)} subsystem definitions.")
|
||||
if PRINT_SUBSYSTEM_TABLE:
|
||||
PrettyPrinter.pprint(subsystem_table)
|
||||
if EXPORT_SUBSYSTEM_TABLE:
|
||||
PrettyPrinter.pprint(subsystem_table)
|
||||
with open(cfg.subsystems_csv_filename, "w") as file:
|
||||
for name_str, table_entry in subsystem_table.items():
|
||||
subsystem_id = int(table_entry[0])
|
||||
file.write(f"{subsystem_id}{FILE_SEPARATOR}{name_str}\n")
|
||||
if copy_csv_to_eive_tmtc:
|
||||
_LOGGER.info(f"Copying CSV file to {cfg.cpp_copy_dest}")
|
||||
copy_file(
|
||||
filename=cfg.subsystems_csv_filename,
|
||||
destination=cfg.subsystem_csv_copy_dest,
|
||||
delete_existing_file=True,
|
||||
)
|
||||
|
||||
event_header_parser = FileListParser(cfg.header_defs_as_paths())
|
||||
event_headers = event_header_parser.parse_header_files(
|
||||
True, "Parsing event header file list:\n", True
|
||||
|
Reference in New Issue
Block a user