mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-06 14:17:53 -05:00
Pull in OpenRazer improvements to OpenRazerWindows and fix some minor issues with OpenRazer controller code for both platforms
This commit is contained in:
@@ -288,7 +288,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
|
||||
modes.push_back(Breathing);
|
||||
}
|
||||
|
||||
if(matrix_effect_spectrum|| logo_matrix_effect_spectrum || scroll_matrix_effect_spectrum)
|
||||
if(matrix_effect_spectrum || logo_matrix_effect_spectrum || scroll_matrix_effect_spectrum)
|
||||
{
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
@@ -412,26 +412,26 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
break;
|
||||
|
||||
case RAZER_MODE_STATIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
matrix_effect_static.write(update_value, 3);
|
||||
matrix_effect_static.flush();
|
||||
break;
|
||||
|
||||
case RAZER_MODE_BREATHING:
|
||||
switch(modes[RAZER_MODE_BREATHING].color_mode)
|
||||
switch(modes[active_mode].color_mode)
|
||||
{
|
||||
case MODE_COLORS_MODE_SPECIFIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[RAZER_MODE_BREATHING].colors.size() == 2)
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
update_value[3] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
|
||||
matrix_effect_breath.write(update_value, 6);
|
||||
matrix_effect_breath.flush();
|
||||
@@ -477,9 +477,10 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_TYPE_NOMATRIX:
|
||||
{
|
||||
switch(active_mode)
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case RAZER_MODE_CUSTOM:
|
||||
matrix_effect_custom.write(update_value, 1);
|
||||
@@ -494,9 +495,9 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
break;
|
||||
|
||||
case RAZER_MODE_STATIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
logo_matrix_effect_static.write(update_value, 3);
|
||||
logo_matrix_effect_static.flush();
|
||||
scroll_matrix_effect_static.write(update_value, 3);
|
||||
@@ -504,18 +505,18 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
break;
|
||||
|
||||
case RAZER_MODE_BREATHING:
|
||||
switch(modes[RAZER_MODE_BREATHING].color_mode)
|
||||
switch(modes[active_mode].color_mode)
|
||||
{
|
||||
case MODE_COLORS_MODE_SPECIFIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[RAZER_MODE_BREATHING].colors.size() == 2)
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
update_value[3] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
|
||||
logo_matrix_effect_breath.write(update_value, 6);
|
||||
logo_matrix_effect_breath.flush();
|
||||
@@ -532,8 +533,10 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
break;
|
||||
|
||||
case MODE_COLORS_RANDOM:
|
||||
matrix_effect_breath.write(update_value, 1);
|
||||
matrix_effect_breath.flush();
|
||||
logo_matrix_effect_breath.write(update_value, 1);
|
||||
logo_matrix_effect_breath.flush();
|
||||
scroll_matrix_effect_breath.write(update_value, 1);
|
||||
scroll_matrix_effect_breath.flush();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -222,7 +222,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_f
|
||||
modes.push_back(Custom);
|
||||
}
|
||||
|
||||
if(razer_functions->matrix_effect_none)
|
||||
if(razer_functions->matrix_effect_none || razer_functions->logo_matrix_effect_none || razer_functions->scroll_matrix_effect_none)
|
||||
{
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
@@ -232,7 +232,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_f
|
||||
modes.push_back(Off);
|
||||
}
|
||||
|
||||
if(razer_functions->matrix_effect_static)
|
||||
if(razer_functions->matrix_effect_static || razer_functions->logo_matrix_effect_static || razer_functions->scroll_matrix_effect_static)
|
||||
{
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
@@ -245,7 +245,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_f
|
||||
modes.push_back(Static);
|
||||
}
|
||||
|
||||
if(razer_functions->matrix_effect_breath)
|
||||
if(razer_functions->matrix_effect_breath || razer_functions->logo_matrix_effect_breath || razer_functions->scroll_matrix_effect_breath)
|
||||
{
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
@@ -258,7 +258,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_f
|
||||
modes.push_back(Breathing);
|
||||
}
|
||||
|
||||
if(razer_functions->matrix_effect_spectrum)
|
||||
if(razer_functions->matrix_effect_spectrum || razer_functions->logo_matrix_effect_spectrum || razer_functions->scroll_matrix_effect_spectrum)
|
||||
{
|
||||
mode SpectrumCycle;
|
||||
SpectrumCycle.name = "Spectrum Cycle";
|
||||
@@ -279,7 +279,7 @@ RGBController_OpenRazer::RGBController_OpenRazer(device * razer_device, device_f
|
||||
modes.push_back(Wave);
|
||||
}
|
||||
|
||||
if(razer_functions->matrix_effect_reactive)
|
||||
if(razer_functions->matrix_effect_reactive || razer_functions->logo_matrix_effect_reactive || razer_functions->scroll_matrix_effect_reactive)
|
||||
{
|
||||
mode Reactive;
|
||||
Reactive.name = "Reactive";
|
||||
@@ -381,25 +381,25 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
break;
|
||||
|
||||
case RAZER_MODE_STATIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_STATIC].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
razer_functions->matrix_effect_static->store(razer_device, NULL, update_value, 3);
|
||||
break;
|
||||
|
||||
case RAZER_MODE_BREATHING:
|
||||
switch(modes[RAZER_MODE_BREATHING].color_mode)
|
||||
switch(modes[active_mode].color_mode)
|
||||
{
|
||||
case MODE_COLORS_MODE_SPECIFIC:
|
||||
update_value[0] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[0]);
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[RAZER_MODE_BREATHING].colors.size() == 2)
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
update_value[3] = RGBGetRValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[RAZER_MODE_BREATHING].colors[1]);
|
||||
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
|
||||
razer_functions->matrix_effect_breath->store(razer_device, NULL, update_value, 6);
|
||||
}
|
||||
@@ -439,28 +439,71 @@ void RGBController_OpenRazer::UpdateMode()
|
||||
}
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
|
||||
case RAZER_TYPE_NOMATRIX:
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case RAZER_MODE_CUSTOM:
|
||||
update_value = 0;
|
||||
logo_led_effect.write(&update_value, 1);
|
||||
scroll_led_effect.write(&update_value, 1);
|
||||
logo_led_effect.flush();
|
||||
scroll_led_effect.flush();
|
||||
razer_functions->matrix_effect_custom->store(razer_device, NULL, update_value, 1);
|
||||
break;
|
||||
|
||||
case RAZER_MODE_OFF:
|
||||
razer_functions->logo_matrix_effect_none->store(razer_device, NULL, update_value, 1);
|
||||
razer_functions->scroll_matrix_effect_none->store(razer_device, NULL, update_value, 1);
|
||||
break;
|
||||
|
||||
case RAZER_MODE_STATIC:
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
razer_functions->logo_matrix_effect_static->store(razer_device, NULL, update_value, 3);
|
||||
razer_functions->scroll_matrix_effect_static->store(razer_device, NULL, update_value, 3);
|
||||
break;
|
||||
|
||||
case RAZER_MODE_BREATHING:
|
||||
switch(modes[active_mode].color_mode)
|
||||
{
|
||||
case MODE_COLORS_MODE_SPECIFIC:
|
||||
update_value[0] = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
update_value[1] = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
update_value[2] = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
|
||||
if(modes[active_mode].colors.size() == 2)
|
||||
{
|
||||
update_value[3] = RGBGetRValue(modes[active_mode].colors[1]);
|
||||
update_value[4] = RGBGetGValue(modes[active_mode].colors[1]);
|
||||
update_value[5] = RGBGetBValue(modes[active_mode].colors[1]);
|
||||
|
||||
razer_functions->logo_matrix_effect_breath->store(razer_device, NULL, update_value, 6);
|
||||
razer_functions->scroll_matrix_effect_breath->store(razer_device, NULL, update_value, 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
razer_functions->logo_matrix_effect_breath->store(razer_device, NULL, update_value, 3);
|
||||
razer_functions->scroll_matrix_effect_breath->store(razer_device, NULL, update_value, 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case MODE_COLORS_RANDOM:
|
||||
razer_functions->logo_matrix_effect_breath->store(razer_device, NULL, update_value, 1);
|
||||
razer_functions->scroll_matrix_effect_breath->store(razer_device, NULL, update_value, 1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RAZER_MODE_SPECTRUM_CYCLE:
|
||||
update_value = '4';
|
||||
logo_led_effect.write(&update_value, 1);
|
||||
scroll_led_effect.write(&update_value, 1);
|
||||
logo_led_effect.flush();
|
||||
scroll_led_effect.flush();
|
||||
razer_functions->logo_matrix_effect_spectrum->store(razer_device, NULL, update_value, 1);
|
||||
razer_functions->scroll_matrix_effect_spectrum->store(razer_device, NULL, update_value, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
case RAZER_MODE_REACTIVE:
|
||||
razer_functions->logo_matrix_effect_reactive->store(razer_device, NULL, update_value, 1);
|
||||
razer_functions->scroll_matrix_effect_reactive->store(razer_device, NULL, update_value, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,14 @@ typedef struct
|
||||
struct device_attribute * logo_led_brightness;
|
||||
struct device_attribute * logo_matrix_effect_none;
|
||||
struct device_attribute * logo_matrix_effect_static;
|
||||
struct device_attribute * logo_matrix_effect_breath;
|
||||
struct device_attribute * logo_matrix_effect_spectrum;
|
||||
struct device_attribute * logo_matrix_effect_reactive;
|
||||
|
||||
struct device_attribute * scroll_led_brightness;
|
||||
struct device_attribute * scroll_matrix_effect_none;
|
||||
struct device_attribute * scroll_matrix_effect_static;
|
||||
struct device_attribute * scroll_matrix_effect_breath;
|
||||
struct device_attribute * scroll_matrix_effect_spectrum;
|
||||
struct device_attribute * scroll_matrix_effect_reactive;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user