Code cleanup and add files to OpenRGB.pro
This commit is contained in:
parent
ccb85b981d
commit
0cef992ae6
8 changed files with 253 additions and 509 deletions
|
|
@ -1,133 +1,110 @@
|
|||
#include "WushiL50USBController.h"
|
||||
#include "WushiDevicesL50.h"
|
||||
/*-------------------------------------*\
|
||||
| RGBController_WushiL50USB.cpp |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------*/
|
||||
|
||||
#include "RGBController_WushiL50USB.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#define WUSHI_L50_NUM_LEDS 4
|
||||
|
||||
RGBController_WushiL50USB::RGBController_WushiL50USB(WushiL50USBController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = controller->getName();
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
vendor = "Wushi";
|
||||
|
||||
location = controller->getLocation();
|
||||
version = controller->GetFirmwareVersion();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
description = "Wushi L50 device";
|
||||
name = controller->getName();
|
||||
type = DEVICE_TYPE_ACCESSORY;
|
||||
description = "Wushi L50 device";
|
||||
vendor = "Wushi";
|
||||
location = controller->getLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness_min = 1;
|
||||
Direct.brightness_max = 2;
|
||||
|
||||
Direct.name = "Direct";
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness_min = 1;
|
||||
Direct.brightness_max = 2;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Breath;
|
||||
Breath.name = "Breathing";
|
||||
Breath.flags = MODE_FLAG_HAS_RANDOM_COLOR| MODE_FLAG_HAS_SPEED;//MODE_FLAG_HAS_PER_LED_COLOR
|
||||
Breath.color_mode = MODE_COLORS_RANDOM;//;MODE_COLORS_PER_LED;//
|
||||
Breath.brightness_min = 1;
|
||||
Breath.brightness_max = 2;
|
||||
Breath.speed_min = 1;
|
||||
Breath.speed_max = 4;
|
||||
|
||||
Breath.name = "Breathing";
|
||||
Breath.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED;//MODE_FLAG_HAS_PER_LED_COLOR
|
||||
Breath.color_mode = MODE_COLORS_RANDOM;//;MODE_COLORS_PER_LED;//
|
||||
Breath.brightness_min = 1;
|
||||
Breath.brightness_max = 2;
|
||||
Breath.speed_min = 1;
|
||||
Breath.speed_max = 4;
|
||||
modes.push_back(Breath);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Rainbow Wave";
|
||||
Wave.flags = MODE_FLAG_HAS_RANDOM_COLOR |MODE_FLAG_HAS_SPEED |MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Wave.color_mode = MODE_COLORS_RANDOM;
|
||||
Wave.speed_min = 1;
|
||||
Wave.speed_max = 4;
|
||||
Wave.direction = MODE_DIRECTION_LEFT | MODE_DIRECTION_RIGHT;
|
||||
Wave.name = "Rainbow Wave";
|
||||
Wave.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Wave.color_mode = MODE_COLORS_RANDOM;
|
||||
Wave.speed_min = 1;
|
||||
Wave.speed_max = 4;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Smooth;
|
||||
Smooth.name = "Spectrum Cycle";
|
||||
Smooth.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Smooth.color_mode = MODE_COLORS_RANDOM;
|
||||
Smooth.brightness_min = 1;
|
||||
Smooth.brightness_max = 2;
|
||||
Smooth.speed_min = 1;
|
||||
Smooth.speed_max = 4;
|
||||
modes.push_back(Smooth); //添加mode列表
|
||||
Smooth.name = "Spectrum Cycle";
|
||||
Smooth.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Smooth.color_mode = MODE_COLORS_RANDOM;
|
||||
Smooth.brightness_min = 1;
|
||||
Smooth.brightness_max = 2;
|
||||
Smooth.speed_min = 1;
|
||||
Smooth.speed_max = 4;
|
||||
modes.push_back(Smooth);
|
||||
|
||||
mode Race;
|
||||
Race.name = "Race Cycle";
|
||||
Race.flags = MODE_FLAG_HAS_RANDOM_COLOR |MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_SPEED;
|
||||
Race.color_mode = MODE_COLORS_RANDOM;
|
||||
Race.brightness_min = 1;
|
||||
Race.brightness_max = 2;
|
||||
Race.speed_min = 1;
|
||||
Race.speed_max = 4;
|
||||
Race.direction = MODE_DIRECTION_LEFT | MODE_DIRECTION_RIGHT;
|
||||
modes.push_back(Race); //添加mode列表
|
||||
Race.name = "Race Cycle";
|
||||
Race.flags = MODE_FLAG_HAS_RANDOM_COLOR |MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_SPEED;
|
||||
Race.color_mode = MODE_COLORS_RANDOM;
|
||||
Race.brightness_min = 1;
|
||||
Race.brightness_max = 2;
|
||||
Race.speed_min = 1;
|
||||
Race.speed_max = 4;
|
||||
modes.push_back(Race);
|
||||
|
||||
mode Stack;
|
||||
Stack.name = "Stacking";
|
||||
Stack.flags = MODE_FLAG_HAS_RANDOM_COLOR |MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_SPEED| MODE_FLAG_HAS_BRIGHTNESS ;
|
||||
Stack.color_mode = MODE_COLORS_RANDOM;
|
||||
Stack.brightness_min = 1;
|
||||
Stack.brightness_max = 2;
|
||||
Stack.speed_min = 1;
|
||||
Stack.direction = MODE_DIRECTION_LEFT | MODE_DIRECTION_RIGHT;
|
||||
Stack.speed_max = 4;
|
||||
modes.push_back(Stack); //添加mode列表
|
||||
Stack.name = "Stacking";
|
||||
Stack.flags = MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Stack.color_mode = MODE_COLORS_RANDOM;
|
||||
Stack.brightness_min = 1;
|
||||
Stack.brightness_max = 2;
|
||||
Stack.speed_min = 1;
|
||||
Stack.speed_max = 4;
|
||||
modes.push_back(Stack);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.flags = MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Off.color_mode = MODE_COLORS_RANDOM;
|
||||
modes.push_back(Off); //添加mode列表
|
||||
Off.name = "Off";
|
||||
Off.flags = MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Off.color_mode = MODE_COLORS_RANDOM;
|
||||
modes.push_back(Off);
|
||||
|
||||
SetupZones();
|
||||
|
||||
// Reset colors to white
|
||||
for(unsigned int led_idx = 0; led_idx < WUSHI_L50_NUM_LEDS; led_idx++ )
|
||||
{
|
||||
colors[led_idx] = 0xFFFFFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
RGBController_WushiL50USB::~RGBController_WushiL50USB()
|
||||
{
|
||||
controller->setDeviceHardwareMode();
|
||||
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
new_zone.name = WUSHI_L50.name;
|
||||
new_zone.name = "Dock";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_count = WUSHI_L50_NUM_LEDS;
|
||||
new_zone.leds_max = new_zone.leds_count;
|
||||
new_zone.leds_min = new_zone.leds_count;
|
||||
|
||||
new_zone.matrix_map = NULL;
|
||||
|
||||
|
||||
zones.push_back(new_zone);
|
||||
|
||||
for(unsigned int led_idx = 0; led_idx < WUSHI_L50_NUM_LEDS; led_idx++ )
|
||||
{
|
||||
led new_led; //添加LEDZONE列表
|
||||
new_led.name = WUSHI_L50_leds[led_idx].name;
|
||||
new_led.value = WUSHI_L50_leds[led_idx].led_num;
|
||||
led new_led;
|
||||
new_led.name = "Dock Zone ";
|
||||
new_led.name.append(std::to_string(led_idx + 1));
|
||||
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
@ -141,18 +118,20 @@ void RGBController_WushiL50USB::ResizeZone(int /*zone*/, int /*new_size*/)
|
|||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_WushiL50USB::DeviceUpdateLEDs()
|
||||
{
|
||||
state.SetColors(colors);
|
||||
controller->setMode(&state);
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::DeviceUpdateLEDs()
|
||||
void RGBController_WushiL50USB::UpdateSingleLED(int /*led*/)
|
||||
{
|
||||
state.SetColors(colors);
|
||||
controller->setMode(state);
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::DeviceUpdateMode()
|
||||
|
|
@ -160,48 +139,66 @@ void RGBController_WushiL50USB::DeviceUpdateMode()
|
|||
state.Reset();
|
||||
state.SetColors(colors);
|
||||
|
||||
switch (active_mode)
|
||||
switch(active_mode)
|
||||
{
|
||||
case 0:
|
||||
state.effect = WUSHI_L50_EFFECT_STATIC;
|
||||
break;
|
||||
case 1:
|
||||
state.effect = WUSHI_L50_EFFECT_BREATH;
|
||||
break;
|
||||
case 2:
|
||||
state.effect = WUSHI_L50_EFFECT_WAVE;
|
||||
state.wave_ltr = modes[active_mode].direction?0:1;
|
||||
state.wave_rtl = modes[active_mode].direction?1:0;
|
||||
break;
|
||||
case 3:
|
||||
state.effect = WUSHI_L50_EFFECT_SMOOTH;
|
||||
break;
|
||||
case 4:
|
||||
state.effect = WUSHI_L50_EFFECT_RACE;
|
||||
state.wave_ltr = modes[active_mode].direction?0:1;
|
||||
state.wave_rtl = modes[active_mode].direction?1:0;
|
||||
break;
|
||||
case 5:
|
||||
state.effect = WUSHI_L50_EFFECT_STACK;
|
||||
state.wave_ltr = modes[active_mode].direction?0:1;
|
||||
state.wave_rtl = modes[active_mode].direction?1:0;
|
||||
break;
|
||||
case 6:
|
||||
state.effect = WUSHI_L50_EFFECT_STATIC;
|
||||
state.zone0_rgb[0] = 0;state.zone0_rgb[1] = 0;state.zone0_rgb[2] = 0;
|
||||
state.zone1_rgb[0] = 0;state.zone1_rgb[1] = 0;state.zone1_rgb[2] = 0;
|
||||
state.zone2_rgb[0] = 0;state.zone2_rgb[1] = 0;state.zone2_rgb[2] = 0;
|
||||
state.zone3_rgb[0] = 0;state.zone3_rgb[1] = 0;state.zone3_rgb[2] = 0;
|
||||
break;
|
||||
case 0:
|
||||
state.effect = WUSHI_L50_EFFECT_STATIC;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
state.effect = WUSHI_L50_EFFECT_BREATH;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
state.effect = WUSHI_L50_EFFECT_WAVE;
|
||||
state.wave_ltr = modes[active_mode].direction ? 0 : 1;
|
||||
state.wave_rtl = modes[active_mode].direction ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
state.effect = WUSHI_L50_EFFECT_SMOOTH;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
state.effect = WUSHI_L50_EFFECT_RACE;
|
||||
state.wave_ltr = modes[active_mode].direction ? 0 : 1;
|
||||
state.wave_rtl = modes[active_mode].direction ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
state.effect = WUSHI_L50_EFFECT_STACK;
|
||||
state.wave_ltr = modes[active_mode].direction ? 0 : 1;
|
||||
state.wave_rtl = modes[active_mode].direction ? 1 : 0;
|
||||
break;
|
||||
|
||||
case 6:
|
||||
state.effect = WUSHI_L50_EFFECT_STATIC;
|
||||
state.zone0_rgb[0] = 0;
|
||||
state.zone0_rgb[1] = 0;
|
||||
state.zone0_rgb[2] = 0;
|
||||
state.zone1_rgb[0] = 0;
|
||||
state.zone1_rgb[1] = 0;
|
||||
state.zone1_rgb[2] = 0;
|
||||
state.zone2_rgb[0] = 0;
|
||||
state.zone2_rgb[1] = 0;
|
||||
state.zone2_rgb[2] = 0;
|
||||
state.zone3_rgb[0] = 0;
|
||||
state.zone3_rgb[1] = 0;
|
||||
state.zone3_rgb[2] = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if(active_mode != (WUSHI_L50_EFFECT_STATIC - 1)) // mode number from 0, but in mode from 1
|
||||
/*---------------------------------------------------------*\
|
||||
| Mode number from 0, but in mode from 1 |
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode != (WUSHI_L50_EFFECT_STATIC - 1))
|
||||
{
|
||||
state.speed = modes[active_mode].speed;
|
||||
state.speed = modes[active_mode].speed;
|
||||
}
|
||||
state.brightness = modes[active_mode].brightness;
|
||||
|
||||
controller->setMode(state);
|
||||
state.brightness = modes[active_mode].brightness;
|
||||
|
||||
controller->setMode(&state);
|
||||
}
|
||||
|
||||
void RGBController_WushiL50USB::DeviceSaveMode()
|
||||
|
|
|
|||
|
|
@ -1,19 +1,16 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| RGBController_WushiL50USB.h |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------------------------------------*/
|
||||
/*-------------------------------------*\
|
||||
| RGBController_WushiL50USB.h |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "WushiDevices.h"
|
||||
#include "WushiL50USBController.h"
|
||||
#include "RGBController.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
|
||||
class RGBController_WushiL50USB : public RGBController
|
||||
{
|
||||
public:
|
||||
|
|
@ -31,7 +28,6 @@ public:
|
|||
void DeviceSaveMode();
|
||||
|
||||
private:
|
||||
KeyboardState state;
|
||||
|
||||
WushiL50USBController *controller;
|
||||
WushiL50USBController * controller;
|
||||
WushiL50State state;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
#include <string>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define NA 0xFFFFFFFF
|
||||
#ifndef wushiDEVICES_H
|
||||
#define wushiDEVICES_H
|
||||
/*-----------------------------------------------------*\
|
||||
| WUSHI product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define WF_S60 0x5678
|
||||
|
||||
struct Wushi_led
|
||||
{
|
||||
uint8_t led_num;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct Wushi_zone
|
||||
{
|
||||
std::string name;
|
||||
zone_type type;
|
||||
unsigned char id;
|
||||
unsigned int height;
|
||||
unsigned int width;
|
||||
const unsigned int* matrix_map;
|
||||
const Wushi_led* leds;
|
||||
unsigned int start; //index to start reading the list of leds
|
||||
unsigned int end; //end index
|
||||
};
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
| Additional LEDs for wf S60 |
|
||||
\*--------------------------------------------------------*/
|
||||
const Wushi_led wf_wf_S60_additional_leds[]
|
||||
{
|
||||
{0x86, "WUSHI_L50"}
|
||||
};
|
||||
|
||||
static const Wushi_zone WUSHI_L50 =
|
||||
{
|
||||
"LED Strip",
|
||||
ZONE_TYPE_LINEAR,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
NULL,
|
||||
wf_wf_S60_additional_leds,
|
||||
3,
|
||||
3,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,233 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "RGBController.h"
|
||||
#include "WushiDevices.h"
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| WUSHI product IDs |
|
||||
\*-----------------------------------------------------*/
|
||||
#define WU_S80 0x1234
|
||||
|
||||
enum WUSHI_L50_EFFECT
|
||||
{
|
||||
WUSHI_L50_EFFECT_STATIC = 1,
|
||||
WUSHI_L50_EFFECT_BREATH = 3,
|
||||
WUSHI_L50_EFFECT_WAVE = 4,
|
||||
WUSHI_L50_EFFECT_SMOOTH = 6,
|
||||
WUSHI_L50_EFFECT_RACE = 8,
|
||||
WUSHI_L50_EFFECT_STACK =10,
|
||||
};
|
||||
|
||||
enum WUSHI_L50_BRIGHTNESS
|
||||
{
|
||||
WUSHI_L50_BRIGHTNESS_LOW = 1,
|
||||
WUSHI_L50_BRIGHTNESS_HIGH = 2,
|
||||
};
|
||||
|
||||
enum WUSHI_L50_SPEED
|
||||
{
|
||||
WUSHI_L50_SPEED_SLOWEST = 1,
|
||||
WUSHI_L50_SPEED_SLOW = 2,
|
||||
WUSHI_L50_SPEED_FAST = 3,
|
||||
WUSHI_L50_SPEED_FASTEST = 4,
|
||||
};
|
||||
|
||||
enum WUSHI_L50_Direction
|
||||
{
|
||||
WUSHI_L50_Direction_LEFT = 1,
|
||||
WUSHI_L50_Direction_RIGHT = 2,
|
||||
};
|
||||
/// struct a USB packet for set the keyboard LEDs
|
||||
class KeyboardState
|
||||
{
|
||||
public:
|
||||
uint8_t header[2] = {0xCC, 0x16};
|
||||
uint8_t effect = WUSHI_L50_EFFECT_STATIC;
|
||||
uint8_t speed = WUSHI_L50_SPEED_SLOWEST;
|
||||
uint8_t brightness = WUSHI_L50_BRIGHTNESS_LOW;
|
||||
uint8_t zone0_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone1_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone2_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone3_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
|
||||
//uint8_t zone_rgb[50][3];
|
||||
/*uint8_t zone0_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone1_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone2_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone3_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone4_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone5_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone6_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone7_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone8_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone9_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone10_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone11_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone12_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone13_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone14_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone15_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone16_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone17_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone18_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone19_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone20_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone21_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone22_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone23_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone24_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone25_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone26_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone27_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone28_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone29_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone30_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
|
||||
uint8_t zone31_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone32_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone33_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone34_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone35_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone36_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone37_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone38_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone39_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone40_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone41_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone42_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone43_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone44_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone45_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone46_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone47_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone48_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone49_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone50_rgb[3] = {0xFF, 0xFF, 0xFF};*/
|
||||
uint8_t padding = 0;
|
||||
uint8_t wave_ltr = 0;
|
||||
uint8_t wave_rtl = 0;
|
||||
uint8_t unused[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
void Reset()
|
||||
{
|
||||
header[0] = 0xCC, header[1] = 0x16;
|
||||
effect = WUSHI_L50_EFFECT_STATIC;
|
||||
speed = WUSHI_L50_SPEED_SLOWEST;
|
||||
brightness = WUSHI_L50_BRIGHTNESS_LOW;
|
||||
//zone0_rgb[0] = 0xFF, zone0_rgb[1] = 0xFF, zone0_rgb[2] = 0xFF;
|
||||
//zone1_rgb[0] = 0xFF, zone1_rgb[1] = 0xFF, zone1_rgb[2] = 0xFF;
|
||||
//zone2_rgb[0] = 0xFF, zone2_rgb[1] = 0xFF, zone2_rgb[2] = 0xFF;
|
||||
//zone3_rgb[0] = 0xFF, zone3_rgb[1] = 0xFF, zone3_rgb[2] = 0xFF;
|
||||
padding = 0;
|
||||
wave_ltr = 0;
|
||||
wave_rtl = 0;
|
||||
for(int i = 0; i < 13; ++i)
|
||||
{
|
||||
unused[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SetColors(std::vector<RGBColor> group_colors)
|
||||
{
|
||||
zone0_rgb[0] = RGBGetRValue(group_colors[0]);
|
||||
zone0_rgb[1] = RGBGetGValue(group_colors[0]);
|
||||
zone0_rgb[2] = RGBGetBValue(group_colors[0]);
|
||||
zone1_rgb[0] = RGBGetRValue(group_colors[1]);
|
||||
zone1_rgb[1] = RGBGetGValue(group_colors[1]);
|
||||
zone1_rgb[2] = RGBGetBValue(group_colors[1]);
|
||||
zone2_rgb[0] = RGBGetRValue(group_colors[2]);
|
||||
zone2_rgb[1] = RGBGetGValue(group_colors[2]);
|
||||
zone2_rgb[2] = RGBGetBValue(group_colors[2]);
|
||||
zone3_rgb[0] = RGBGetRValue(group_colors[3]);
|
||||
zone3_rgb[1] = RGBGetGValue(group_colors[3]);
|
||||
zone3_rgb[2] = RGBGetBValue(group_colors[3]);
|
||||
|
||||
//zone_rgb[0][0]=0x12;zone_rgb[0][1]=0x34;zone_rgb[0][2]=0x56;
|
||||
//zone_rgb[1][0]=0x78;zone_rgb[1][1]=0x90;zone_rgb[1][2]=0x12;
|
||||
/*for(uint8_t zone=0;zone<50;zone++)
|
||||
{
|
||||
//for(uint8_t rgb_idx=0;rgb_idx<3;rgb_idx++)
|
||||
zone_rgb[zone][0] = RGBGetRValue(group_colors[zone]);
|
||||
zone_rgb[zone][1] = RGBGetGValue(group_colors[zone]);
|
||||
zone_rgb[zone][2] = RGBGetBValue(group_colors[zone]);
|
||||
}*/
|
||||
wave_rtl = 0;
|
||||
}
|
||||
};
|
||||
|
||||
/*-------------------------*\
|
||||
| L50 keyboard |
|
||||
\*-------------------------*/
|
||||
|
||||
static const Wushi_led WUSHI_L50_leds[]
|
||||
{
|
||||
{0x00, "Zone 1"},
|
||||
{0x01, "Zone 2"},
|
||||
{0x02, "Zone 3"},
|
||||
{0x03, "Zone 4"},
|
||||
/* {0x00, "Pixel 1"},
|
||||
{0x01, "Pixel 2"},
|
||||
{0x02, "Pixel 3"},
|
||||
{0x03, "Pixel 4"},
|
||||
{0x04, "Pixel 5"},
|
||||
{0x05, "Pixel 6"},
|
||||
{0x06, "Pixel 7"},
|
||||
{0x07, "Pixel 8"},
|
||||
{0x08, "Pixel 9"},
|
||||
{0x09, "Pixel 10"},
|
||||
{10, "Pixel 11"},
|
||||
{11, "Pixel 12"},
|
||||
|
||||
{12, "Pixel 13"},
|
||||
{13, "Pixel 14"},
|
||||
{14, "Pixel 15"},
|
||||
{15, "Pixel 16"},
|
||||
|
||||
{16, "Pixel 17"},
|
||||
{17, "Pixel 18"},
|
||||
{18, "Pixel 19"},
|
||||
{19, "Pixel 20"},
|
||||
|
||||
{20, "Pixel 21"},
|
||||
{21, "Pixel 22"},
|
||||
{22, "Pixel 23"},
|
||||
{23, "Pixel 24"},
|
||||
|
||||
{24, "Pixel 25"},
|
||||
{25, "Pixel 26"},
|
||||
{26, "Pixel 27"},
|
||||
{27, "Pixel 28"},
|
||||
|
||||
{28, "Pixel 29"},
|
||||
{29, "Pixel 30"},
|
||||
{30, "Pixel 31"},
|
||||
{31, "Pixel 32"},
|
||||
|
||||
{32, "Pixel 33"},
|
||||
{33, "Pixel 34"},
|
||||
{34, "Pixel 35"},
|
||||
{35, "Pixel 36"},
|
||||
|
||||
{36, "Pixel 37"},
|
||||
{37, "Pixel 38"},
|
||||
{38, "Pixel 39"},
|
||||
{39, "Pixel 40"},
|
||||
|
||||
{40, "Pixel 41"},
|
||||
{41, "Pixel 42"},
|
||||
{42, "Pixel 43"},
|
||||
{43, "Pixel 44"},
|
||||
|
||||
|
||||
{44, "Pixel 45"},
|
||||
{45, "Pixel 46"},
|
||||
{46, "Pixel 47"},
|
||||
{47, "Pixel 48"},
|
||||
|
||||
{48, "Pixel 49"},
|
||||
{49, "Pixel 50"},*/
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,23 +1,18 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| WushiL50USBController.cpp |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------------------------------------*/
|
||||
/*-------------------------------------*\
|
||||
| WushiL50USBController.h |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------*/
|
||||
|
||||
#include <iostream>
|
||||
#include "WushiL50USBController.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
WushiL50USBController::WushiL50USBController(hid_device* dev_handle, const char* path, uint16_t in_pid)
|
||||
WushiL50USBController::WushiL50USBController(hid_device* dev_handle, const char* path)
|
||||
{
|
||||
const uint8_t sz = HID_MAX_STR;
|
||||
wchar_t tmp[sz];
|
||||
wchar_t serial_string[128];
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
pid = in_pid;
|
||||
|
||||
|
||||
|
||||
hid_get_manufacturer_string(dev, tmp, sz);
|
||||
std::wstring w_tmp = std::wstring(tmp);
|
||||
|
|
@ -38,8 +33,6 @@ WushiL50USBController::WushiL50USBController(hid_device* dev_handle, const char*
|
|||
std::wstring return_wstring = tmp;//serial_string;
|
||||
serial_number = std::string(return_wstring.begin(), return_wstring.end());
|
||||
}
|
||||
version ="0.10"; //
|
||||
setDeviceSoftwareMode();
|
||||
}
|
||||
|
||||
WushiL50USBController::~WushiL50USBController()
|
||||
|
|
@ -47,16 +40,9 @@ WushiL50USBController::~WushiL50USBController()
|
|||
hid_close(dev);
|
||||
}
|
||||
|
||||
void WushiL50USBController::setMode(const KeyboardState &in_mode)
|
||||
void WushiL50USBController::setMode(WushiL50State * in_mode)
|
||||
{
|
||||
uint8_t buffer[WUSHIL50_HID_PACKET_SIZE];
|
||||
memcpy(buffer, &in_mode, WUSHIL50_HID_PACKET_SIZE);
|
||||
hid_send_feature_report(dev, buffer, WUSHIL50_HID_PACKET_SIZE);
|
||||
}
|
||||
|
||||
uint16_t WushiL50USBController::getPid()
|
||||
{
|
||||
return pid;
|
||||
hid_send_feature_report(dev, (uint8_t *)in_mode, WUSHI_L50_HID_PACKET_SIZE);
|
||||
}
|
||||
|
||||
std::string WushiL50USBController::getName()
|
||||
|
|
@ -73,18 +59,3 @@ std::string WushiL50USBController::GetSerialString()
|
|||
{
|
||||
return(serial_number);
|
||||
}
|
||||
|
||||
std::string WushiL50USBController::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
void WushiL50USBController::setDeviceSoftwareMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WushiL50USBController::setDeviceHardwareMode()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,63 +1,120 @@
|
|||
/*-------------------------------------------------------------------*\
|
||||
| WushiL50USBController.h |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------------------------------------*/
|
||||
/*-------------------------------------*\
|
||||
| WushiL50USBController.h |
|
||||
| |
|
||||
| interface for Wushi L50 Devices |
|
||||
\*-------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "LogManager.h"
|
||||
#include "WushiDevicesL50.h"
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#ifndef HID_MAX_STR
|
||||
#define HID_MAX_STR 255
|
||||
#define HID_MAX_STR 255
|
||||
#endif
|
||||
|
||||
#define WUSHIL50_HID_PACKET_SIZE 33
|
||||
#define WUSHI_L50_HID_PACKET_SIZE 33
|
||||
#define WUSHI_L50_NUM_LEDS 4
|
||||
|
||||
enum WUSHI_L50_EFFECT
|
||||
{
|
||||
WUSHI_L50_EFFECT_STATIC = 1, /* Static mode */
|
||||
WUSHI_L50_EFFECT_BREATH = 3, /* Breathing mode */
|
||||
WUSHI_L50_EFFECT_WAVE = 4, /* Wave mode */
|
||||
WUSHI_L50_EFFECT_SMOOTH = 6, /* Smooth mode */
|
||||
WUSHI_L50_EFFECT_RACE = 8, /* Race mode */
|
||||
WUSHI_L50_EFFECT_STACK = 10, /* Stack mode */
|
||||
};
|
||||
|
||||
enum WUSHI_L50_BRIGHTNESS
|
||||
{
|
||||
WUSHI_L50_BRIGHTNESS_LOW = 1, /* Low brightness */
|
||||
WUSHI_L50_BRIGHTNESS_HIGH = 2, /* High brightness */
|
||||
};
|
||||
|
||||
enum WUSHI_L50_SPEED
|
||||
{
|
||||
WUSHI_L50_SPEED_SLOWEST = 1, /* Slowest speed */
|
||||
WUSHI_L50_SPEED_SLOW = 2, /* Slow speed */
|
||||
WUSHI_L50_SPEED_FAST = 3, /* Fast speed */
|
||||
WUSHI_L50_SPEED_FASTEST = 4, /* Fastest speed */
|
||||
};
|
||||
|
||||
enum WUSHI_L50_Direction
|
||||
{
|
||||
WUSHI_L50_Direction_LEFT = 1, /* Left direction */
|
||||
WUSHI_L50_Direction_RIGHT = 2, /* Right direction */
|
||||
};
|
||||
|
||||
class WushiL50State
|
||||
{
|
||||
public:
|
||||
uint8_t header[2] = {0xCC, 0x16};
|
||||
uint8_t effect = WUSHI_L50_EFFECT_STATIC;
|
||||
uint8_t speed = WUSHI_L50_SPEED_SLOWEST;
|
||||
uint8_t brightness = WUSHI_L50_BRIGHTNESS_LOW;
|
||||
uint8_t zone0_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone1_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone2_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t zone3_rgb[3] = {0xFF, 0xFF, 0xFF};
|
||||
uint8_t padding = 0;
|
||||
uint8_t wave_ltr = 0;
|
||||
uint8_t wave_rtl = 0;
|
||||
uint8_t unused[13] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
|
||||
void Reset()
|
||||
{
|
||||
header[0] = 0xCC;
|
||||
header[1] = 0x16;
|
||||
effect = WUSHI_L50_EFFECT_STATIC;
|
||||
speed = WUSHI_L50_SPEED_SLOWEST;
|
||||
brightness = WUSHI_L50_BRIGHTNESS_LOW;
|
||||
padding = 0;
|
||||
wave_ltr = 0;
|
||||
wave_rtl = 0;
|
||||
|
||||
for(int i = 0; i < 13; ++i)
|
||||
{
|
||||
unused[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void SetColors(std::vector<RGBColor> group_colors)
|
||||
{
|
||||
zone0_rgb[0] = RGBGetRValue(group_colors[0]);
|
||||
zone0_rgb[1] = RGBGetGValue(group_colors[0]);
|
||||
zone0_rgb[2] = RGBGetBValue(group_colors[0]);
|
||||
zone1_rgb[0] = RGBGetRValue(group_colors[1]);
|
||||
zone1_rgb[1] = RGBGetGValue(group_colors[1]);
|
||||
zone1_rgb[2] = RGBGetBValue(group_colors[1]);
|
||||
zone2_rgb[0] = RGBGetRValue(group_colors[2]);
|
||||
zone2_rgb[1] = RGBGetGValue(group_colors[2]);
|
||||
zone2_rgb[2] = RGBGetBValue(group_colors[2]);
|
||||
zone3_rgb[0] = RGBGetRValue(group_colors[3]);
|
||||
zone3_rgb[1] = RGBGetGValue(group_colors[3]);
|
||||
zone3_rgb[2] = RGBGetBValue(group_colors[3]);
|
||||
|
||||
wave_rtl = 0;
|
||||
}
|
||||
};
|
||||
|
||||
class WushiL50USBController
|
||||
{
|
||||
public:
|
||||
/*--------------*\
|
||||
|ctor(s) and dtor|
|
||||
\*--------------*/
|
||||
WushiL50USBController(hid_device* dev_handle, const char* path, uint16_t in_pid);
|
||||
public:
|
||||
WushiL50USBController(hid_device* dev_handle, const char* path);
|
||||
~WushiL50USBController();
|
||||
|
||||
void setMode(const KeyboardState &in_mode);
|
||||
void setMode(WushiL50State * in_mode);
|
||||
|
||||
/*--------------*\
|
||||
|device functions|
|
||||
\*--------------*/
|
||||
uint16_t getPid();
|
||||
std::string getName();
|
||||
std::string getLocation();
|
||||
std::string GetSerialString();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
void setDeviceSoftwareMode();
|
||||
void setDeviceHardwareMode();
|
||||
|
||||
private:
|
||||
/*--------------*\
|
||||
|data members |
|
||||
\*--------------*/
|
||||
std::string name;
|
||||
hid_device *dev;
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
uint16_t pid;
|
||||
KeyboardState mode;
|
||||
std::string version;
|
||||
/*--------------*\
|
||||
|device functions|
|
||||
\*--------------*/
|
||||
void sendBasicInstruction(uint8_t instruction);
|
||||
private:
|
||||
std::string name;
|
||||
hid_device * dev;
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,17 +1,19 @@
|
|||
|
||||
|
||||
#include "Detector.h"
|
||||
#include "LogManager.h"
|
||||
#include "RGBController.h"
|
||||
#include "WushiL50USBController.h"
|
||||
#include "WushiDevicesL50.h"
|
||||
#include "RGBController_WushiL50USB.h"
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| vendor IDs |
|
||||
| Wushi vendor ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define WUSHI_VID 0x306F
|
||||
#define WUSHI_VID 0x306F
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Wushi device ID |
|
||||
\*-----------------------------------------------------*/
|
||||
#define WUSHI_PID 0x1234
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Interface, Usage, and Usage Page |
|
||||
|
|
@ -26,14 +28,14 @@ void DetectWushiL50USBControllers(hid_device_info* info, const std::string& name
|
|||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev) //WushiL50USBController
|
||||
if(dev)
|
||||
{
|
||||
WushiL50USBController* controller = new WushiL50USBController(dev, info->path, info->product_id);
|
||||
WushiL50USBController* controller = new WushiL50USBController(dev, info->path);
|
||||
RGBController_WushiL50USB* rgb_controller = new RGBController_WushiL50USB(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_PU("JSAUX RGB Docking Station", DetectWushiL50USBControllers, WUSHI_VID, WU_S80, WUSHI_PAGE, WUSHI_USAGE);
|
||||
REGISTER_HID_DETECTOR_PU("JSAUX RGB Docking Station", DetectWushiL50USBControllers, WUSHI_VID, WUSHI_PID, WUSHI_PAGE, WUSHI_USAGE);
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@ INCLUDEPATH +=
|
|||
Controllers/ThermaltakeRiingController/ \
|
||||
Controllers/ViewSonicController/ \
|
||||
Controllers/WootingKeyboardController/ \
|
||||
Controllers/WushiController/ \
|
||||
Controllers/YeelightController/ \
|
||||
Controllers/ZalmanZSyncController/ \
|
||||
Controllers/ZotacTuringGPUController/ \
|
||||
|
|
@ -708,6 +709,8 @@ HEADERS +=
|
|||
Controllers/WootingKeyboardController/WootingOneKeyboardController.h \
|
||||
Controllers/WootingKeyboardController/WootingTwoKeyboardController.h \
|
||||
Controllers/WootingKeyboardController/RGBController_WootingKeyboard.h \
|
||||
Controllers/WushiController/WushiL50USBController.h \
|
||||
Controllers/WushiController/RGBController_WushiL50USB.h \
|
||||
Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiingQuad.h \
|
||||
Controllers/YeelightController/YeelightController.h \
|
||||
Controllers/YeelightController/RGBController_Yeelight.h \
|
||||
|
|
@ -1384,6 +1387,9 @@ SOURCES +=
|
|||
Controllers/WootingKeyboardController/WootingOneKeyboardController.cpp \
|
||||
Controllers/WootingKeyboardController/WootingTwoKeyboardController.cpp \
|
||||
Controllers/WootingKeyboardController/RGBController_WootingKeyboard.cpp \
|
||||
Controllers/WushiController/WushiL50USBController.cpp \
|
||||
Controllers/WushiController/WushiL50USBDetect.cpp \
|
||||
Controllers/WushiController/RGBController_WushiL50USB.cpp \
|
||||
Controllers/ThermaltakeRiingController/RGBController_ThermaltakeRiingQuad.cpp \
|
||||
Controllers/YeelightController/YeelightController.cpp \
|
||||
Controllers/YeelightController/YeelightControllerDetect.cpp \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue