mcci-catena / arduino-lmic

LoraWAN-MAC-in-C library, adapted to run under the Arduino environment
https://forum.mcci.io/c/device-software/arduino-lmic/
MIT License
643 stars 210 forks source link

Allow messages up to the maximum length #77

Closed terrillmoore closed 5 years ago

terrillmoore commented 6 years ago

Comments and the following constant indicate that the LMIC only allows messages up to 64 bytes long:

https://github.com/mcci-catena/arduino-lmic/blob/78a5907beac6338f68eb6064932cb40ea64fd52f/src/lmic/lmic.h#L104

We need to relax this to allow messages up to 255 bytes long.

For backwards compatibility, add LMIC_ENABLE_long_messages as a post-condition of #include "config.h": always defined, either 0 or 1; defaults to 1 if compliance testing is supported, otherwise 0 [for now], but switching to default to 1 in all cases, once we compliance testing is mostly working.

terrillmoore commented 6 years ago

The referenced line defines MAX_FRAME_LEN which is never used! The relevant line is in lorabaseh: https://github.com/mcci-catena/arduino-lmic/blob/107ae38e8850bfb052acac81be7bfe25a5867e45/src/lmic/lorabase.h#L54

This needs to be controlled by a compile time parameter; on small-RAM systems, we don't want to consume 2x256 bytes if 2x64 bytes will do. The confusing MAX_FRAME_LEN should be removed.

terrillmoore commented 6 years ago

Also see https://github.com/mcci-catena/arduino-lmic/blob/107ae38e8850bfb052acac81be7bfe25a5867e45/src/lmic/radio.c#L626

This needs to be changed to MAX_LEN_FRAME.

terrillmoore commented 5 years ago

See also #4 and #177

terrillmoore commented 5 years ago

Committing as part of #215.