Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export Eds or Dcf #254

Merged
merged 17 commits into from
Oct 12, 2021

Conversation

unsanded
Copy link
Contributor

@unsanded unsanded commented Aug 9, 2021

I needed this for work, so i wrote it. Also added a unit test.
This fixes #235

supported

  • Write eds
  • Write Dcf with extra device commisioning info
  • DeviceInfo section
  • cache FileInfo
  • Eds comments

not supported

  • Write compactSubObj sections
  • Features i didn't know about?

Ps. I improved the deb script slightly. (My previous pull request) So i just included it.
I could rebase it out if we want to be all proper like that :)

Copy link
Owner

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a nice addition!

We should however stick to PEP-8 coding conventions as much as possible. Variables and attributes should be snake_case and whitespace used consistently.

https://www.python.org/dev/peps/pep-0008/

canopen/objectdictionary/__init__.py Outdated Show resolved Hide resolved
canopen/objectdictionary/__init__.py Show resolved Hide resolved
@unsanded
Copy link
Contributor Author

Ok, I think that is it. I think i processed all of the feedback :) Thanks for the quick review btw 👍

@acolomb
Copy link
Collaborator

acolomb commented Aug 11, 2021

I guess this will fix #235 when merged. Should be linked.

@unsanded
Copy link
Contributor Author

Thanks @acolomb I looked before starting, but i didn't see it.

@unsanded unsanded marked this pull request as draft August 12, 2021 07:06
@unsanded
Copy link
Contributor Author

unsanded commented Aug 12, 2021

I changed it to a WIP, because i am using it in a project now, and i keep finding missing features. So i'll just add those, and put it back.
Probably next pull request i do i should do this straight away

@christiansandberg
Copy link
Owner

Sounds good! There are some camelCase style code left also.

The previous one used installed some stuff into usr/local/lib/ next to the intended usr/lib/dist-pakages target.

Now using a bdist_wheel package, which is much more clean
Now eds files can also be written.
To make the written eds file resemble the read one more,
the `DeviceInfo` section is now also read and stored.
The `FileInfo` section is also read, but stored privately.
now export_od accepts a filename as destination.
If no docType is given, the extension is used as a default.
if this fails, eds is still the fallback

also better documentation
snake_case in test
@unsanded unsanded marked this pull request as ready for review September 25, 2021 12:51
Copy link
Owner

@christiansandberg christiansandberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, missed that this was ready. Looks good, just some minor formatting changes and merge with master and it's good to go I believe.

canopen/objectdictionary/__init__.py Outdated Show resolved Hide resolved
canopen/objectdictionary/__init__.py Outdated Show resolved Hide resolved
canopen/objectdictionary/__init__.py Outdated Show resolved Hide resolved
Co-authored-by: Christian Sandberg <christiansandberg@users.noreply.github.com>
@unsanded
Copy link
Contributor Author

Cool, thanks for the review :)

also extended the changes in code style (type annotations)
class DeviceInformation:
def __init__(self):
self.allowed_baudrates = set()
self.vendor_name:Optional[str] = None

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding type annotations! However it looks like all attributes are parsed as strings from the EDS so either let them all be strings or convert them during parsing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, very attentive. Fixed it now.

They used to be all strings copied straight from the eds file.
Now they are str, int and bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write Object Dictionary to efs file
3 participants