milhead2 / python-j1939

Breakout of j1939 from inside the python-can package
GNU Lesser General Public License v3.0
38 stars 20 forks source link

Thoughts/questions on the Node class and j1939_nodes example #25

Open grant-allan-ctct opened 12 months ago

grant-allan-ctct commented 12 months ago

I am looking at the j1939_nodes.py example code and seeing the comment:

# This example is an attempt to operate two address endpoints concurrently.
#
# Currently it's not tested and I suspect it's not handling the address claims correctly
# among other things

In the code, we are giving node1 and node2 both the same j1939 name value (of 0), here. This might be getting get in the way of things working correctly? Part of the j1939 name is a unique ID, and so placing two nodes with identical uniqueID is possibly going to play havoc with j1939 name arbitration? To make the example more real-world, maybe make a tweak that gives the two nodes unique names.

One reason why I am here looking at this file is that this particular example code has the only usage I can find (here) for the function node.send_parameter_group. I am interested in this function because it calls a function Bus.write (on this line), which I would like to look at because it looks very useful, but I am having trouble finding it anywhere in the python-1939 codebase, nor in the python-can base class. Does the write function no longer exist, or is this pehaps a typo and a different function is intended?

milhead2 commented 12 months ago

Hello Grant,

I believe that he function your seeking should be in python-can.. It might be better to say 'was' if you cannot find it.

I haven't been keeping pace with python-can changes since rev 3.3, I have so many internal customers at work that I've been pushing off syncing the two till I get the bandwidth.. Hasn't happened yet.

You could try (for an experiment) setting the python-can branch back to release-3.3.2 then do your build/install.

I think we have the changes to set a PR to the external repo. If the experiment above makes the function appear we're just out of date and need to do some housecleaning.

Miller


From: gRant @.> Sent: Monday, December 4, 2023 8:00 AM To: milhead2/python-j1939 @.> Cc: Subscribed @.***> Subject: [milhead2/python-j1939] Thoughts/questions on the Node class and j1939_nodes example (Issue #25)

External Email Think Before You Click.

I am looking at the j1939_nodes.py example codehttps://github.com/milhead2/python-j1939/blob/2a3b5976ed05d3d5d340ad76b452ab48baa2cc56/examples/j1939_nodes.py#L4 and seeing the comment:

This example is an attempt to operate two address endpoints concurrently.

#

Currently it's not tested and I suspect it's not handling the address claims correctly

among other things

In the code, we are giving node1 and node2 both the same j1939 name value (of 0), herehttps://github.com/milhead2/python-j1939/blob/2a3b5976ed05d3d5d340ad76b452ab48baa2cc56/examples/j1939_nodes.py#L41. This might be getting get in the way of things working correctly? Part of the j1939 name is a unique ID, and so placing two nodes with identical uniqueID is possibly going to play havoc with j1939 name arbitration? To make the example more real-world, maybe make a tweak that gives the two nodes unique names.

One reason why I am here looking at this file is that this particular example code has the only usage I can find (herehttps://github.com/milhead2/python-j1939/blob/2a3b5976ed05d3d5d340ad76b452ab48baa2cc56/examples/j1939_nodes.py#L50) for the function node.send_parameter_group. I am interested in this function because it calls a function Bus.write (on this linehttps://github.com/milhead2/python-j1939/blob/2a3b5976ed05d3d5d340ad76b452ab48baa2cc56/j1939/node.py#L140), which I would like to look at because it looks very useful, but I am having trouble finding it anywhere in the python-1939 codebase, nor in the python-can base class. Does the write function no longer exist, or is this pehaps a typo and a different function is intended?

— Reply to this email directly, view it on GitHubhttps://github.com/milhead2/python-j1939/issues/25, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEWRWUY6UP3KZQJKMTHNGI3YHXXRFAVCNFSM6AAAAABAGG3XWGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZDIMJZGU4DKMY. You are receiving this because you are subscribed to this thread.Message ID: @.***>

CONFIDENTIAL: The information contained in this email communication is confidential information intended only for the use of the addressee. Unauthorized use, disclosure or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by return email and destroy all copies of this communication, including all attachments.

grant-allan-ctct commented 11 months ago

Thank you for the reply @milhead2.

I think I have updated my python virtual environment with an older python-can version, and still not seeing a write function.

However, noting that Node.send_parameter_group has a comment saying that data is allowed to be up to 1785 elements in length, I think that the method we're trying to call is one defined by the j1939.Bus class - I think that write probably should just be send instead.