From c7b99856e16239aedecf4b2a413121b8bd8a6832 Mon Sep 17 00:00:00 2001 From: chutaro <35984595+chutaro@users.noreply.github.com> Date: Fri, 24 Jun 2022 17:29:12 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E6=95=B0=E5=AD=97=E3=81=8B=E3=82=89?= =?UTF-8?q?=E5=A7=8B=E3=81=BE=E3=82=8B=E3=83=86=E3=83=AC=E3=83=A1=E5=90=8D?= =?UTF-8?q?=E3=82=92=E9=81=BF=E3=81=91=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- my_mod/tlm_buffer.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/my_mod/tlm_buffer.py b/my_mod/tlm_buffer.py index 4eb06b7..5d431a4 100644 --- a/my_mod/tlm_buffer.py +++ b/my_mod/tlm_buffer.py @@ -8,6 +8,8 @@ # from collections import OrderedDict # import pprint +INVALID_START_CHARS = [str(0), str(1), str(2), str(3), str(4), str(5), str(6), str(7), str(8), str(9)] + def GenerateTlmBuffer(settings, other_obc_dbs): DATA_START_ROW = 8 @@ -259,6 +261,9 @@ def GenerateTlmBuffer(settings, other_obc_dbs): # name_tree = name.lower().split(".")[2:] # OBC名.テレメ名.HOGE.FUGA を想定 name_tree = name.lower().split(".") + for idx, item in enumerate(name_tree): + if item[0] in INVALID_START_CHARS: + name_tree[idx] = "_" + item name_path = ".".join(name_tree) var_name = driver_name + "->tlm_data." + tlm_name_lower + "." + name_path if is_compression: @@ -493,6 +498,8 @@ def _(dict, path_list, val, sep): return 1 # err if len(path_list) == 1: key = path_list[0] + if key[0] in INVALID_START_CHARS: + key = "_" + key if key in dict: return 1 # 上書きエラー else: @@ -500,6 +507,8 @@ def _(dict, path_list, val, sep): return 0 else: key = path_list[0] + if key[0] in INVALID_START_CHARS: + key = "_" + key if key not in dict: dict[key] = {} return _(dict[key], path_list[1:], val, sep) From bb232b729349d03f632a35654f56e3d6ea4105f6 Mon Sep 17 00:00:00 2001 From: chutaro <35984595+chutaro@users.noreply.github.com> Date: Fri, 24 Jun 2022 18:05:23 +0900 Subject: [PATCH 2/3] fix for linter --- my_mod/tlm_buffer.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/my_mod/tlm_buffer.py b/my_mod/tlm_buffer.py index 5d431a4..b17c9aa 100644 --- a/my_mod/tlm_buffer.py +++ b/my_mod/tlm_buffer.py @@ -8,7 +8,18 @@ # from collections import OrderedDict # import pprint -INVALID_START_CHARS = [str(0), str(1), str(2), str(3), str(4), str(5), str(6), str(7), str(8), str(9)] +INVALID_START_CHARS = [ + str(0), + str(1), + str(2), + str(3), + str(4), + str(5), + str(6), + str(7), + str(8), + str(9), +] def GenerateTlmBuffer(settings, other_obc_dbs): From f1e73fa74bc03f154497a3b87f7ba243d4e0984a Mon Sep 17 00:00:00 2001 From: chutaro <35984595+chutaro@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:16:09 +0900 Subject: [PATCH 3/3] =?UTF-8?q?settings.json=20=E3=82=92=20c2a=20=E5=81=B4?= =?UTF-8?q?=E3=81=A7=E6=8C=81=E3=81=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GenerateC2ACode.py | 14 ++------------ settings.json | 40 ---------------------------------------- 2 files changed, 2 insertions(+), 52 deletions(-) delete mode 100644 settings.json diff --git a/GenerateC2ACode.py b/GenerateC2ACode.py index 8ec163d..0a82ece 100644 --- a/GenerateC2ACode.py +++ b/GenerateC2ACode.py @@ -11,18 +11,8 @@ import my_mod.tlm_def import my_mod.tlm_buffer - -# import pprint -# import os.path -# import msvcrt # Enter不要な入力用 -# import subprocess - - -# 環境変数 -DEBUG = 0 -# 0 : Release -# 1 : all -SETTING_FILE_PATH = "settings.json" +# 必要に応じてここを変える +SETTING_FILE_PATH = "../tlm_cmd_gen_config.json" def main(): diff --git a/settings.json b/settings.json deleted file mode 100644 index 6ef5e13..0000000 --- a/settings.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "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, - "input_file_encoding" : "utf-8", - "output_file_encoding" : "utf-8", - "is_main_obc" : 1, - "other_obc_data" : [ - { - "name" : "AOBC", - "is_enable" : 1, - "db_prefix" : "SAMPLE_AOBC", - "tlm_id_range" : ["0x90", "0xc0"], - "is_cmd_prefixed_in_db" : 0, - "input_file_encoding" : "utf-8", - "path_to_db" : "C:/c2a_sample_aobc/database/", - "max_tlm_num" : 256, - "driver_path" : "Aocs/", - "driver_type" : "AOBC_Driver", - "driver_name" : "aobc_driver", - "code_when_tlm_not_found" : "aobc_driver->info.comm.rx_err_code = AOBC_RX_ERR_CODE_TLM_NOT_FOUND;" - }, - { - "name" : "TOBC", - "is_enable" : 1, - "db_prefix" : "SAMPLE_TOBC", - "tlm_id_range" : ["0xc0", "0xf0"], - "is_cmd_prefixed_in_db" : 0, - "input_file_encoding" : "utf-8", - "path_to_db" : "C:/c2a_sample_tobc/database/", - "max_tlm_num" : 256, - "driver_path" : "Thermal/", - "driver_type" : "TOBC_Driver", - "driver_name" : "tobc_driver", - "code_when_tlm_not_found" : "tobc_driver->info.comm.rx_err_code = TOBC_RX_ERR_CODE_TLM_NOT_FOUND;" - } - ] -}