Fix mode initialization, fix mode map for Corsair Pro

master
Adam Honse 6 years ago
parent b06d56bb2d
commit 1d6e0cf6a4

@ -29,6 +29,8 @@ CorsairProController::CorsairProController(i2c_smbus_interface* bus, corsair_dev
strcpy(device_name, "Corsair Vengeance Pro RGB");
led_count = CORSAIR_PRO_LED_COUNT;
effect_mode = CORSAIR_PRO_MODE_STATIC;
for (unsigned int i = 0; i < led_count; i++)
{
led_red[i] = 0;
@ -62,6 +64,11 @@ unsigned int CorsairProController::GetLEDCount()
return(led_count);
}
unsigned char CorsairProController::GetEffect()
{
return(effect_mode);
}
void CorsairProController::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
{
for (unsigned int i = 0; i < led_count; i++)
@ -99,12 +106,14 @@ void CorsairProController::ApplyColors()
void CorsairProController::SetEffect(unsigned char mode)
{
effect_mode = mode;
bus->i2c_smbus_write_byte_data(dev, 0x26, 0x01);
Sleep(1);
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
Sleep(1);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, mode); //Mode
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, effect_mode); //Mode
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_SPEED_MEDIUM); //Speed
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_EFFECT_RANDOM_COLORS); //Custom color
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_DIRECTION_UP); //Direction

@ -69,6 +69,7 @@ public:
std::string GetDeviceName();
std::string GetDeviceLocation();
unsigned int GetLEDCount();
unsigned char GetEffect();
void SetEffect(unsigned char mode);
void SetCustom();
@ -80,7 +81,7 @@ public:
private:
char device_name[32];
unsigned int led_count;
unsigned char effect_mode;
unsigned char led_red[CORSAIR_PRO_LED_COUNT];
unsigned char led_green[CORSAIR_PRO_LED_COUNT];
unsigned char led_blue[CORSAIR_PRO_LED_COUNT];

@ -11,6 +11,40 @@
int RGBController_CorsairPro::GetMode()
{
switch (corsair->GetEffect())
{
case CORSAIR_PRO_MODE_COLOR_SHIFT:
return(0);
break;
case CORSAIR_PRO_MODE_COLOR_PULSE:
return(1);
break;
case CORSAIR_PRO_MODE_RAINBOW_WAVE:
return(2);
break;
case CORSAIR_PRO_MODE_COLOR_WAVE:
return(3);
break;
case CORSAIR_PRO_MODE_VISOR:
return(4);
break;
case CORSAIR_PRO_MODE_RAIN:
return(5);
break;
case CORSAIR_PRO_MODE_MARQUEE:
return(6);
break;
case CORSAIR_PRO_MODE_RAINBOW:
return(7);
break;
case CORSAIR_PRO_MODE_SEQUENTIAL:
return(8);
break;
case CORSAIR_PRO_MODE_STATIC:
return(9);
break;
}
return(0);
}

@ -64,6 +64,7 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
/*-----------------------------------------------------*\
| Fill in the combo boxes with device information |
\*-----------------------------------------------------*/
ui->ModeBox->blockSignals(true);
ui->ModeBox->clear();
for (std::size_t i = 0; i < device->modes.size(); i++)
@ -72,7 +73,9 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
}
ui->ModeBox->setCurrentIndex(device->GetMode());
ui->ModeBox->blockSignals(false);
ui->ZoneBox->blockSignals(true);
ui->ZoneBox->clear();
for (std::size_t i = 0; i < device->zones.size(); i++)
@ -81,7 +84,9 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
}
ui->ZoneBox->setCurrentIndex(0);
ui->ZoneBox->blockSignals(false);
ui->LEDBox->blockSignals(true);
ui->LEDBox->clear();
for (std::size_t i = 0; i < device->leds.size(); i++)
@ -90,6 +95,7 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
}
ui->LEDBox->setCurrentIndex(0);
ui->LEDBox->blockSignals(false);
/*-----------------------------------------------------*\
| Update color picker with color of first LED |

Loading…
Cancel
Save