GithubHelp home page GithubHelp logo

rm5248 / trainutils Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 521 KB

Train utilities(DCC/NCE/LocoNet/LCC)

License: GNU General Public License v2.0

C 57.02% Makefile 0.51% Shell 0.36% CMake 3.93% C++ 37.97% Python 0.22%
dcc lcc loconet nce model-railroad openlcb

trainutils's Issues

AMR collision handling

CAN frame transfer: section 6.2

Currently, LibLCC fails the test of an AMR frame when running with the OlcbChecker.

Send back error if already doing datagram transaction

If we are already in the middle of a datagram transaction, send back an error to a node that requests us to do a new transaction. This helps to ensure that the response to the previous transaction has been sent before we try to process a new one.

more than 8 events

if datagram too big (more than 8 events), datagram is cut in parts, but each part starts from 0
in LCC_memory.c, at line 240:

memcpy(response + start, data, data_len);
====>
memcpy(response + start, data + starting_address, data_len);

thank you for the wonderfull job.

Throttling / queueing of frames on LCC CAN

The API of the write callback on LCC is defined as "fire and forget":
https://github.com/rm5248/TrainUtils/blob/master/LCC/examples/simple-node/simple-node.ino#L28C1-L28C1

This API assumes that any time that the stack decides to call this function, the bus is free. This is not a valid assumption. The LCC stack must be prepared for the bus being busy and stop generating frames until the previously generated frames were transmitted to the bus.

It is important that when the writes to the bus are throttled, the stack must still read and process the incoming traffic. Therefore it is not an OK solution to pause the stack until the output frame was transmitted. It is also true that the new incoming traffic might generate output data, which might seem like a contradiction.
There are four priority bands in OpenLCB, and it is designed such that a request of priority X will generate a response of priority X-1, therefore even in the presence of a fully loaded bus, the responses that are generated will go out.

The way LibLCC is written today, it will lose messages when the output buffer in the CAN controller is occupied. This will cause problems that are hard to recognize and reproduce. The assumption of LCC is that all messages are delivered.

Improved API for sending packets

Need to add a function that lets the LCC code know how much space there is in the send queue. For example, if there is not enough space in the send queue for us to do a full datagram transfer(8 packets), then we should send back an error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.