Skip to content

Conversation

@ymkim92
Copy link
Contributor

@ymkim92 ymkim92 commented May 8, 2017

Hi Chris,

I added LSS Master. I hope you like it.
This is the test code:

import canopen
import logging

logging.basicConfig(level=logging.DEBUG)

network = canopen.Network()
network.connect(channel='PCAN_USBBUS1', bustype='pcan', bitrate=250000)
#network.connect(channel='PCAN_USBBUS1', bustype='pcan', bitrate=500000)

network.lss.send_switch_mode_global(network.lss.CONFIGURATION_MODE)
node_id = network.lss.inquire_node_id()
print node_id
network.lss.configure_node_id(node_id+1)
network.lss.configure_bit_timing(3)
#network.lss.store_configuration()
#network.lss.send_switch_mode_global(network.lss.NORMAL_MODE)

network.disconnect()

Regards,
Young

@christiansandberg christiansandberg self-requested a review May 8, 2017 10:09
@christiansandberg christiansandberg self-assigned this May 8, 2017
Copy link
Member

@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.

Great addition! You should add a page to the documentation so that others will know how to use it as well.

Instead of using python-can's Listener interface, you should use Network's subscribemethod to register a callback for 0x7E4. This will work more generally and reduce your code a bit.

canopen/lss.py Outdated

message = [0]*8

if len(message) != 8:
Copy link
Member

Choose a reason for hiding this comment

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

This should not be necessary since you define it as 8 items long.

@ymkim92
Copy link
Contributor Author

ymkim92 commented May 18, 2017

Hi christiansandberg,

I made fixes as you requested:

  • changed the use of Listener interface to Network.subscribe
  • add lss.rst
  • removed unnecessary length check

Regards,
Young

@christiansandberg christiansandberg merged commit 124feae into canopen-python:master May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants