From 4e7aa49d68aca6c959eb2a9b48a6d6fc35f744a6 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 12 Nov 2026 00:02:40 -0600 Subject: [PATCH] Only validate and update speed and brightness for an updated mode if the mode flags indicate the mode supports these parameters, openrgb-python zeros out these fields when the flags aren't set which breaks these checks --- RGBController/RGBController.cpp | 40 ++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/RGBController/RGBController.cpp b/RGBController/RGBController.cpp index a97b894d..6951aff6 100644 --- a/RGBController/RGBController.cpp +++ b/RGBController/RGBController.cpp @@ -4823,10 +4823,11 @@ bool RGBController::SetModeValuesFromMode(mode& destination, mode& source) | Validate source mode before updating destination | \*-----------------------------------------------------*/ if((destination.name == source.name) - && (destination.brightness_max == source.brightness_max) - && (destination.brightness_min == source.brightness_min) - && (((destination.brightness_max >= destination.brightness_min) && (source.brightness >= destination.brightness_min) && (source.brightness <= destination.brightness_max)) - || ((destination.brightness_max <= destination.brightness_min) && (source.brightness <= destination.brightness_min) && (source.brightness >= destination.brightness_max))) + && (((destination.flags & MODE_FLAG_HAS_BRIGHTNESS) == 0) + || ((destination.brightness_max == source.brightness_max) + && (destination.brightness_min == source.brightness_min) + && (((destination.brightness_max >= destination.brightness_min) && (source.brightness >= destination.brightness_min) && (source.brightness <= destination.brightness_max)) + || ((destination.brightness_max <= destination.brightness_min) && (source.brightness <= destination.brightness_min) && (source.brightness >= destination.brightness_max))))) && ((((destination.flags & (MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR)) == 0) && (source.color_mode == MODE_COLORS_NONE)) || ((destination.flags & MODE_FLAG_HAS_PER_LED_COLOR) && (source.color_mode == MODE_COLORS_PER_LED)) || ((destination.flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR) && (source.color_mode == MODE_COLORS_MODE_SPECIFIC)) @@ -4840,16 +4841,29 @@ bool RGBController::SetModeValuesFromMode(mode& destination, mode& source) || ((destination.flags & MODE_FLAG_HAS_DIRECTION_HV) && ((source.direction == MODE_DIRECTION_HORIZONTAL) || (source.direction == MODE_DIRECTION_VERTICAL))) || ((destination.flags & MODE_FLAG_HAS_DIRECTION_LR) && ((source.direction == MODE_DIRECTION_LEFT) || (source.direction == MODE_DIRECTION_RIGHT))) || ((destination.flags & MODE_FLAG_HAS_DIRECTION_UD) && ((source.direction == MODE_DIRECTION_UP) || (source.direction == MODE_DIRECTION_DOWN)))) - && (destination.speed_max == source.speed_max) - && (destination.speed_min == source.speed_min) - && (((destination.speed_max >= destination.speed_min) && (source.speed >= destination.speed_min) && (source.speed <= destination.speed_max)) - || ((destination.speed_max <= destination.speed_min) && (source.speed <= destination.speed_min) && (source.speed >= destination.speed_max)))) + && (((destination.flags & MODE_FLAG_HAS_SPEED) == 0) + || ((destination.speed_max == source.speed_max) + && (destination.speed_min == source.speed_min) + && (((destination.speed_max >= destination.speed_min) && (source.speed >= destination.speed_min) && (source.speed <= destination.speed_max)) + || ((destination.speed_max <= destination.speed_min) && (source.speed <= destination.speed_min) && (source.speed >= destination.speed_max)))))) { - destination.brightness = source.brightness; - destination.color_mode = source.color_mode; - destination.colors = source.colors; - destination.direction = source.direction; - destination.speed = source.speed; + destination.color_mode = source.color_mode; + destination.colors = source.colors; + + if(destination.flags & (MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD)) + { + destination.direction = source.direction; + } + + if(destination.flags & MODE_FLAG_HAS_BRIGHTNESS) + { + destination.brightness = source.brightness; + } + + if(destination.flags & MODE_FLAG_HAS_SPEED) + { + destination.speed = source.speed; + } return(true); }