Truncate the config packet for firmware that doesn't need all of it.

master
Glenn Maynard 6 years ago
parent cc07e07649
commit a202063287
  1. 9
      sdk/Windows/SMXDevice.cpp

@ -313,6 +313,15 @@ void SMX::SMXDevice::SendConfig()
// Write configuration command: // Write configuration command:
string sData = ssprintf("w"); string sData = ssprintf("w");
int8_t iSize = sizeof(SMXConfig); int8_t iSize = sizeof(SMXConfig);
// Firmware through version 3 allowed config packets up to 128 bytes. Additions
// to the packet later on brought it up to 126, so the maximum was raised to 250.
// Older firmware won't use the extra fields, but will ignore the packet if it's
// larger than it supports, so just truncate the packet for these devices to make
// sure this doesn't happen.
if(config.masterVersion <= 3)
iSize = min(iSize, offsetof(SMXConfig, flags));
sData.append((char *) &iSize, sizeof(iSize)); sData.append((char *) &iSize, sizeof(iSize));
sData.append((char *) &wanted_config, sizeof(wanted_config)); sData.append((char *) &wanted_config, sizeof(wanted_config));

Loading…
Cancel
Save