From 96598ef59b19efadd1edee0b2d15763620478916 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 18 Mar 2020 21:13:50 -0500 Subject: [PATCH] Reset the floor color on factory reset. --- sdk/Windows/SMXDevice.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sdk/Windows/SMXDevice.cpp b/sdk/Windows/SMXDevice.cpp index 15c3947..b150915 100644 --- a/sdk/Windows/SMXDevice.cpp +++ b/sdk/Windows/SMXDevice.cpp @@ -208,6 +208,27 @@ void SMX::SMXDevice::FactoryReset() [&](string response) { // We now have the new configuration. m_Lock.AssertLockedByCurrentThread(); + + if(deviceInfo.m_iFirmwareVersion >= 5) + { + // Factory reset resets the platform strip color saved to the configuration, but doesn't + // apply it to the lights. Do that now. + string sLightCommand; + sLightCommand.push_back('L'); + sLightCommand.push_back(0); // LED strip index (always 0) + sLightCommand.push_back(44); // number of LEDs to set + + config.platformStripColor[0]; + for(int i = 0; i < 44; ++i) + { + sLightCommand += config.platformStripColor[0]; + sLightCommand += config.platformStripColor[1]; + sLightCommand += config.platformStripColor[2]; + } + + SendCommandLocked(sLightCommand); + } + CallUpdateCallback(SMXUpdateCallback_FactoryResetCommandComplete); }); }