-
Notifications
You must be signed in to change notification settings - Fork 32
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
Possible wrong size of data (message) array? #44
Comments
Be aware that the document has NOT been publicly updated since its release, and quite a large number of newer messages have been included but not publicly disclosed, including longer messages than are currently documented there.
The question about "What is the longest LocoNet message length" was recently discussed at some detail at https://groups.io/g/LocoNet-Hackers/message/11204 . I suggest that you should refer to that LocoNet hackers thread. (The LocoNet-Hackers group tends to be a better place to discuss LocoNet technical issues than the MRRWA group...)
In general, WRRwA code should probably allocate 128 bytes per message, and guarantee that no incoming message "overflows" the buffer, whatever "guarantees" means. Such a library change could make a newer library version "not compatible" with certain hardware/software platforms if the new library is not compatible with the old code's memory usage and/or "timings", though. |
Hi cpm64,
Most of the definitions in the ln-opc.h file pre-dated me and were done in 2001 by Ron W. Auld and they’ve not been much of a problem before now…
One way to provide the desired behaviour you’re looking for is to adopt a similar approach to the DCC-EX project, which uses this special pre-processor:
#if __has_include ( "myAutomation.h”)
Optionally include a custom myAutomation.h file if it exists at build time.
If an appropriate file exists in the sketch folder, we may be able to do a similar thing to allow some behaviour to be changed at the Arduino sketch level.
It's probably worth giving it a try, as it would be useful for some other config-type items that alter the library's behaviour.
Regards
Alex Shepherd
m: +64-21-777764
e: ***@***.***
… On 19/04/2024, at 9:02 PM, cpm64 ***@***.***> wrote:
Hello,
Checking the declaration of the LnMsg.data[16] . If I got it right this is the max length of a package. Searching the internet I found various answers about what is the max size of a variable length package: 16, 20. However is not clear if that size includes the OPC [0], the msg size [1] and the checksum bytes: ,,....,.
I discovered that my CS is sometimes issue an '0xe6' OPC of 21 bytes which cannot be handled by LnMsg.data[16].
As a suggestion, a possible enhancement could be to make it configurable via #define LN_MAX_PACKET_LEN (n) and allow the users to define their own max limit.
This is applicable to both LocoNet and LocoNet2-development branch
—
Reply to this email directly, view it on GitHub <#44>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AB5Y53KHJZGOITEN7JL4EDDY6DMTNAVCNFSM6AAAAABGOZFHQKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2TENBWHA2DSNA>.
You are receiving this because you are subscribed to this thread.
|
Hello,
Checking the declaration of the LnMsg.data[16] . If I got it right this is the max length of a message. Searching the internet I found various answers about what is the max size of a variable length message: 16, 20. However is not clear if that size includes the OPC [0], the msg size [1] and the checksum bytes:
<OPC>,<COUNT>,<ARG1>....,<CKSUM>
.I discovered that my CS is sometimes issue an '0xe6' OPC of 21 bytes which cannot be handled by LnMsg.data[16].
As a suggestion, a possible enhancement could be to make it configurable via #define LN_MAX_MSG_LEN (n) and allow the users to define their own max limit.
This is applicable to both LocoNet and LocoNet2-development branch
The text was updated successfully, but these errors were encountered: