mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-03-09 01:30:46 -04:00
* Reorganize and clean up RGBController API functions
* Add functions to get protected RGBController member values
* Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
* Protected previously-public RGBController members
* Information strings (name, vendor, description, version, serial location)
* Device type
* Active mode
* Flags
* LEDs vector
* LED alternate names vector
* Modes vector
* Colors vector
* Zones vector
* Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
* Add update reason codes to RGBController update callback and signal updates on more RGBController events
* Add loop zone types and segmented zone type
* Add matrix map field to segments
* Rework matrix_map_type from using pointers to vector to prevent memory leaks
* Rework KeyboardLayoutManager to return new matrix_map_type
* Add access mutex to RGBController API
* Add per-zone modes ot RGBController API
* Add JSON description functions to RGBController API
146 lines
4.3 KiB
C++
146 lines
4.3 KiB
C++
/*---------------------------------------------------------*\
|
|
| RGBController_CorsairHydro.cpp |
|
|
| |
|
|
| RGBController for Corsair Hydro Series coolers |
|
|
| |
|
|
| Adam Honse (calcprogrammer1@gmail.com) 18 Aug 2020 |
|
|
| |
|
|
| This file is part of the OpenRGB project |
|
|
| SPDX-License-Identifier: GPL-2.0-or-later |
|
|
\*---------------------------------------------------------*/
|
|
|
|
#include "RGBController_CorsairHydro.h"
|
|
|
|
/**------------------------------------------------------------------*\
|
|
@name Corsair Hydro
|
|
@category Cooler
|
|
@type USB
|
|
@save :x:
|
|
@direct :white_check_mark:
|
|
@effects :white_check_mark:
|
|
@detectors DetectCorsairHydroControllers
|
|
@comment
|
|
\*-------------------------------------------------------------------*/
|
|
|
|
RGBController_CorsairHydro::RGBController_CorsairHydro(CorsairHydroController* controller_ptr)
|
|
{
|
|
controller = controller_ptr;
|
|
|
|
name = controller->GetNameString();
|
|
vendor = "Corsair";
|
|
description = "Corsair Hydro Series Device";
|
|
version = controller->GetFirmwareString();
|
|
type = DEVICE_TYPE_COOLER;
|
|
location = controller->GetLocation();
|
|
|
|
mode Direct;
|
|
Direct.name = "Direct";
|
|
Direct.value = 0;
|
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
|
modes.push_back(Direct);
|
|
|
|
mode Blinking;
|
|
Blinking.name = "Blinking";
|
|
Blinking.value = 1;
|
|
Blinking.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
|
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
Blinking.speed_min = 0x0F;
|
|
Blinking.speed_max = 0x05;
|
|
Blinking.speed = 0x0A;
|
|
Blinking.colors_min = 2;
|
|
Blinking.colors_max = 2;
|
|
Blinking.colors.resize(2);
|
|
modes.push_back(Blinking);
|
|
|
|
mode ColorShift;
|
|
ColorShift.name = "Color Shift";
|
|
ColorShift.value = 2;
|
|
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
|
ColorShift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
ColorShift.speed_min = 0x46;
|
|
ColorShift.speed_max = 0x0F;
|
|
ColorShift.speed = 0x28;
|
|
ColorShift.colors_min = 2;
|
|
ColorShift.colors_max = 2;
|
|
ColorShift.colors.resize(2);
|
|
modes.push_back(ColorShift);
|
|
|
|
mode Pulsing;
|
|
Pulsing.name = "Pulsing";
|
|
Pulsing.value = 3;
|
|
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR;
|
|
Pulsing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
|
Pulsing.speed_min = 0x50;
|
|
Pulsing.speed_max = 0x1E;
|
|
Pulsing.speed = 0x37;
|
|
Pulsing.colors_min = 2;
|
|
Pulsing.colors_max = 2;
|
|
Pulsing.colors.resize(2);
|
|
modes.push_back(Pulsing);
|
|
|
|
SetupZones();
|
|
}
|
|
|
|
RGBController_CorsairHydro::~RGBController_CorsairHydro()
|
|
{
|
|
delete controller;
|
|
}
|
|
|
|
void RGBController_CorsairHydro::SetupZones()
|
|
{
|
|
zone new_zone;
|
|
|
|
new_zone.name = "Pump Zone";
|
|
new_zone.type = ZONE_TYPE_SINGLE;
|
|
new_zone.leds_min = 1;
|
|
new_zone.leds_max = 1;
|
|
new_zone.leds_count = 1;
|
|
|
|
zones.push_back(new_zone);
|
|
|
|
led new_led;
|
|
|
|
new_led.name = "Pump LED";
|
|
leds.push_back(new_led);
|
|
|
|
SetupColors();
|
|
}
|
|
|
|
void RGBController_CorsairHydro::DeviceUpdateLEDs()
|
|
{
|
|
DeviceUpdateMode();
|
|
}
|
|
|
|
void RGBController_CorsairHydro::DeviceUpdateZoneLEDs(int /*zone*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_CorsairHydro::DeviceUpdateSingleLED(int /*led*/)
|
|
{
|
|
DeviceUpdateLEDs();
|
|
}
|
|
|
|
void RGBController_CorsairHydro::DeviceUpdateMode()
|
|
{
|
|
switch(modes[active_mode].value)
|
|
{
|
|
case 0:
|
|
controller->SetFixed(colors);
|
|
break;
|
|
|
|
case 1:
|
|
controller->SetBlink(modes[active_mode].colors, modes[active_mode].speed);
|
|
break;
|
|
|
|
case 2:
|
|
controller->SetShift(modes[active_mode].colors, modes[active_mode].speed);
|
|
break;
|
|
|
|
case 3:
|
|
controller->SetPulse(modes[active_mode].colors, modes[active_mode].speed);
|
|
break;
|
|
}
|
|
}
|