Comments (2)
Be aware that there are several different cases for "collision" detection:
a) Collision while "you" are transmitting a LocoNet message
b) Collision after "you" have completed a transmission of your message (for slow "collision" detectors, such as PCs)
c) Collision which occurs at a time unrelated to "your" transmissions.
All three of these ought to be triggers for informing "your" software. Some of them require informing "your" transmitter; all three of them "ought" to inform "your" receiver. Exactly what "your" code does with these will be system- and device-type dependant.
Exactly what "your" code does when a "collision" is seen after a fully-formed LocoNet message is up to you, since it is not obvious whether the collision relates to a previously received message or to one which your code had no knowledge of, due to the "collision" detection. An example would be a collision on the "OpCode" byte, resulting in a "parity error". If your hardware simply ignores such things, then you wouldn't know that the byte "happened". If some external hardware enforces the LocoNet "collision" protocol at the bit-level or the byte-level, then it would assert the LocoNet data line low, and no further bytes would be received for at least 15 bit-times. And depending on how the competing devices deal with "collisions", the transmit messages may or may not "continue" beyond that time.
Also note that some LocoNet hardware does not pay attention to ongoing LocoNet activity, and does not identify "collision" cases. This happens with what I consider to be "non-compliant equipment". For this equipment, a long message will simply be sent, in entirety, while (potentially) someone else issues the "collision" indication. Once the "collision" indicaition completes, the original data bits could be seen on LocoNet, as a one or more "corrupted" bytes followed by a string of additional bytes, none with the "most-significant" bit set (i.e. none as OpCode).
For the do-it-yourselfer, the best way to "inject" collisions may be to implement a second "do-it-yourself" LocoNet device, with programming to specifically trigger a transmit at some carefully-chosen time. I've done this kind of testing in the past with my own PIC-based LocoNet devices; I do not have any suggestions of how to do this with the MRRwA libraries.
from loconet2.
Thanks for your in-depth reply.
As far as I can tell, in this library, collision detection is done on a bit-by-bit basis when transmitting. If a collision is detected then it stops transmitting immediately and backs off.
I'll keep up my testing, but at the moment, it seems to be working for my own purposes.
from loconet2.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loconet2.