Skip to content

Minor bug in export_eds() #605

@CANopenNode

Description

@CANopenNode

Bug in the following section:

for rate in od.device_information.allowed_baudrates.union(
{10e3, 20e3, 50e3, 125e3, 250e3, 500e3, 800e3, 1000e3}):
eds.set(
"DeviceInfo", f"BaudRate_{rate//1000}",
int(rate in od.device_information.allowed_baudrates))

currently it exports to something like

...
BaudRate_250=1
BaudRate_10.0=0
BaudRate_50.0=0

Problem:
rate//1000 gives floating number, because rate itself is a float.

Fix:
I suggest either int(rate//1000) or use set with integers {10000, 20000, 50000, 125000, 250000, 500000, 800000, 1000000}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions