From a0f9e4ed014cfdc4768d355101b24963a5effd09 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 21 Jul 2022 21:55:32 +1000 Subject: [PATCH] Initial commit for the AMD RX 6900 XT reference GPU to resolve #2612 + Adding USB PID `0x015B` to the existing controller. + Adding missing colour modes `Rainbow Wave`, `Swirl`, `Chase` and `Bounce` --- .../CMR6000Controller.cpp | 85 +++++--- .../CMR6000Controller.h | 86 +++++---- .../CoolerMasterControllerDetect.cpp | 11 +- .../RGBController_CMR6000Controller.cpp | 182 ++++++++++++------ 4 files changed, 238 insertions(+), 126 deletions(-) diff --git a/Controllers/CoolerMasterController/CMR6000Controller.cpp b/Controllers/CoolerMasterController/CMR6000Controller.cpp index 32060726..77ebb1cf 100644 --- a/Controllers/CoolerMasterController/CMR6000Controller.cpp +++ b/Controllers/CoolerMasterController/CMR6000Controller.cpp @@ -9,10 +9,11 @@ #include "CMR6000Controller.h" #include -CMR6000Controller::CMR6000Controller(hid_device* dev_handle, char *_path) +CMR6000Controller::CMR6000Controller(hid_device* dev_handle, char *_path, uint16_t _pid) { dev = dev_handle; location = _path; + pid = _pid; const int szTemp = 256; wchar_t tmpName[szTemp]; @@ -59,21 +60,6 @@ unsigned char CMR6000Controller::GetMode() return current_mode; } -unsigned char CMR6000Controller::GetLedRed() -{ - return current_red; -} - -unsigned char CMR6000Controller::GetLedGreen() -{ - return current_green; -} - -unsigned char CMR6000Controller::GetLedBlue() -{ - return current_blue; -} - unsigned char CMR6000Controller::GetLedSpeed() { return current_speed; @@ -89,13 +75,17 @@ bool CMR6000Controller::GetRandomColours() return current_random; } -void CMR6000Controller::SetMode(unsigned char mode, unsigned char speed, unsigned char red, unsigned char green, unsigned char blue, unsigned char random, unsigned char brightness) +uint16_t CMR6000Controller::GetPID() +{ + return pid; +} + +void CMR6000Controller::SetMode(unsigned char mode, unsigned char speed, RGBColor color1, RGBColor color2, unsigned char random, unsigned char brightness) { current_mode = mode; current_speed = speed; - current_red = red; - current_green = green; - current_blue = blue; + primary = color1; + secondary = color2; current_random = random; current_brightness = brightness; @@ -103,7 +93,7 @@ void CMR6000Controller::SetMode(unsigned char mode, unsigned char speed, unsigne } void CMR6000Controller::SendUpdate() -{ +{ if(current_mode == CM_MR6000_MODE_OFF) { unsigned char buffer[CM_6K_PACKET_SIZE] = { 0x00, 0x41, 0x43 }; @@ -114,6 +104,11 @@ void CMR6000Controller::SendUpdate() { SendEnableCommand(); + if(pid == COOLERMASTER_RADEON_6900_PID) + { + SendSecondColour(); + } + unsigned char buffer[CM_6K_PACKET_SIZE] = { 0x00 }; int buffer_size = (sizeof(buffer) / sizeof(buffer[0])); memset(buffer, 0xFF, buffer_size); @@ -124,18 +119,39 @@ void CMR6000Controller::SendUpdate() buffer[0x03] = 0x01; buffer[0x04] = 0x00; buffer[0x05] = current_mode; - buffer[0x06] = (current_mode == CM_MR6000_MODE_DIRECT) ? 0xFF: current_speed; - buffer[0x07] = (current_mode == CM_MR6000_MODE_BREATHE)? current_random : 0x00; //random (A0) - buffer[0x08] = (current_mode == CM_MR6000_MODE_BREATHE)? 0x03 : 0xFF; + buffer[0x06] = current_speed; + buffer[0x07] = current_random; //random (A0) //buffer[0x09] = 0xFF; buffer[0x0A] = current_brightness; - buffer[0x0B] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : current_red; - buffer[0x0C] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : current_green; - buffer[0x0D] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : current_blue; + buffer[0x0B] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : RGBGetRValue(primary); + buffer[0x0C] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : RGBGetGValue(primary); + buffer[0x0D] = (current_mode == CM_MR6000_MODE_COLOR_CYCLE) ? 0xFF : RGBGetBValue(primary); buffer[0x0E] = 0x00; buffer[0x0F] = 0x00; buffer[0x10] = 0x00; + /*-----------------------------------------------------------------*\ + | Index 0x08 looks to be mode specific flags / options | + \*-----------------------------------------------------------------*/ + switch(current_mode) + { + case CM_MR6000_MODE_BREATHE: + buffer[0x08] = 0x03; + break; + case CM_MR6000_MODE_RAINBOW: + buffer[0x08] = 0x05; + break; + case CM_MR6000_MODE_CHASE: + buffer[0x08] = 0xC3; + break; + case CM_MR6000_MODE_SWIRL: + buffer[0x08] = 0x4A; + break; + default: + buffer[0x08] = 0xFF; + } + + hid_write(dev, buffer, buffer_size); SendColourConfig(); @@ -174,3 +190,18 @@ void CMR6000Controller::SendColourConfig() hid_write(dev, buffer, buffer_size); hid_read_timeout(dev, buffer, buffer_size, CM_6K_INTERRUPT_TIMEOUT); } + +void CMR6000Controller::SendSecondColour() +{ + unsigned char buffer[CM_6K_PACKET_SIZE] = { 0x00, 0x51, 0x9C, 0x01, 0x00 }; + + buffer[5] = RGBGetRValue(primary); + buffer[6] = RGBGetGValue(primary); + buffer[7] = RGBGetBValue(primary); + buffer[8] = RGBGetRValue(secondary); + buffer[9] = RGBGetGValue(secondary); + buffer[10] = RGBGetBValue(secondary); + + hid_write(dev, buffer, CM_6K_PACKET_SIZE); + hid_read_timeout(dev, buffer, CM_6K_PACKET_SIZE, CM_6K_INTERRUPT_TIMEOUT); +} diff --git a/Controllers/CoolerMasterController/CMR6000Controller.h b/Controllers/CoolerMasterController/CMR6000Controller.h index 3ec3b766..d8b82ea3 100644 --- a/Controllers/CoolerMasterController/CMR6000Controller.h +++ b/Controllers/CoolerMasterController/CMR6000Controller.h @@ -9,21 +9,31 @@ #include #include #include +#include "RGBController.h" #pragma once -#define CM_6K_PACKET_SIZE 65 //Includes extra first byte for non HID Report packets -#define CM_6K_INTERRUPT_TIMEOUT 250 -#define CM_6K_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ])) -#define CM_6K_SERIAL_SIZE (sizeof(serial) / sizeof(serial[ 0 ])) -#define HID_MAX_STR 255 +#define COOLERMASTER_RADEON_6000_PID 0x014D +#define COOLERMASTER_RADEON_6900_PID 0x015B + +#define CM_6K_PACKET_SIZE 65 //Includes extra first byte for non HID Report packets +#define CM_6K_INTERRUPT_TIMEOUT 250 +#define CM_6K_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ])) +#define CM_6K_SERIAL_SIZE (sizeof(serial) / sizeof(serial[ 0 ])) +#define HID_MAX_STR 255 enum { - CM_MR6000_MODE_DIRECT = 0x00, //Direct Mode - CM_MR6000_MODE_BREATHE = 0x01, //Breathe Mode - CM_MR6000_MODE_COLOR_CYCLE = 0x02, //Color cycle - CM_MR6000_MODE_OFF = 0xFF, //Off + CM_MR6000_MODE_DIRECT = 0x00, //Direct Mode + CM_MR6000_MODE_BREATHE = 0x01, //Breathe Mode + CM_MR6000_MODE_COLOR_CYCLE = 0x02, //Color cycle + + CM_MR6000_MODE_RAINBOW = 0x07, //Rainbow + CM_MR6000_MODE_BOUNCE = 0x08, //Bounce + CM_MR6000_MODE_CHASE = 0x09, //Chase + CM_MR6000_MODE_SWIRL = 0x0A, //Swirl + + CM_MR6000_MODE_OFF = 0xFF, //Off }; enum @@ -34,6 +44,10 @@ enum MR6000_CYCLE_SPEED_FAST = 0x6E, /* Fast speed */ MR6000_CYCLE_SPEED_FASTEST = 0x68, /* Fastest speed */ + MR6000_RAINBOW_SPEED_SLOWEST = 0x78, /* Slowest speed */ + MR6000_RAINBOW_SPEED_NORMAL = 0x6B, /* Normal speed */ + MR6000_RAINBOW_SPEED_FASTEST = 0x60, /* Fastest speed */ + MR6000_BREATHE_SPEED_SLOWEST = 0x3C, /* Slowest speed */ MR6000_BREATHE_SPEED_SLOW = 0x37, /* Slow speed */ MR6000_BREATHE_SPEED_NORMAL = 0x31, /* Normal speed */ @@ -44,39 +58,39 @@ enum class CMR6000Controller { public: - CMR6000Controller(hid_device* dev_handle, char *_path); + CMR6000Controller(hid_device* dev_handle, char *_path, uint16_t _pid); ~CMR6000Controller(); - std::string GetDeviceName(); - std::string GetSerial(); - std::string GetLocation(); + std::string GetDeviceName(); + std::string GetSerial(); + std::string GetLocation(); - unsigned char GetMode(); - unsigned char GetLedRed(); - unsigned char GetLedGreen(); - unsigned char GetLedBlue(); - unsigned char GetLedSpeed(); - unsigned char GetBrightness(); - bool GetRandomColours(); - void SetMode(unsigned char mode, unsigned char speed, unsigned char red, unsigned char green, unsigned char blue, unsigned char random, unsigned char brightness); + unsigned char GetMode(); + unsigned char GetLedSpeed(); + unsigned char GetBrightness(); + bool GetRandomColours(); + uint16_t GetPID(); + + void SetMode(unsigned char mode, unsigned char speed, RGBColor color1, RGBColor color2, unsigned char random, unsigned char brightness); private: - std::string device_name; - std::string serial; - std::string location; - hid_device* dev; + std::string device_name; + std::string serial; + std::string location; + hid_device* dev; + uint16_t pid; - unsigned char current_mode; - unsigned char current_speed; - unsigned char current_random; + unsigned char current_mode; + unsigned char current_speed; + unsigned char current_random; - unsigned char current_red; - unsigned char current_green; - unsigned char current_blue; - unsigned char current_brightness; + unsigned char current_brightness; + RGBColor primary; + RGBColor secondary; - void SendUpdate(); - void SendEnableCommand(); - void SendApplyCommand(); - void SendColourConfig(); + void SendUpdate(); + void SendEnableCommand(); + void SendApplyCommand(); + void SendColourConfig(); + void SendSecondColour(); }; diff --git a/Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp b/Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp index 7b430f47..77a755e6 100644 --- a/Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp +++ b/Controllers/CoolerMasterController/CoolerMasterControllerDetect.cpp @@ -1,11 +1,4 @@ #include "Detector.h" -#include "CMMM711Controller.h" -#include "CMMP750Controller.h" -#include "CMARGBcontroller.h" -#include "CMSmallARGBController.h" -#include "CMRGBController.h" -#include "CMR6000Controller.h" -#include "CMMKController.h" #include "RGBController.h" #include "RGBController_CMMMController.h" #include "RGBController_CMMM711Controller.h" @@ -31,7 +24,6 @@ #define COOLERMASTER_ARGB_GEN2_A1_PID 0x0173 #define COOLERMASTER_SMALL_ARGB_PID 0x1000 #define COOLERMASTER_RGB_PID 0x004F -#define COOLERMASTER_RADEON_6000_PID 0x014D #define COOLERMASTER_MASTERKEYS_PRO_L_PID 0x003B #define COOLERMASTER_MASTERKEYS_PRO_L_WHITE_PID 0x0047 #define COOLERMASTER_MASTERKEYS_PRO_S_PID 0x003C @@ -88,7 +80,7 @@ void DetectCoolerMasterGPU(hid_device_info* info, const std::string&) if(dev) { - CMR6000Controller* controller = new CMR6000Controller(dev, info->path); + CMR6000Controller* controller = new CMR6000Controller(dev, info->path, info->product_id); RGBController_CMR6000Controller* rgb_controller = new RGBController_CMR6000Controller(controller); // Constructor sets the name ResourceManager::get()->RegisterRGBController(rgb_controller); @@ -189,3 +181,4 @@ REGISTER_HID_DETECTOR_IPU("Cooler Master ARGB Gen 2 A1", DetectCooler REGISTER_HID_DETECTOR_IPU("Cooler Master Small ARGB", DetectCoolerMasterSmallARGB, COOLERMASTER_VID, COOLERMASTER_SMALL_ARGB_PID, 0, 0xFF00, 1); REGISTER_HID_DETECTOR_IPU("Cooler Master RGB", DetectCoolerMasterRGB, COOLERMASTER_VID, COOLERMASTER_RGB_PID, 1, 0xFF00, 1); REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6000 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6000_PID, 1 ); +REGISTER_HID_DETECTOR_I ("Cooler Master Radeon 6900 GPU", DetectCoolerMasterGPU, COOLERMASTER_VID, COOLERMASTER_RADEON_6900_PID, 1 ); diff --git a/Controllers/CoolerMasterController/RGBController_CMR6000Controller.cpp b/Controllers/CoolerMasterController/RGBController_CMR6000Controller.cpp index eb508901..b3a6897e 100644 --- a/Controllers/CoolerMasterController/RGBController_CMR6000Controller.cpp +++ b/Controllers/CoolerMasterController/RGBController_CMR6000Controller.cpp @@ -22,64 +22,127 @@ RGBController_CMR6000Controller::RGBController_CMR6000Controller(CMR6000Controller* controller_ptr) { - controller = controller_ptr; - unsigned char speed = controller->GetLedSpeed(); + controller = controller_ptr; + unsigned char speed = controller->GetLedSpeed(); - name = "AMD RX 6xxx GPU"; - vendor = "Cooler Master"; - type = DEVICE_TYPE_GPU; - description = controller->GetDeviceName(); - serial = controller->GetSerial(); - location = controller->GetLocation(); + name = "AMD RX 6xxx GPU"; + vendor = "Cooler Master"; + type = DEVICE_TYPE_GPU; + description = controller->GetDeviceName(); + serial = controller->GetSerial(); + location = controller->GetLocation(); mode Off; - Off.name = "Off"; - Off.flags = 0; - Off.value = CM_MR6000_MODE_OFF; - Off.color_mode = MODE_COLORS_NONE; + Off.name = "Off"; + Off.flags = 0; + Off.value = CM_MR6000_MODE_OFF; + Off.color_mode = MODE_COLORS_NONE; modes.push_back(Off); mode Direct; - Direct.name = "Direct"; - Direct.value = CM_MR6000_MODE_DIRECT; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR| MODE_FLAG_HAS_BRIGHTNESS; - Direct.color_mode = MODE_COLORS_PER_LED; - Direct.colors_min = 1; - Direct.colors_max = 1; - Direct.colors.resize(1); - Direct.brightness_min = 0x00; - Direct.brightness_max = 0xFF; - Direct.brightness = 0xFF; + Direct.name = "Direct"; + Direct.value = CM_MR6000_MODE_DIRECT; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR| MODE_FLAG_HAS_BRIGHTNESS; + Direct.color_mode = MODE_COLORS_PER_LED; + Direct.speed = 0xFF; + Direct.brightness_min = 0x00; + Direct.brightness_max = 0xFF; + Direct.brightness = 0xFF; modes.push_back(Direct); mode ColorCycle; - ColorCycle.name = "Color Cycle"; - ColorCycle.value = CM_MR6000_MODE_COLOR_CYCLE; - ColorCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; - ColorCycle.speed_min = MR6000_CYCLE_SPEED_SLOWEST; - ColorCycle.speed = MR6000_CYCLE_SPEED_NORMAL; - ColorCycle.speed_max = MR6000_CYCLE_SPEED_FASTEST; - ColorCycle.color_mode = MODE_COLORS_NONE; - ColorCycle.speed = speed; - ColorCycle.brightness_min = 0x00; - ColorCycle.brightness_max = 0xFF; - ColorCycle.brightness = 0x7F; + ColorCycle.name = "Spectrum Cycle"; + ColorCycle.value = CM_MR6000_MODE_COLOR_CYCLE; + ColorCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + ColorCycle.speed_min = MR6000_CYCLE_SPEED_SLOWEST; + ColorCycle.speed = MR6000_CYCLE_SPEED_NORMAL; + ColorCycle.speed_max = MR6000_CYCLE_SPEED_FASTEST; + ColorCycle.color_mode = MODE_COLORS_NONE; + ColorCycle.speed = MR6000_CYCLE_SPEED_NORMAL; + ColorCycle.brightness_min = 0x00; + ColorCycle.brightness_max = 0xFF; + ColorCycle.brightness = 0x7F; modes.push_back(ColorCycle); mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = CM_MR6000_MODE_BREATHE; - Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR; - Breathing.speed_min = MR6000_BREATHE_SPEED_SLOWEST; - Breathing.speed = MR6000_BREATHE_SPEED_NORMAL; - Breathing.speed_max = MR6000_BREATHE_SPEED_FASTEST; - Breathing.color_mode = MODE_COLORS_PER_LED; - Breathing.colors_min = 1; - Breathing.colors_max = 1; + Breathing.name = "Breathing"; + Breathing.value = CM_MR6000_MODE_BREATHE; + Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR; + Breathing.speed_min = MR6000_BREATHE_SPEED_SLOWEST; + Breathing.speed = MR6000_BREATHE_SPEED_NORMAL; + Breathing.speed_max = MR6000_BREATHE_SPEED_FASTEST; + Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; + Breathing.colors_min = 1; + Breathing.colors_max = 1; Breathing.colors.resize(1); - Breathing.speed = speed; + Breathing.speed = MR6000_BREATHE_SPEED_NORMAL; modes.push_back(Breathing); + if(controller->GetPID() == COOLERMASTER_RADEON_6900_PID) + { + mode Rainbow; + Rainbow.name = "Rainbow Wave"; + Rainbow.value = CM_MR6000_MODE_RAINBOW; + Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + Rainbow.speed_min = MR6000_RAINBOW_SPEED_SLOWEST; + Rainbow.speed = MR6000_RAINBOW_SPEED_NORMAL; + Rainbow.speed_max = MR6000_RAINBOW_SPEED_FASTEST; + Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.speed = MR6000_CYCLE_SPEED_NORMAL; + Rainbow.brightness_min = 0x00; + Rainbow.brightness_max = 0xFF; + Rainbow.brightness = 0xFF; + modes.push_back(Rainbow); + + mode Bounce; + Bounce.name = "Bounce"; + Bounce.value = CM_MR6000_MODE_BOUNCE; + Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + Bounce.speed_min = MR6000_CYCLE_SPEED_SLOWEST; + Bounce.speed = MR6000_CYCLE_SPEED_NORMAL; + Bounce.speed_max = MR6000_CYCLE_SPEED_FASTEST; + Bounce.color_mode = MODE_COLORS_NONE; + Bounce.speed = MR6000_CYCLE_SPEED_NORMAL; + Bounce.brightness_min = 0x00; + Bounce.brightness_max = 0xFF; + Bounce.brightness = 0xFF; + modes.push_back(Bounce); + + mode Chase; + Chase.name = "Chase"; + Chase.value = CM_MR6000_MODE_CHASE; + Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_DIRECTION_LR; + Chase.speed_min = MR6000_CYCLE_SPEED_SLOWEST; + Chase.speed = MR6000_CYCLE_SPEED_NORMAL; + Chase.speed_max = MR6000_CYCLE_SPEED_FASTEST; + Chase.color_mode = MODE_COLORS_MODE_SPECIFIC; + Chase.colors_min = 2; + Chase.colors_max = 2; + Chase.colors.resize(2); + Chase.speed = MR6000_CYCLE_SPEED_NORMAL; + Chase.brightness_min = 0; + Chase.brightness_max = 0xFF; + Chase.brightness = 0xFF; + modes.push_back(Chase); + + mode Swirl; + Swirl.name = "Swirl"; + Swirl.value = CM_MR6000_MODE_SWIRL; + Swirl.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_DIRECTION_LR; + Swirl.speed_min = MR6000_CYCLE_SPEED_SLOWEST; + Swirl.speed = MR6000_CYCLE_SPEED_NORMAL; + Swirl.speed_max = MR6000_CYCLE_SPEED_FASTEST; + Swirl.color_mode = MODE_COLORS_MODE_SPECIFIC; + Swirl.colors_min = 1; + Swirl.colors_max = 1; + Swirl.colors.resize(1); + Swirl.speed = MR6000_CYCLE_SPEED_NORMAL; + Swirl.brightness_min = 0; + Swirl.brightness_max = 0xFF; + Swirl.brightness = 0xFF; + modes.push_back(Swirl); + } + SetupZones(); active_mode = 1; } @@ -118,21 +181,32 @@ void RGBController_CMR6000Controller::ResizeZone(int /*zone*/, int /*new_size*/) void RGBController_CMR6000Controller::DeviceUpdateLEDs() { - unsigned char red = 0; - unsigned char grn = 0; - unsigned char blu = 0; + mode new_mode = modes[active_mode]; + RGBColor color1 = (new_mode.colors.size() > 0) ? new_mode.colors[0] : colors[0]; + RGBColor color2 = (new_mode.colors.size() > 1) ? new_mode.colors[1] : 0; + unsigned char bri = (new_mode.flags & MODE_FLAG_HAS_BRIGHTNESS) ? new_mode.brightness : 0xFF; + unsigned char rnd = 0x20; - if(modes[active_mode].color_mode == MODE_COLORS_PER_LED) + switch(new_mode.value) { - red = RGBGetRValue(colors[0]); - grn = RGBGetGValue(colors[0]); - blu = RGBGetBValue(colors[0]); + /*-----------------------------------------------------------------*\ + | Breathing mode requires value 0x20 when in MODE_SPECIFIC_COLOR | + \*-----------------------------------------------------------------*/ + case CM_MR6000_MODE_BREATHE: + if(new_mode.color_mode == MODE_COLORS_RANDOM) + { + rnd = 0xA0; + } + break; + case CM_MR6000_MODE_SWIRL: + case CM_MR6000_MODE_CHASE: + rnd = new_mode.direction; + break; + default: + rnd = 0; } - unsigned char rnd = (modes[active_mode].color_mode == MODE_COLORS_RANDOM) ? 0xA0 : 0x20; - unsigned char bri = (modes[active_mode].flags & MODE_FLAG_HAS_BRIGHTNESS) ? modes[active_mode].brightness : 0xFF; - - controller->SetMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu, rnd, bri); + controller->SetMode(new_mode.value, new_mode.speed, color1, color2, rnd, bri); } void RGBController_CMR6000Controller::UpdateZoneLEDs(int /*zone*/)