diff --git a/Controllers/LogitechController/LogitechG203Controller.cpp b/Controllers/LogitechController/LogitechG203Controller.cpp index 26197285..5a3d87c2 100644 --- a/Controllers/LogitechController/LogitechG203Controller.cpp +++ b/Controllers/LogitechController/LogitechG203Controller.cpp @@ -23,7 +23,7 @@ LogitechG203Controller::LogitechG203Controller(hid_device* dev_handle) void LogitechG203Controller::SendMouseMode ( unsigned char mode, - unsigned char speed, + unsigned short speed, unsigned char red, unsigned char green, unsigned char blue @@ -51,6 +51,20 @@ void LogitechG203Controller::SendMouseMode usb_buf[0x07] = green; usb_buf[0x08] = blue; + speed = 1000 + 4750 * (LOGITECH_G203_SPEED_FASTEST - speed); + if(mode == LOGITECH_G203_MODE_CYCLE) + { + usb_buf[0x0B] = speed >> 8; + usb_buf[0x0C] = speed & 0xFF; + usb_buf[0x0D] = 0x64; + } + else if(mode == LOGITECH_G203_MODE_BREATHING) + { + usb_buf[0x09] = speed >> 8; + usb_buf[0x0A] = speed & 0xFF; + usb_buf[0x0C] = 0x64; + } + /*-----------------------------------------------------*\ | Send packet | \*-----------------------------------------------------*/ diff --git a/Controllers/LogitechController/LogitechG203Controller.h b/Controllers/LogitechController/LogitechG203Controller.h index 231dd4ee..883c8a0b 100644 --- a/Controllers/LogitechController/LogitechG203Controller.h +++ b/Controllers/LogitechController/LogitechG203Controller.h @@ -22,6 +22,15 @@ enum LOGITECH_G203_MODE_BREATHING = 0x03, }; +enum +{ + LOGITECH_G203_SPEED_SLOWEST = 0x00, /* Slowest speed */ + LOGITECH_G203_SPEED_SLOW = 0x01, /* Slow speed */ + LOGITECH_G203_SPEED_NORMAL = 0x02, /* Normal speed */ + LOGITECH_G203_SPEED_FAST = 0x03, /* Fast speed */ + LOGITECH_G203_SPEED_FASTEST = 0x04, /* Fastest speed */ +}; + class LogitechG203Controller { public: @@ -31,7 +40,7 @@ public: void SendMouseMode ( unsigned char mode, - unsigned char speed, + unsigned short speed, unsigned char red, unsigned char green, unsigned char blue diff --git a/Controllers/LogitechController/LogitechG403Controller.h b/Controllers/LogitechController/LogitechG403Controller.h index 9f930791..df492f62 100644 --- a/Controllers/LogitechController/LogitechG403Controller.h +++ b/Controllers/LogitechController/LogitechG403Controller.h @@ -40,7 +40,7 @@ public: void SendMouseMode ( unsigned char mode, - std::uint16_t speed, + unsigned short speed, unsigned char channel, unsigned char red, unsigned char green, diff --git a/RGBController/RGBController_LogitechG203.cpp b/RGBController/RGBController_LogitechG203.cpp index aab58dad..1b9b030b 100644 --- a/RGBController/RGBController_LogitechG203.cpp +++ b/RGBController/RGBController_LogitechG203.cpp @@ -34,15 +34,21 @@ RGBController_LogitechG203::RGBController_LogitechG203(LogitechG203Controller* l mode Cycle; Cycle.name = "Cycle"; Cycle.value = LOGITECH_G203_MODE_CYCLE; - Cycle.flags = 0; + Cycle.flags = MODE_FLAG_HAS_SPEED; Cycle.color_mode = MODE_COLORS_NONE; + Cycle.speed_min = LOGITECH_G203_SPEED_SLOWEST; + Cycle.speed_max = LOGITECH_G203_SPEED_FASTEST; + Cycle.speed = LOGITECH_G203_SPEED_NORMAL; modes.push_back(Cycle); mode Breathing; Breathing.name = "Breathing"; Breathing.value = LOGITECH_G203_MODE_BREATHING; - Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED; Breathing.color_mode = MODE_COLORS_PER_LED; + Breathing.speed_min = LOGITECH_G203_SPEED_SLOWEST; + Breathing.speed_max = LOGITECH_G203_SPEED_FASTEST; + Breathing.speed = LOGITECH_G203_SPEED_NORMAL; modes.push_back(Breathing); SetupZones(); @@ -79,7 +85,7 @@ void RGBController_LogitechG203::DeviceUpdateLEDs() unsigned char grn = RGBGetGValue(colors[0]); unsigned char blu = RGBGetBValue(colors[0]); - logitech->SendMouseMode(modes[active_mode].value, 0, red, grn, blu); + logitech->SendMouseMode(modes[active_mode].value, modes[active_mode].speed, red, grn, blu); } void RGBController_LogitechG203::UpdateZoneLEDs(int /*zone*/)