Skip to content

Commit e1f293e

Browse files
committed
Correctly handle packets upto the maximum size allowed by RDM
1 parent f224f57 commit e1f293e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/DMXSerial2.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ DEVICEID _devIDAll = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
255255

256256

257257
// This is the buffer for RDM packets being received and sent.
258-
// this structure is needed to RDM data separate from DMX data.
258+
// This structure is needed to separate RDM data from DMX data.
259259
union RDMMEM {
260260
// the most common RDM packet layout for commands
261261
struct RDMDATA packet;
@@ -264,10 +264,12 @@ union RDMMEM {
264264
struct DISCOVERYMSG discovery;
265265

266266
// the byte array used while receiving and sending.
267-
byte buffer[60];
267+
// This is the max size of any RDM packet and it's max PDL, to allow an
268+
// aribitrary length packet to be received. Thanks to the union it doesn't
269+
// need any more memory
270+
byte buffer[sizeof(packet)];
268271
} _rdm; // union RDMMEM
269272

270-
271273
// This flag will be set when a full RDM packet was received.
272274
bool8 _rdmAvailable;
273275

0 commit comments

Comments
 (0)