Skip to content

Commit

Permalink
fixes to gen fw output and add inibit time emcy to all ods
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Nov 5, 2023
1 parent 82e1f2a commit 9469a73
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions oresat_configs/base/fw_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ std_objects:
- communication_cycle_period
- identity
- cob_id_emergency_message
- inhibit_time_emcy
- consumer_heartbeat_time
- producer_heartbeat_time
- sdo_server_parameter
Expand Down
1 change: 1 addition & 0 deletions oresat_configs/base/sw_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ std_objects:
- cob_id_sync
- identity
- cob_id_emergency_message
- inhibit_time_emcy
- consumer_heartbeat_time
- producer_heartbeat_time
- sdo_server_parameter
Expand Down
16 changes: 10 additions & 6 deletions oresat_configs/scripts/gen_fw_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,13 +592,17 @@ def write_canopennode_h(od: canopen.ObjectDictionary, dir_path: str = "."):
lines.append("extern OD_ATTR_OD OD_t *OD;")
lines.append("")

num = 0
for i in od:
lines.append(f"#define OD_ENTRY_H{i:X} &OD->list[0x{i:X}]")
lines.append(f"#define OD_ENTRY_H{i:X} &OD->list[{num}]")
num += 1
lines.append("")

num = 0
for i in od:
name = format_name(od[i].name)
lines.append(f"#define OD_ENTRY_H{i:X}_{name.upper()} &OD->list[0x{i:X}]")
lines.append(f"#define OD_ENTRY_H{i:X}_{name.upper()} &OD->list[{num}]")
num += 1
lines.append("")

# add nice #defines for indexes and subindex values
Expand Down Expand Up @@ -685,7 +689,7 @@ def gen_fw_files(sys_args=None):
var = canopen.objectdictionary.Variable("cob_id", index, 0x1)
var.access_type = "const"
var.data_type = canopen.objectdictionary.UNSIGNED32
var.default = ((i % 4) * 0x100) + 0xC0000200 # disabled and no rtr
var.default = ((i % 4) * 0x100) + 0x80000200 # disabled and no rtr
rec.add_member(var)

var = canopen.objectdictionary.Variable("transmission_type", index, 0x2)
Expand Down Expand Up @@ -798,19 +802,19 @@ def gen_fw_files(sys_args=None):
var = canopen.objectdictionary.Variable(
f"mapping_object_{subindex}", index, subindex
)
var.access_type = "const"
var.access_type = "rw"
var.data_type = canopen.objectdictionary.UNSIGNED32
var.default = 0
rec.add_member(var)
else:
for subindex in range(8):
for subindex in range(1, 9):
if subindex in od[index]:
continue

var = canopen.objectdictionary.Variable(
f"mapping_object_{subindex}", index, subindex
)
var.access_type = "const"
var.access_type = "rw"
var.data_type = canopen.objectdictionary.UNSIGNED32
var.default = 0
od[index].add_member(var)
Expand Down
7 changes: 7 additions & 0 deletions oresat_configs/standard_objects.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
access_type: rw
default: "0x80+$NODE_ID"

- index: 0x1015
name: inhibit_time_emcy
object_type: variable
description: inhibit time (in 100 us) for emcy messages
data_type: uint16
access_type: rw

- index: 0x1016
name: consumer_heartbeat_time
object_type: array
Expand Down

0 comments on commit 9469a73

Please sign in to comment.