From f0b8263d44700c3db222742949704836eac6a840 Mon Sep 17 00:00:00 2001 From: chutaro <35984595+chutaro@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:33:39 +0900 Subject: [PATCH 1/3] add path to db settings --- GenerateC2ACode.py | 2 +- README.md | 2 +- my_mod/cmd_def.py | 6 +++--- my_mod/load_db.py | 6 ++---- my_mod/tlm_buffer.py | 2 +- my_mod/tlm_def.py | 4 ++-- settings.json | 7 ++++--- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/GenerateC2ACode.py b/GenerateC2ACode.py index 00f2722..8ec163d 100644 --- a/GenerateC2ACode.py +++ b/GenerateC2ACode.py @@ -28,7 +28,7 @@ def main(): with open(SETTING_FILE_PATH, mode="r") as fh: settings = json.load(fh) - # print(settings["c2a_root_dir"]); + # print(settings["path_to_src"]); cmd_db = my_mod.load_db.LoadCmdDb(settings) tlm_db = my_mod.load_db.LoadTlmDb(settings) diff --git a/README.md b/README.md index 004c6bc..cc62ab0 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ $ python GenerateC2ACode.py { # C2A ROOTへ相対パス. # C2A ROOTとは, `src_core`, `src_user` のあるディレクトリ - "c2a_root_dir" : "../../c2a/src/", + "path_to_src" : "../../c2a/src/", # TlmCmdDBのファイル名の接頭辞 "db_prefix" : "SAMPLE_MOBC", # TLM ID の定義域 diff --git a/my_mod/cmd_def.py b/my_mod/cmd_def.py index 961a668..50a98ed 100644 --- a/my_mod/cmd_def.py +++ b/my_mod/cmd_def.py @@ -9,7 +9,7 @@ def GenerateCmdDef(settings, sgc_db): - output_file_path = settings["c2a_root_dir"] + r"src_user/TlmCmd/" + output_file_path = settings["path_to_src"] + r"src_user/TlmCmd/" output_file_name_base = "command_definitions" DATA_SART_ROW = 3 @@ -97,7 +97,7 @@ def GenerateCmdDef(settings, sgc_db): def GenerateBctDef(settings, bct_db): - output_file_path = settings["c2a_root_dir"] + r"src_user/TlmCmd/" + output_file_path = settings["path_to_src"] + r"src_user/TlmCmd/" output_file_name = "block_command_definitions.h" DATA_SART_ROW = 2 @@ -164,7 +164,7 @@ def GenerateOtherObcCmdDef(settings, other_obc_dbs): body_h += " " + cmd_code + " = " + cmd_id + ",\n" # print(body_h) output_file_path = ( - settings["c2a_root_dir"] + settings["path_to_src"] + r"src_user/Drivers/" + settings["other_obc_data"][i]["driver_path"] + name_lower diff --git a/my_mod/load_db.py b/my_mod/load_db.py index 39a74af..66c2e85 100644 --- a/my_mod/load_db.py +++ b/my_mod/load_db.py @@ -12,7 +12,7 @@ def LoadCmdDb(settings): - cmd_db_path = settings["c2a_root_dir"] + r"src_user/Settings/TlmCmd/DataBase/CMD_DB/" + cmd_db_path = settings["db_path"] + r"CMD_DB/" sgc_db, bct_db = LoadCmdCSV_( cmd_db_path, settings["db_prefix"], settings["input_file_encoding"] @@ -44,9 +44,7 @@ def LoadCmdCSV_(cmd_db_path, db_prefix, encoding): def LoadTlmDb(settings): - tlm_db_path = ( - settings["c2a_root_dir"] + r"src_user/Settings/TlmCmd/DataBase/TLM_DB/calced_data/" - ) + tlm_db_path = settings["db_path"] + r"TLM_DB/calced_data/" tlm_db = LoadTlmCSV_( tlm_db_path, diff --git a/my_mod/tlm_buffer.py b/my_mod/tlm_buffer.py index 0dad7b2..4eb06b7 100644 --- a/my_mod/tlm_buffer.py +++ b/my_mod/tlm_buffer.py @@ -337,7 +337,7 @@ def GenerateTlmBuffer(settings, other_obc_dbs): body_c += "\n" output_file_path = ( - settings["c2a_root_dir"] + settings["path_to_src"] + r"src_user/Drivers/" + settings["other_obc_data"][i]["driver_path"] ) diff --git a/my_mod/tlm_def.py b/my_mod/tlm_def.py index abaac70..e8ba399 100644 --- a/my_mod/tlm_def.py +++ b/my_mod/tlm_def.py @@ -7,7 +7,7 @@ def GenerateTlmDef(settings, tlm_db): - output_file_path = settings["c2a_root_dir"] + r"src_user/TlmCmd/" + output_file_path = settings["path_to_src"] + r"src_user/TlmCmd/" output_file_name_base = "telemetry_definitions" DATA_START_ROW = 8 @@ -137,7 +137,7 @@ def GenerateOtherObcTlmDef(settings, other_obc_dbs): + ",\n" ) output_file_path = ( - settings["c2a_root_dir"] + settings["path_to_src"] + r"src_user/Drivers/" + settings["other_obc_data"][i]["driver_path"] + obc_name.lower() diff --git a/settings.json b/settings.json index bd8454d..6ef5e13 100644 --- a/settings.json +++ b/settings.json @@ -1,5 +1,6 @@ { - "c2a_root_dir" : "../../c2a/src/", + "path_to_src" : "../../c2a/src/", + "path_to_db" : "../../c2a/database/", "db_prefix" : "SAMPLE_MOBC", "tlm_id_range" : ["0x00", "0x100"], "is_cmd_prefixed_in_db" : 0, @@ -14,7 +15,7 @@ "tlm_id_range" : ["0x90", "0xc0"], "is_cmd_prefixed_in_db" : 0, "input_file_encoding" : "utf-8", - "db_path" : "C:/c2a_sample_aobc/src/src_user/Settings/TlmCmd/DataBase/", + "path_to_db" : "C:/c2a_sample_aobc/database/", "max_tlm_num" : 256, "driver_path" : "Aocs/", "driver_type" : "AOBC_Driver", @@ -28,7 +29,7 @@ "tlm_id_range" : ["0xc0", "0xf0"], "is_cmd_prefixed_in_db" : 0, "input_file_encoding" : "utf-8", - "db_path" : "C:/c2a_sample_tobc/src/src_user/Settings/TlmCmd/DataBase/", + "path_to_db" : "C:/c2a_sample_tobc/database/", "max_tlm_num" : 256, "driver_path" : "Thermal/", "driver_type" : "TOBC_Driver", From dad7078ce145df34226463aa1ca5ddaf2f273e03 Mon Sep 17 00:00:00 2001 From: chutaro <35984595+chutaro@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:39:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E5=BE=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 ++++++----- my_mod/load_db.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index cc62ab0..f6c0365 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ $ python GenerateC2ACode.py ## 設定 `settings.json` にて記述する. -`is_main_obc` は,MOBC(地上局と通信するOBC.2nd OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(2nd OBC.MOBCと通信するOBC)かを制御する. +`is_main_obc` は,MOBC(地上局と通信するOBC.2nd OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(2nd OBC.MOBCと通信するOBC)かを制御する. `1` とした場合,MOBCを意図したコードが生成され,加えて以下が生成される. - 2nd_obc_command_definitions.h - 2nd_obc_telemetry_definitions.h @@ -26,9 +26,10 @@ $ python GenerateC2ACode.py ``` { - # C2A ROOTへ相対パス. - # C2A ROOTとは, `src_core`, `src_user` のあるディレクトリ + # `src_core`, `src_user` のあるディレクトリへのパス "path_to_src" : "../../c2a/src/", + # テレコマ DB のあるディレクトリへのパス + "path_to_db" : "../../c2a/database/", # TlmCmdDBのファイル名の接頭辞 "db_prefix" : "SAMPLE_MOBC", # TLM ID の定義域 @@ -54,7 +55,7 @@ $ python GenerateC2ACode.py "is_cmd_prefixed_in_db" : 0, "input_file_encoding" : "utf-8", # DBがあるディレクトリへのパス(絶対でも相対でもOK) - "db_path" : "../../c2a_sample_aobc/src/src_user/Settings/TlmCmd/DataBase/", + "path_to_db" : "../../c2a_sample_aobc/database/", # MOBC で保持するテレメの TLM ID の最大値(=テレメ種類数) "max_tlm_num" : 256, "driver_path" : "Aocs/", @@ -72,7 +73,7 @@ $ python GenerateC2ACode.py "is_cmd_prefixed_in_db" : 0, "input_file_encoding" : "utf-8", # DBがあるディレクトリへのパス(絶対でも相対でもOK) - "db_path" : ""../../c2a_sample_tobc/src/src_user/Settings/TlmCmd/DataBase/", + "path_to_db" : ""../../c2a_sample_tobc/database/", # MOBC で保持するテレメの TLM ID の最大値(=テレメ種類数) "max_tlm_num" : 256, "driver_path" : "Thermal/", diff --git a/my_mod/load_db.py b/my_mod/load_db.py index 66c2e85..b5fb3f8 100644 --- a/my_mod/load_db.py +++ b/my_mod/load_db.py @@ -12,7 +12,7 @@ def LoadCmdDb(settings): - cmd_db_path = settings["db_path"] + r"CMD_DB/" + cmd_db_path = settings["path_to_db"] + r"CMD_DB/" sgc_db, bct_db = LoadCmdCSV_( cmd_db_path, settings["db_prefix"], settings["input_file_encoding"] @@ -44,7 +44,7 @@ def LoadCmdCSV_(cmd_db_path, db_prefix, encoding): def LoadTlmDb(settings): - tlm_db_path = settings["db_path"] + r"TLM_DB/calced_data/" + tlm_db_path = settings["path_to_db"] + r"TLM_DB/calced_data/" tlm_db = LoadTlmCSV_( tlm_db_path, @@ -113,7 +113,7 @@ def LoadOtherObcCmd_(settings): for i in range(len(settings["other_obc_data"])): if not settings["other_obc_data"][i]["is_enable"]: continue - cmd_db_path = settings["other_obc_data"][i]["db_path"] + r"CMD_DB/" + cmd_db_path = settings["other_obc_data"][i]["path_to_db"] + r"CMD_DB/" sgc_db, bct_db = LoadCmdCSV_( cmd_db_path, settings["other_obc_data"][i]["db_prefix"], @@ -134,7 +134,7 @@ def LoadOtherObcTlm(settings): for i in range(len(settings["other_obc_data"])): if not settings["other_obc_data"][i]["is_enable"]: continue - tlm_db_path = settings["other_obc_data"][i]["db_path"] + r"TLM_DB/calced_data/" + tlm_db_path = settings["other_obc_data"][i]["path_to_db"] + r"TLM_DB/calced_data/" tlm_db = LoadTlmCSV_( tlm_db_path, From 5e8b52520c983b5c66415bfb46a74b922eaba77e Mon Sep 17 00:00:00 2001 From: yutaro_ito <4793651-yutaro_ito@users.noreply.gitlab.com> Date: Tue, 25 Jul 2023 10:37:24 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E6=94=B9=E8=A1=8C=E6=88=BB=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f6c0365..e1fc245 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ $ python GenerateC2ACode.py ## 設定 `settings.json` にて記述する. -`is_main_obc` は,MOBC(地上局と通信するOBC.2nd OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(2nd OBC.MOBCと通信するOBC)かを制御する. +`is_main_obc` は,MOBC(地上局と通信するOBC.2nd OBCのtlm/cmdを取りまとめる)かそれ以外のOBC(2nd OBC.MOBCと通信するOBC)かを制御する. `1` とした場合,MOBCを意図したコードが生成され,加えて以下が生成される. - 2nd_obc_command_definitions.h - 2nd_obc_telemetry_definitions.h