Skip to content

Commit

Permalink
Modify DBC file placement to project specific paths (#191)
Browse files Browse the repository at this point in the history
* Modify DBC file placement to be project specific

* Address pull request feedback
  • Loading branch information
Jinwoo-H authored Sep 26, 2024
1 parent 1971ecc commit 4cb1f38
Show file tree
Hide file tree
Showing 14 changed files with 12 additions and 71 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.DS_STORE
.vscode
.vscode
60 changes: 0 additions & 60 deletions firmware/dbcs/VEH_TEST_CAN.dbc

This file was deleted.

2 changes: 1 addition & 1 deletion firmware/projects/Demo/CAN/Bar/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "demo.dbc"
- "../demo.dbc"
2 changes: 1 addition & 1 deletion firmware/projects/Demo/CAN/Foo/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "demo.dbc"
- "../demo.dbc"
File renamed without changes.
4 changes: 2 additions & 2 deletions firmware/projects/EV5/FrontController/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "veh.dbc"
- "../veh.dbc"
- busName: pt
dbcFiles:
- "pt.dbc"
- "../pt.dbc"
2 changes: 1 addition & 1 deletion firmware/projects/EV5/LVController/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "veh.dbc"
- "../veh.dbc"
2 changes: 1 addition & 1 deletion firmware/projects/EV5/TMS/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "veh.dbc"
- "../veh.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/EV5/debug/FrontControllerSimple/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ canGen:
busses:
- busName: veh
dbcFiles:
- "veh.dbc"
- "../../veh.dbc"
- busName: pt
dbcFiles:
- "pt.dbc"
- "../../pt.dbc"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions scripts/cangen/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

DIR_FIRMWARE = os.path.join(DIR_THIS_FILE, os.pardir, os.pardir, "firmware")
DIR_PROJECTS = os.path.join(DIR_FIRMWARE, "projects")
DIR_DBCS = os.path.join(DIR_FIRMWARE, "dbcs")

CONFIG_FILE_NAME = "config.yaml"
DEFAULT_OUTPUT_DIR = "generated/can"
Expand Down Expand Up @@ -63,6 +62,8 @@ def parse():
with open(CONFIG_FILE_NAME, "r") as file:
config = yaml.safe_load(file)

config_file_path = os.path.abspath(CONFIG_FILE_NAME)

our_node = config["canGen"]["ourNode"].upper()
bus_list = config["canGen"]["busses"]
output_path = config["canGen"].get("outputPath", DEFAULT_OUTPUT_DIR)
Expand All @@ -74,7 +75,7 @@ def parse():
bus_name = bus['busName'].capitalize()
dbc_files = bus['dbcFiles']

dbc_file_paths = [os.path.join(DIR_DBCS, dbc) for dbc in dbc_files]
dbc_file_paths = [os.path.normpath(os.path.join(os.path.dirname(config_file_path), dbc)) for dbc in dbc_files]

can_messages_template_path = os.path.join(
DIR_TEMPLATES, CAN_MESSAGES_TEMPLATE_FILENAME
Expand Down

0 comments on commit 4cb1f38

Please sign in to comment.