Make sure we don't send lights commands before we have a config packet, and adjust the V3 command timing.

master
Glenn Maynard 6 years ago
parent 1959a1eaa9
commit c53c3d45c6
  1. 14
      sdk/Windows/SMXManager.cpp

@ -403,20 +403,30 @@ void SMX::SMXManager::SetLights(const string sPanelLights[2])
double fCommandTimes[3] = { fNow, fNow, fNow }; double fCommandTimes[3] = { fNow, fNow, fNow };
bool masterIsV4 = false; bool masterIsV4 = false;
bool anyMasterConnected = false;
for(int iPad = 0; iPad < 2; ++iPad) for(int iPad = 0; iPad < 2; ++iPad)
{ {
SMXConfig config; SMXConfig config;
if(m_pDevices[iPad]->GetConfigLocked(config) && config.masterVersion >= 4) if(!m_pDevices[iPad]->GetConfigLocked(config))
continue;
anyMasterConnected = true;
if(config.masterVersion >= 4)
masterIsV4 = true; masterIsV4 = true;
} }
// If we don't have the config yet, the master is in the process of connecting, so don't
// queue lights.
if(!anyMasterConnected)
return;
// If we're on master firmware < 4, set delay times. For 4+, just queue commands. // If we're on master firmware < 4, set delay times. For 4+, just queue commands.
// We don't need to set fCommandTimes[0] since the '4' packet won't be sent. // We don't need to set fCommandTimes[0] since the '4' packet won't be sent.
if(!masterIsV4) if(!masterIsV4)
{ {
const double fDelayBetweenLightsCommands = 1/60.0; const double fDelayBetweenLightsCommands = 1/60.0;
fCommandTimes[1] = fSendCommandAt; fCommandTimes[1] = fSendCommandAt;
fCommandTimes[2] = fCommandTimes[0] + fDelayBetweenLightsCommands; fCommandTimes[2] = fCommandTimes[1] + fDelayBetweenLightsCommands;
} }
// Update m_fDelayLightCommandsUntil, so we know when the next // Update m_fDelayLightCommandsUntil, so we know when the next

Loading…
Cancel
Save