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

Send AMD at end of alias sequence #224

Merged

Conversation

bobjacobsen
Copy link
Contributor

@bobjacobsen bobjacobsen commented Apr 2, 2023

Fix for #121.

See discussion below for further work.

(Note: This commend originally talked about a missing delay between RID and AMD; that's not required by the Standard, so that part of this commented was removed in edit)

@balazsracz
Copy link
Collaborator

I re-read the standard and I don't see a requirement that there be a delay between the RID and the AMD frame. From what I can tell they could be back to back on the CAN-bus.

@@ -71,6 +71,10 @@ public OpenLcbCanFrame nextFrame() {
f = new OpenLcbCanFrame(nida.getNIDa());
f.setRIM(nida.getNIDa());
complete = true;
} else if (index == 5) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you check that this fifth frame is actually sent out by JMRI? I am not sure.
Check the timerExpired function.

There is also a bit of confusion about what the variable complete means now, as it is set to true both after step 4 and after step 5; the done callback is called after the fourth though. Maybe it should be set only after the fifth.

Another minor issue is that after you fix the above, when a CID frame comes in with our alias, processFrame will now do something strange in that it would respond with a RID and an AMD. Maybe processFrame should be changed to not use the timer task in responding to CID frames at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the careful review! I've fixed the complete and callback, and have confirmed that it's now sending the AMD.

I'd like to leave the CID -> RID and AMD for a later PR. There seem to be several different sequences that already behave poorly, in particular if the CID*4 and RID sequence is received (e.g. because the node wasn't really reacting in a timely way, for example a slow JMRI), so I'd like to clean them all up at once.

@bobjacobsen
Copy link
Contributor Author

I re-read the standard and I don't see a requirement that there be a delay between the RID and the AMD frame. From what I can tell they could be back to back on the CAN-bus.

Thanks, you're right. I was mis-remembering where the delay needed to be. Will edit the comment.

@bobjacobsen
Copy link
Contributor Author

This is in use in JMRI now through a custom .jar file. It would be good to get it merged before the end of May so that we can use a production .jar in the next production JMRI release.

@balazsracz balazsracz merged commit 0e32ff1 into openlcb:master Aug 22, 2023
1 check passed
@bobjacobsen bobjacobsen deleted the send_AMD_at_end_of_alias_sequence branch April 1, 2024 15:43
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.

None yet

2 participants