From aebf306484868ae36e40e7744fb3f0633b85872c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 29 Mar 2020 23:37:53 -0500 Subject: [PATCH] Fix animations being enabled on gen1-3 platforms when they shouldn't be. Animations should be enabled only if the user selects "GIF animations". They were being enabled when in the default panel color mode, which was confusing and not intended. --- smx-config/App.xaml.cs | 4 +--- smx-config/Helpers.cs | 9 --------- smx-config/MainWindow.xaml.cs | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/smx-config/App.xaml.cs b/smx-config/App.xaml.cs index 9de2bc3..fa0e538 100644 --- a/smx-config/App.xaml.cs +++ b/smx-config/App.xaml.cs @@ -64,10 +64,8 @@ namespace smx_config CurrentSMXDevice.singleton = new CurrentSMXDevice(); - // Load animations, and tell the SDK to handle auto-lighting as long as - // we're running. + // Load animations. Helpers.LoadSavedPanelAnimations(); - SMX.SMX.LightsAnimation_SetAuto(true); CreateTrayIcon(); diff --git a/smx-config/Helpers.cs b/smx-config/Helpers.cs index b74c1fb..52d4271 100644 --- a/smx-config/Helpers.cs +++ b/smx-config/Helpers.cs @@ -797,11 +797,6 @@ namespace smx_config if(LightsTimer.IsEnabled) return; - // We normally leave lights animation control enabled while this application is - // running. Turn it off temporarily while we're showing the lights sample, or the - // two will fight. - SMX.SMX.LightsAnimation_SetAuto(false); - // Don't wait for an interval to send the first update. //AutoLightsColorRefreshColor(); @@ -815,10 +810,6 @@ namespace smx_config // Reenable pad auto-lighting. If we're running animations in SMXPanelAnimation, // this will be overridden by it once it sends lights. SMX.SMX.ReenableAutoLights(); - - // Turn lighting control back on. This will only do anything on pads without - // support for animations. - SMX.SMX.LightsAnimation_SetAuto(true); } private void AutoLightsColorRefreshColor() diff --git a/smx-config/MainWindow.xaml.cs b/smx-config/MainWindow.xaml.cs index 70a5385..e73dac3 100644 --- a/smx-config/MainWindow.xaml.cs +++ b/smx-config/MainWindow.xaml.cs @@ -200,6 +200,19 @@ namespace smx_config } } + // We have two main modes: color mode and GIF animation mode. These behave differently + // on gen1-3 pads and gen4 pads. + // + // On gen4 pads, this determines whether we show animations on press, or show a solid color. + // This makes it easy to pick a solid color if that's all you want to change, instead of having + // to make a GIF with the color. We always show animations on release in both modes. + // + // On gen1-3 pads, panels are black in color mode, so they behave the same as they did originally. + // Animations are only shown in GIF animation mode. These animations are enabled with + // LightsAnimation_SetAuto. + // + // The gen1-3 firmware ignores the AutoLightingUsePressedAnimations flag, but we still use it to + // store which mode the user has selected. private void PressedColorModeButton(object sender, RoutedEventArgs e) { // The user pressed either the "panel colors" or "GIF animations" button. @@ -223,6 +236,11 @@ namespace smx_config private void LoadUIFromConfig(LoadFromConfigDelegateArgs args) { + // Refresh whether LightsAnimation_SetAuto should be enabled. + SMX.SMXConfig firstConfig = ActivePad.GetFirstActivePadConfig(); + bool usePressedAnimationsEnabled = (firstConfig.configFlags & SMX.SMXConfigFlags.AutoLightingUsePressedAnimations) != 0; + SMX.SMX.LightsAnimation_SetAuto(usePressedAnimationsEnabled); + bool EitherControllerConnected = args.controller[0].info.connected || args.controller[1].info.connected; Main.Visibility = EitherControllerConnected ? Visibility.Visible : Visibility.Hidden; Searching.Visibility = EitherControllerConnected ? Visibility.Hidden : Visibility.Visible;