Skip to content

Commit

Permalink
fix issues with floats in gen fw files script
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanpdx committed Apr 22, 2024
1 parent deff85d commit 63a42b9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions oresat_configs/scripts/gen_fw_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ def attr_lines(od: canopen.ObjectDictionary, index: int) -> list[str]:
line += f"0x{obj.default:X},"
elif obj.data_type == canopen.objectdictionary.datatypes.BOOLEAN:
line += f"{int(obj.default)},"
elif obj.data_type in canopen.objectdictionary.datatypes.FLOAT_TYPES:
line += f"{obj.default},"
else:
line += f"{remove_node_id(obj.default)},"

Expand Down Expand Up @@ -282,6 +284,8 @@ def attr_lines(od: canopen.ObjectDictionary, index: int) -> list[str]:
lines.append(f"{INDENT8}.{name} = 0x{obj[i].default:X},")
elif obj[i].data_type == canopen.objectdictionary.datatypes.BOOLEAN:
lines.append(f"{INDENT8}.{name} = {int(obj[i].default)},")
elif obj[i].data_type in canopen.objectdictionary.datatypes.FLOAT_TYPES:
lines.append(f"{INDENT8}.{name} = {obj[i].default},")
else:
lines.append(f"{INDENT8}.{name} = {remove_node_id(obj[i].default)},")

Expand Down

0 comments on commit 63a42b9

Please sign in to comment.