From 537b9d456915cf4ab45793df930f218334f111bb Mon Sep 17 00:00:00 2001 From: thombo Date: Thu, 26 May 2022 21:13:33 +0200 Subject: [PATCH] Special treatment of MSI board 0x7B93 added --- .../MSIMysticLight185Controller.cpp | 39 ++++++++++++++++++- .../MSIMysticLight185Controller.h | 1 + 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Controllers/MSIMysticLightController/MSIMysticLight185Controller.cpp b/Controllers/MSIMysticLightController/MSIMysticLight185Controller.cpp index 348605769..c58bb4afe 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight185Controller.cpp +++ b/Controllers/MSIMysticLightController/MSIMysticLight185Controller.cpp @@ -233,6 +233,7 @@ MSIMysticLight185Controller::MSIMysticLight185Controller ) { dev = handle; + active_pid = pid; if(dev) { @@ -427,7 +428,7 @@ void MSIMysticLight185Controller::SetMode bool rainbow_color ) { - if((per_led_mode == DIRECT_MODE_ZONE_BASED) && (zone > MSI_ZONE_ON_BOARD_LED_0)) + if((per_led_mode == DIRECT_MODE_ZONE_BASED) && (zone > MSI_ZONE_ON_BOARD_LED_0) && (active_pid != 0x7B93)) { return; } @@ -465,6 +466,22 @@ void MSIMysticLight185Controller::SetMode on_board_zone->speedAndBrightnessFlags &= ~SYNC_SETTING_JRGB; on_board_zone->colorFlags &= ~(SYNC_SETTING_JPIPE1 | SYNC_SETTING_JPIPE2); } + + if((active_pid == 0x7B93) && (zone == MSI_ZONE_ON_BOARD_LED_0) && (mode <= MSI_MODE_LIGHTNING)) + { + for(int i = 0; i < numof_onboard_leds; ++i) + { + zone_data = GetZoneData(data, (MSI_ZONE)((int)MSI_ZONE_ON_BOARD_LED_1 + i)); + + if(zone_data != nullptr) + { + zone_data->effect = mode; + zone_data->speedAndBrightnessFlags = (brightness << 2) | (speed & 0x03); + zone_data->colorFlags = BITSET(zone_data->colorFlags, !rainbow_color, 7u); + zone_data->padding = 0x00; + } + } + } } std::string MSIMysticLight185Controller::GetDeviceName() @@ -532,7 +549,7 @@ void MSIMysticLight185Controller::SetZoneColor unsigned char blu2 ) { - if((per_led_mode == DIRECT_MODE_ZONE_BASED) && (zone > MSI_ZONE_ON_BOARD_LED_0)) + if((per_led_mode == DIRECT_MODE_ZONE_BASED) && (zone > MSI_ZONE_ON_BOARD_LED_0) && (active_pid != 0x7B93)) { return; } @@ -562,6 +579,24 @@ void MSIMysticLight185Controller::SetZoneColor on_board_zone->color2.G = grn2; on_board_zone->color2.B = blu2; } + + if((active_pid == 0x7B93) && (zone == MSI_ZONE_ON_BOARD_LED_0)) + { + for(int i = 0; i < numof_onboard_leds; ++i) + { + zone_data = GetZoneData(data, (MSI_ZONE)((int)MSI_ZONE_ON_BOARD_LED_1 + i)); + + if(zone_data != nullptr) + { + zone_data->color.R = red1; + zone_data->color.G = grn1; + zone_data->color.B = blu1; + zone_data->color2.R = red2; + zone_data->color2.G = grn2; + zone_data->color2.B = blu2; + } + } + } } void MSIMysticLight185Controller::SetLedColor diff --git a/Controllers/MSIMysticLightController/MSIMysticLight185Controller.h b/Controllers/MSIMysticLightController/MSIMysticLight185Controller.h index a0b7c37ce..8663927c0 100644 --- a/Controllers/MSIMysticLightController/MSIMysticLight185Controller.h +++ b/Controllers/MSIMysticLightController/MSIMysticLight185Controller.h @@ -137,4 +137,5 @@ private: int numof_JRGBs; const std::vector* supported_zones; DIRECT_MODE per_led_mode; + unsigned short active_pid; };