-
Notifications
You must be signed in to change notification settings - Fork 631
Ixxat CAN FD support #1119
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
Ixxat CAN FD support #1119
Conversation
…ive always last frame. Now, if function does not return VCI_OK, no new message is returned.
Added: Documentation for ixxat_fd usage.
Codecov Report
@@ Coverage Diff @@
## develop #1119 +/- ##
===========================================
- Coverage 70.83% 68.92% -1.91%
===========================================
Files 79 82 +3
Lines 7758 8266 +508
===========================================
+ Hits 5495 5697 +202
- Misses 2263 2569 +306 |
Added: Format with black. Added: test to improve coverage. Changed: Default baudrate for data segment is now 2 Mbps.
Please, tell me if any action is required from my side. |
Hello @fjburgos, thank you for your contribution. |
I agree, the problem was I have no way to check the previous interface still works, but I think I can try to do it with minimal changes to the original file (can/interfaces/ixxat/canlib.py). |
…on where required. Changed: Documentation updated accordingly.
I was surprised to see that similar pull request was done 3 days ago (#1126). |
Thanks for your thoughts, @fjburgos, I actually implemented this quite a while ago, and only saw your PR after creating mine. Yes, fully agree with the pros and cons you mentioned. Regarding vcinpl2 it indeed seems that we might consider loading vcinpl instead of vcinpl2 if fd is False (see https://opensource.lely.com/canopen/docs/cross-compilation/), which then leads again to a similar solution like the one in your PR, maybe with a different level of abstraction (hide implementation behind fd flag rather than exposing it as a separate device). Unfortunately I only have a CAN-FD device available for testing. To conclude, I think your approach is fine, if possible, maybe with hiding behind the |
I did the change in the last commit to use the fd option from interface (single ixxat interface, fd parameter decides which dll is loaded). |
Just checked your implementation on my setup, can confirm that the communication works as expected. Thank you very much. |
@felixdivo can you do the second review? |
@fjburgos Nice work. But the extended argument is not used in the init of vcimpl.py constants.CAN_OPMODE_EXTENDED so extended ids are allowed by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A great set of changes!
@fjburgos many thanks for the contribution and for patience with the review process. Once the changes requested by @felixdivo are addressed this is good to merge. |
…is also considered in "no fd" implementation.
… the method signature).
I changed the default value to True, and also changed in vcimpl to use the parameter. |
No problem, I'm just worried about conflicts in case other pull requests are merged. I didn't expect this process to be so long, but as I said, this is my first contribution to an open source project, so, I assume this is normal. In any case, code was improved in each review. |
* Added: Ixxat interface copy before start changing for canfd. * Changed: ixxat_fd adapting for usage with vcinpl2.dll instead of vcinpl.dll. * Fixed: ixxat fd receive function with timeout = 0 was causing to receive always last frame. Now, if function does not return VCI_OK, no new message is returned. * Added: ixxat_fd baudrate from user options instead of hardcoded. * Added: ixxat_fd channel capabilities check. * Added: Myself to contributors list. Added: Documentation for ixxat_fd usage. * Related to ixxat_fd: Added: Format with black. Added: test to improve coverage. Changed: Default baudrate for data segment is now 2 Mbps. * Changed: renamed files before "merging" ixxat and ixxat_fd interfaces. * Changed: Merged structures, exceptions and constants from ixxat-fd to ixxat. * Added: Ixxat interface proxy class delegating to related implementation where required. Changed: Documentation updated accordingly. * Changed: Tests for CAN-FD in ixxat updated according to last changes. * Changed: Suggested changes from pull request review. * Changed: Suggested changes from pull request review. * Changed: Type hint, typing.Tuple instead of tuple. * Changed: TSEG1, TSEG2 and SJW parameters available as optional advanced settings. Changed: Deprecated parameters UniqueHardwareId, rxFifoSize, txFifoSize (use unique_hardware_id, rx_fifo_size, tx_fifo_size instead). Changed: Replaced ctypes.c_long return value for ctypes functions returning HRESULT with an alias "hresult_type" that is a ctypes.c_ulong. * Update doc/interfaces/ixxat.rst Co-authored-by: zariiii9003 <[email protected]> * Changed: Documentation. * Changed: Ixxat extended parameter default from False to True. Now it is also considered in "no fd" implementation. * Changed: Ixxat parameter unique_hardware_id type hint is now optional. * Changed: Ixxat doc comment types removed (let Sphinx derive them from the method signature). * Changed: Updated Ixxat tests to use new argument names. * Fixed: Missing **kwargs parameter in vcinpl and vcinpl2. Co-authored-by: zariiii9003 <[email protected]>
I've been working on #1141 that shares the same scope (IXXAT support) and found that canlib_vcinpl2.py duplicates some code from canlib_vcinpl.py. I would suggest some refactoring to create a cleaner codebase. |
I would suggest first to improve testing. I did not refactor to avoid risk of introduce bugs on vcinpl side, I only have an fd device, so, I could not check that the previous functionalitites are still working after refactoring. |
@felixdivo if #1141 looks fine I propose to create one more PR to remove duplicate code and improve the overall architecture. I can work on such PR and improve testing. @fjburgos would you be available to perform some tests with connected hardware? |
Yes, that sounds reasonable. I'll review #1141 soon 👍 |
I'm available, just say when code is ready and what concrete tests you want me to do. |
Add experimental support for CAN FD in IXXAT device(s).
Tryed and worked with "Ixxat USB-to-CAN FD".