diff --git a/smx-config/Helpers.cs b/smx-config/Helpers.cs index 37331a8..a75c75a 100644 --- a/smx-config/Helpers.cs +++ b/smx-config/Helpers.cs @@ -320,16 +320,16 @@ namespace smx_config private void AutoLightsColorRefreshColor() { - byte[] lights = new byte[864]; CommandBuffer cmd = new CommandBuffer(); for(int pad = 0; pad < 2; ++pad) { + // Use this panel's color. If a panel isn't connected, we still need to run the + // loop below to insert data for the panel. + byte[] color = new byte[9*3]; SMX.SMXConfig config; - if(!SMX.SMX.GetConfig(pad, out config)) - continue; - - byte[] color = config.stepColor; + if(SMX.SMX.GetConfig(pad, out config)) + color = config.stepColor; for( int iPanel = 0; iPanel < 9; ++iPanel ) { for( int i = 0; i < 16; ++i ) diff --git a/smx-config/SMX.cs b/smx-config/SMX.cs index a6a70a7..0367bba 100644 --- a/smx-config/SMX.cs +++ b/smx-config/SMX.cs @@ -414,6 +414,9 @@ namespace SMX public static void SetLights(byte[] buf) { if(!DLLAvailable()) return; + + if(buf.Length != 9*16*3*2) + throw new Exception("SetLights buffer has an invalid length: " + buf.Length); SMX_SetLights(buf); }