Skip to content

Commit

Permalink
changed config names and added node to bus #239 (#276)
Browse files Browse the repository at this point in the history
* changed config names and added node to bus

* changed config for lv

* changed config motor debug
  • Loading branch information
AndrewI26 authored and CameronBeneteau committed Nov 1, 2024
1 parent 62d61ec commit 31298d6
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions firmware/projects/Demo/CAN/Bar/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
canGen:
ourNode: bar
busses:
- busName: veh
- name: veh
node: bar
dbcFiles:
- "../demo.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/Demo/CAN/Foo/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
canGen:
ourNode: foo
busses:
- busName: veh
- name: veh
node: foo
dbcFiles:
- "../demo.dbc"
7 changes: 4 additions & 3 deletions firmware/projects/EV5/FrontController/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
canGen:
ourNode: fc
busses:
- busName: veh
- name: veh
node: fc
dbcFile: "../veh.dbc"
- busName: pt
- name: pt
node: fc
dbcFile: "../pt.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/EV5/LVController/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
canGen:
ourNode: lvc
busses:
- busName: veh
- name: veh
node: lvc
dbcFile: "../veh.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/EV5/TMS/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
canGen:
ourNode: tms
busses:
- busName: veh
- name: veh
node: tms
dbcFile: "../veh.dbc"
7 changes: 4 additions & 3 deletions firmware/projects/EV5/debug/FrontControllerSimple/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
canGen:
ourNode: fc
busses:
- busName: veh
- name: veh
node: fc
dbcFile: "../../veh.dbc"
- busName: pt
- name: pt
node: fc
dbcFile: "../../pt.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/EV5/debug/IoCheckoutFc/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
canGen:
ourNode: FC
busses:
- busName: io
- name: io
node: FC
dbcFile: "io.dbc"
4 changes: 2 additions & 2 deletions firmware/projects/EV5/debug/MotorDebug/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
canGen:
ourNode: FRONTCONTROLLER
busses:
- busName: vehicle
- name: vehicle
node: FRONTCONTROLLER
dbcFile: "pedal.dbc"
2 changes: 1 addition & 1 deletion scripts/cangen/cangen/can_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def generate_code(bus: Bus, config: Config):
logger.info("Generating code")

can_db = _parse_dbc_files(bus.dbc_file_path)
rx_msgs, tx_msgs = _filter_messages_by_node(can_db.messages, config.node)
rx_msgs, tx_msgs = _filter_messages_by_node(can_db.messages, bus.node)

context = {
"date": time.strftime("%Y-%m-%d"),
Expand Down
5 changes: 2 additions & 3 deletions scripts/cangen/cangen/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
class Bus:
def __init__(self, bus: dict):
self.dbc_file_path: str = bus.pop("dbcFile")
self.bus_name: str = bus.pop("busName").capitalize()
self.bus_name: str = bus.pop("name").capitalize()
self.node = bus.pop("node")

if bus:
raise ValueError(
Expand All @@ -23,9 +24,7 @@ def from_yaml(config_file_name: str) -> Config:
return Config(config.pop("canGen"))

def __init__(self, config: dict):
self.node = config.pop("ourNode")
self.output_dir = config.pop("outputPath", DEFAULT_OUTPUT_DIR)

self.busses = [Bus(bus) for bus in config.pop("busses")]

if config:
Expand Down

0 comments on commit 31298d6

Please sign in to comment.