Conversation
Codecov Report
@@ Coverage Diff @@
## develop #476 +/- ##
===========================================
- Coverage 63.66% 63.29% -0.38%
===========================================
Files 56 57 +1
Lines 4715 4784 +69
===========================================
+ Hits 3002 3028 +26
- Misses 1713 1756 +43 |
|
I added more settings for the canalystii interface, I also created documentation of this interface and the vendor of such device. It's ready to be merged with the master branch. |
hardbyte
left a comment
There was a problem hiding this comment.
Looks good for inclusion. Thanks for the contribution!
| Timing0, Timing1 = (0x31, 0x1C) | ||
| elif baud == 5000: | ||
| Timing0, Timing1 = (0xBF, 0xFF) | ||
|
|
There was a problem hiding this comment.
Raise an error if baud isn't supported
can/interfaces/canalystii.py
Outdated
|
|
||
| if baud == 1000000: | ||
| Timing0, Timing1 = (0x00, 0x14) | ||
| elif baud == 800000: |
There was a problem hiding this comment.
This should be moved out of the init method. I'd have a timing dict which maps baud to each timing tuple.
There was a problem hiding this comment.
Thank for your suggestion, this part is improved
| :param channel: channel number | ||
| :param device: device number | ||
| :param baud: baud rate | ||
| :param Timing0: customize the timing register if baudrate is not specified |
There was a problem hiding this comment.
Should these timing overrides default to None?
|
|
||
| timeout = -1 if timeout is None else int(timeout * 1000) | ||
|
|
||
| if CANalystII.VCI_Receive(VCI_USBCAN2, self.device, self.channels[0], byref(raw_message), 1, timeout) <= STATUS_ERR: |
There was a problem hiding this comment.
Would be good to separate out the error responses and the timeout ones.
There was a problem hiding this comment.
The VCI_Receive function will return the number of can frames read before a timeout. If it is not a positive number, it did not receive anything. I cannot differentiate error responses or timeout ones.
|
If you would like to add yourself to the CONTRIBUTORS.txt and update the history.rst file then I think we're all good to merge. Cheers! |
|
@smeng9 seems parameters in Bus init method were not same as documentation, i cannot find any clue for the value of channel parameter which was 'can0'/'vcan0' in doc. can pro can open device correctly. |
|
Hi @atmlvs The channel for CANalyst-II is either 0(high speed) or 1(redundant). Because I don't know which operating system you are currently using, my initial guess from this error is you are using Linux and you have not given the program sudo permission, or you are not using a compatible device with the library. |
|
Hi @smeng9 yes, I use channel 0 and finally opened the device. the latest device driver and 32/64 bits DLL version should be checked. thanks for the clarification. |
Closes Issue #68
First I would like to thank @rapzak for providing the initial Python code on CANalyst-II hardware. I tried to follow his code and convert his code to python-can BusABC compatible interface. Till now I have come up with a minimal implementation that provides open/close/send/receive functionality.
I will try to write documentation about the CANalyst-II interface and come up with test cases in the following weeks.
I still need some help and hope someone will pickup in completing a more concrete implementation that can: 1. detect board info, 2. use the filter provided by CANalyst-II instead of python-can, 3. error handling.