Add SMX_SetOnlySendLightsOnChange for smx-panel-test.

master
Glenn Maynard 6 years ago
parent 69b2239922
commit 672541015f
  1. 3
      sdk/Windows/SMX.cpp
  2. 16
      sdk/Windows/SMXManager.cpp
  3. 3
      sdk/Windows/SMXManager.h

@ -98,3 +98,6 @@ SMX_API void SMX_SetLights2(const char *lightData, int lightDataSize)
}
SMX_API void SMX_ReenableAutoLights() { SMXManager::g_pSMX->ReenableAutoLights(); }
SMX_API const char *SMX_Version() { return SMX_BUILD_VERSION; }
// This isn't exposed in the public API, since this is only used internally.
SMX_API void SMX_SetOnlySendLightsOnChange(bool value) { SMXManager::g_pSMX->SetOnlySendLightsOnChange(value); }

@ -253,6 +253,22 @@ void SMX::SMXManager::SetLights(const string sPanelLights[2])
if(m_PanelTestMode != PanelTestMode_Off)
return;
// If m_bOnlySendLightsOnChange is true, only send lights commands if the lights have
// actually changed. This is only used for internal testing, and the controllers normally
// expect to receive regular lights updates, even if the lights aren't actually changing.
if(m_bOnlySendLightsOnChange)
{
static string sLastPanelLights[2];
if(sPanelLights[0] == sLastPanelLights[0] && sPanelLights[1] == sLastPanelLights[1])
{
Log("no change");
return;
}
sLastPanelLights[0] = sPanelLights[0];
sLastPanelLights[1] = sPanelLights[1];
}
// Separate top and bottom lights commands.
//
// sPanelLights[iPad] is

@ -46,6 +46,7 @@ public:
void SetLights(const string sLights[2]);
void ReenableAutoLights();
void SetPanelTestMode(PanelTestMode mode);
void SetOnlySendLightsOnChange(bool value) { m_bOnlySendLightsOnChange = value; }
// Run a function in the user callback thread.
void RunInHelperThread(function<void()> func);
@ -85,6 +86,8 @@ private:
uint32_t m_SentPanelTestModeAtTicks = 0;
PanelTestMode m_PanelTestMode = PanelTestMode_Off;
PanelTestMode m_LastSentPanelTestMode = PanelTestMode_Off;
bool m_bOnlySendLightsOnChange = false;
};
}

Loading…
Cancel
Save