Added most modes in

This commit is contained in:
crashniels
2020-06-02 19:49:00 +02:00
committed by Adam Honse
parent 8e62be0b9e
commit a34d0f93a3
3 changed files with 268 additions and 11 deletions

View File

@@ -16,6 +16,10 @@ GloriousModelOController::GloriousModelOController(libusb_device_handle* dev_han
strcpy(device_name, "Glorious Mouse");
led_count = 1;
current_mode = GLORIOUS_MODE_STATIC;
current_speed = GLORIOUS_SPEED_NORMAL;
current_direction = GLORIOUS_DIRECTION_UP;
}
GloriousModelOController::~GloriousModelOController()
@@ -46,7 +50,7 @@ void GloriousModelOController::SetLEDColor(unsigned char red, unsigned char gree
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x41, 0x01, 0x40, 0xff, 0xff, 0xff, //RGB, Brightness, Mode 0x42 - 4 =>
0x00, 0x02, 0x41, 0x01, 0x40, 0xff, 0xff, 0xff,
0x42, 0x07, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x43,
@@ -107,21 +111,136 @@ void GloriousModelOController::SetLEDColor(unsigned char red, unsigned char gree
0x00, 0x00, 0x00, 0x00
};
//usb_buf[0x37] = GLORIOUS_MODE_STATIC;
//usb_buf[0x38] = 0x40;
usb_buf[0x0B] = 0x24;
usb_buf[0x35] = GLORIOUS_MODE_STATIC;
usb_buf[0x38] = 0x40; //max brightness
usb_buf[0x39] = red;
usb_buf[0x3A] = blue;
usb_buf[0x3B] = green;
//DPI Button
/*
usb_buf[0x0B] = 0x44; //third DPI
usb_buf[0x26] = red;
usb_buf[0x27] = blue;
usb_buf[0x28] = green;
*/
libusb_control_transfer(dev, 0x21, 0x09, 0x0304, 0x0001, usb_buf, 520, 0);
}
void GloriousModelOController::SetMode(unsigned char /*mode*/)
void GloriousModelOController::SetMode(unsigned char mode, unsigned char speed, unsigned char direction)
{
//unsigned char usb_buf[520];
unsigned char usb_buf[520] =
{
0x04, 0x11, 0x00, 0x7b,
0x00, 0x00, 0x00, 0x00, 0x64, 0x06, 0x04, 0x24,
0xf0, 0x03, 0x07, 0x0f, 0x1f, 0x31, 0x63, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff,
0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff,
0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x02, 0x41, 0x01, 0x40, 0xff, 0xff, 0xff,
0x42, 0x07, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00,
0x00, 0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff,
0x00, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, 0x43,
0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x42, 0xff, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
0x42, 0x02, 0xff, 0x00, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
//usb_buf[0x37] = mode;
usb_buf[0x35] = mode;
switch (mode)
{
case GLORIOUS_MODE_OFF:
usb_buf[0x81] = 0x00; //mode 0 either 0x00 or 0x03
break;
case GLORIOUS_MODE_RAINBOW:
usb_buf[0x36] = speed;
usb_buf[0x37] = direction;
break;
case GLORIOUS_MODE_SPECTRUM_BREATING:
//colours not yet researched
break;
case GLORIOUS_MODE_CHASE:
usb_buf[0x53] = speed; //Speed for mode 4
break;
case GLORIOUS_MODE_SPECTRUM_CYCLE:
usb_buf[0x54] = speed; //Speed for mode 1,2,5
break;
case GLORIOUS_MODE_FLASHING:
usb_buf[0x74] = speed; //Speed for mode 7
usb_buf[0x75] = 0xff; //mode 7 red 1
usb_buf[0x76] = 0x00; //mode 7 blue 1
usb_buf[0x77] = 0x00; //mode 7 green 1
usb_buf[0x78] = 0x00; //mode 7 red 2
usb_buf[0x79] = 0x00; //mode 7 blue 2
usb_buf[0x7A] = 0xff; //mode 7 green 2
break;
case GLORIOUS_MODE_SLOW_RAINBOW:
usb_buf[0x7C] = speed; //Speed for mode 9
break;
case GLORIOUS_MODE_BREATHING:
usb_buf[0x7D] = speed;
usb_buf[0x7E] = 0x00; //mode 0a red
usb_buf[0x7F] = 0x00; //mode 0a blue
usb_buf[0x80] = 0xff; //mode 0a green
default:
break;
}
//libusb_control_transfer(dev, 0x21, 0x09, 0x0304, 0x0001, usb_buf, 520, 0);
libusb_control_transfer(dev, 0x21, 0x09, 0x0304, 0x0001, usb_buf, 520, 0);
}