Compare commits

..
Author SHA1 Message Date
Adam Honse fd31956aaa Remove led::value 2026-06-05 03:04:51 -05:00
Adam Honse c3bd47fe60 Add display name fields to controller and zone instead of editing the existing name field 2026-06-04 01:19:04 -05:00
Adam Honse c6fe1e7023 Add ConfigureDevice and the ability to configure device name 2026-06-03 10:10:29 -05:00
Adam Honse 407c304eab Add SetHidden SDK packet 2026-06-03 10:10:28 -05:00
Adam Honse 7c87d97889 Use RGBControllerInterface for plugin API 2026-06-03 10:10:28 -05:00
Adam Honse 6f3a6f1404 Add another thread in NetworkClient for handling ProfileManager requests outside of the main listener thread, to avoid deadlocking the waiting receivers 2026-06-03 10:10:28 -05:00
Adam Honse 775e47774e Update translation files and fix some translation related issues 2026-06-03 10:10:28 -05:00
Adam Honse 1dc9b2ed53 NetworkClient cleanup and internal API standardization 2026-06-03 10:10:28 -05:00
Adam Honse 0a494f6a12 NetworkServer cleanup and internal API standardization 2026-06-03 10:10:28 -05:00
Adam Honse 5177acb4e7 Add indication of standalone or local client mode to about page 2026-06-03 10:10:28 -05:00
Adam Honse fe1b5a7256 Implement network request to get list of I2C buses so that the Get Hardware IDs dialog works in local client mode 2026-06-03 10:10:28 -05:00
Adam Honse 00e2b92ab6 Add option to force compact tabs and option to move tabs from left to top 2026-06-03 10:10:28 -05:00
Adam Honse 4319150412 More LogManager cleanup, default to a log file count of 10, fix bug in log rotation 2026-06-03 10:10:28 -05:00
Adam Honse 6dcddd2f8a Log manager SDK protocol 2026-06-03 10:10:28 -05:00
Adam Honse 30a1c332d3 Log Console Updates 2026-06-03 10:10:28 -05:00
Adam Honse c9cd346713 LogManager cleanup 2026-06-03 10:10:28 -05:00
Adam Honse 59051c7524 Settings Rework
* Add JSON string configuration field to RGBController to store device-specific configurations
    * This JSON string holds both configuration and schema
    * Add settings schema tracking to SettingsManager
    * Implement dynamic settings widget that generates a settings UI based on a JSON schema
    * Implement SettingsManager callback for notifying of settings changes and settings schema updates
    * Always enable Entire Device zone option and use it to enable Edit Device
    * Rename SaveSizes to SaveConfiguration in ProfileManager and Sizes.json to Configuration.json
    * Add zone flag for indicating that a zone's geometry may change, informing profile manager to ignore this check
    * Remove Theme setting and Theme Manager, as this didn't work on most setups anyways and Qt6 has proper Windows dark theming
2026-06-03 10:10:28 -05:00
Dmitry Kychanov 5e9469fe82 Fix losing software info upon changing language [next] 2026-06-03 10:10:28 -05:00
Dmitry Kychanov 055b937ff7 Fix device tabs not applying compact mode when hotplugging 2026-06-03 10:10:28 -05:00
Adam Honse 0a95989edb Close SDK connection if magic value is not correctly received 2026-06-03 10:10:28 -05:00
Adam Honse ef3e48884d Implement size verification on RGBController set description functions 2026-06-03 10:10:28 -05:00
Adam Honse 0f637c30e5 Clean up zone initialization dialog 2026-06-03 10:10:28 -05:00
Adam Honse 82d40f2d97 Require local client permission for DeleteProfile, SaveProfile, UploadProfile, SetSettings, and SaveSettings operations, some general cleanup 2026-06-03 10:10:28 -05:00
Adam Honse df6a498885 Sanitize profile filenames 2026-06-03 10:10:28 -05:00
Adam Honse b252fe8629 Add RescanDevices to plugin API 2026-06-03 10:10:27 -05:00
Adam Honse c837fa2b7e Implement segment groups in zone editor 2026-06-03 10:10:27 -05:00
Adam Honse 41749dce59 Rework server initialization
* Only create server instance if server is actually needed
    * Pass initial server host and port through ResourceManager
    * Allow setting default server host and port in Server settings
2026-06-03 10:10:27 -05:00
stephen iacovelli 08fbd285dc Sort profiles list alphabetically 2026-06-03 10:10:27 -05:00
Adam Honse af7e3e150c Organize OpenRGBSettingsPage with Group Boxes 2026-06-03 10:10:27 -05:00
Kasslim bb9a3e8730 Correct spelling Busses -> Buses
Commits merged by Adam Honse <[email protected]>
2026-06-03 10:10:27 -05:00
诺诺 c69f7fdf57 Add Nollie controller OS2.1 2026-06-03 10:10:27 -05:00
Adam Honse aba88f1fe2 Initial implementation of OpenRGB SDK protocol Wireshark dissector 2026-06-03 10:10:27 -05:00
Adam Honse 54a07077e1 Add ACK to network packets processed by NetworkServer 2026-06-03 10:10:27 -05:00
Adam Honse 0e288f3670 Only update device view when RGBController::UpdateLEDs signal is sent to OpenRGBDevicePage, fix device view not refreshing if multiple LEDs are selected 2026-06-03 10:10:27 -05:00
Adam Honse cf990ece4e Don't emit selection update on mouse click event to avoid sending unnecessary events, also only send one type of event per mouse release event. Fix LED box not being updated 2026-06-03 10:10:27 -05:00
Adam Honse ee52d2a7b0 Have dummy controller shut down its background thread immediately during constructor to save resources 2026-06-03 10:10:27 -05:00
Adam Honse a884aca165 DeviceView code cleanup, formatting, commenting 2026-06-03 10:10:27 -05:00
Adam Honse 464a590865 Fix selecting LEDs in device view 2026-06-03 10:10:27 -05:00
Adam Honse 98767252e6 TabLabel sets its own tooltip so all tabs have a tooltip rather than just devices 2026-06-03 10:10:27 -05:00
Adam Honse cbead40b32 Resize tabs when width is small 2026-06-03 10:10:27 -05:00
Adam Honse b4be3b1a88 Rework adding segments with ConfigureZone 2026-06-03 10:10:27 -05:00
Adam Honse 67c2e53221 Zone and Segment type updates
* Add zone flags to indicate if fields are manually configurable and if they have been manually configured
  * Add flags field to segment type
  * Add segment flags for group start and group member
  * Add color mode support flags to zone (RGB, RBG, GRB, GBR, BRG, BGR)
  * Add color mode enum to zone
  * Update zone and segment description functions to support new fields
  * Rename the effects-only configurable size flag
  * Remove zone type and matrix map configuration from E1.31 manual configuration, use zone editor instead
  * Rework DeviceResizeZone to DeviceConfigureZone
  * Rework most ARGB controllers to allow zone customizations
  * Rework DRGBController to define devices in DRGBDevices list (similar to RazerDevices)
  * Rework NollieController to define devices in NollieDevices list (similar to RazerDevices)
2026-06-03 10:10:27 -05:00
Adam Honse 4b90142d84 Add matrix map automatic generation to matrix map editor 2026-06-03 10:10:27 -05:00
Adam Honse e3408ee9d0 RGBController API changes and segment configuration updates
* Make the Get/Set RGBControler descriptor functions static
  * Add functions for getting the matrix_map_type for zone and segment matrix maps
  * Rename zone resize dialog to zone editor dialog
  * Add additional segment types
  * Add option to import segments configuration from JSON file in zone editor dialog
  * Update device view to be able to display matrix segment types
  * Add matrix map editor dialog for creating/editing segment matrix maps
  * Add option to export segments configuration to JSON file in zone editor dialog
2026-06-03 10:10:27 -05:00
Adam Honse 643bfa880f When updating existing profile without profile editor dialog, keep saved states for unavailable controllers, base color, and only update plugins already part of the existing profile 2026-06-03 10:10:27 -05:00
Adam Honse f370eb79b4 When saving sizes/manual configuration, keep any existing controllers that are not currently available 2026-06-03 10:10:27 -05:00
Adam Honse 0e45370b76 Rework how manual configuration (previously sizes) are loaded to newly detected controllers, load active profile to newly detected controllers 2026-06-03 10:10:26 -05:00
Adam Honse 73ef9f5fb2 Profile editor dialog 2026-06-03 10:10:26 -05:00
Adam Honse 95512d56f1 Rework API interface passed into plugins from ResourceManagerInterface to OpenRGBPluginAPIInterface 2026-06-03 10:10:26 -05:00
Adam Honse 405869fefe [next] Active profile tracking 2026-06-03 10:10:26 -05:00
Adam Honse 526d0bd2ca Apply profiles server-side rather than client-side, signal active profile update, forward loaded profile to local client for plugins 2026-06-03 10:10:26 -05:00
Adam Honse 1b5a1aa561 Split HID and wrapped HID detector lists into specific detectors (with exact VID/PID matching) and generic detectors (with only IPU matching) and prioritize specific detectors when detecting HID devices 2026-06-03 10:10:26 -05:00
Adam Honse 8bafba65fd Move RGBController base destructor functionality into RGBController::Shutdown() so that update thread can be stopped before deleting the controller. Shutdown() must be called in every RGBController implementation before deleting the controller. Also some fixes to the NetworkServer to avoid deadlocking and disconnect issues 2026-06-03 10:10:26 -05:00
Adam Honse b26e3f25fd Add detectors for filtering on IPU only (no VID/PID) 2026-06-03 10:10:26 -05:00
Adam Honse 9c8c57cc39 Drop support for old hidapi versions that don't support usage information 2026-06-03 10:10:26 -05:00
Adam Honse d358f1d2da Add some validity checks to mode setters and getters in RGBController 2026-06-03 10:10:26 -05:00
Adam Honse f4cd06df38 [next] SDK v6: Implement client and server flags to indicate capabilities and... 2026-06-03 10:10:26 -05:00
Adam Honse 15d2c30fa6 SDK documentation updates 2026-06-03 10:10:26 -05:00
Adam Honse 4f3eb52e18 Expose LogManager in ResourceManager so that plugins can use it 2026-06-03 10:10:26 -05:00
Adam Honse 4c52e4bfba Update NetworkClient to use log manager and use common name constant in server logs 2026-06-03 10:10:26 -05:00
Adam Honse d586324885 Use std::string.assign when setting strings in the SDK protocol and description handlers so that string size limit is enforced, then strip out null terminators 2026-06-03 10:10:26 -05:00
Adam Honse 5dd0c18194 Add optional HID device hotplug support (requires https://gitlab.com/OpenRGBDevelopers/hidapi-hotplug) 2026-06-03 10:10:26 -05:00
Adam Honse f6f3633ec0 SDK v6: Use unique IDs for identifying RGBControllers in SDK protocol 2026-06-03 10:10:26 -05:00
Adam Honse 985120903b Rework list handling in ResourceManager by having NetworkClient own its own list rather than sharing ResourceManager's list 2026-06-03 10:10:26 -05:00
Adam Honse 614f95a30a Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions 2026-06-03 10:10:26 -05:00
Adam Honse f732f57a4c Detection progress SDK integration, NetworkClient callback rework 2026-06-03 10:10:25 -05:00
Adam Honse 7b299d7d7f Split out detection system from ResourceManager into DetectionManager
* Split detection system out into its own class, DetectionManager
    * Clean up ResourceManger's many callbacks into just two, one for detection and one general purpose
2026-06-03 10:09:40 -05:00
Adam Honse ab3edd6df5 SDK Version 6 Updates
* SDK Protocol
    * Server sends its name to client
    * ProfileManager
      * Rename existing profile commands
      * Add Upload Profile, Download Profile, and Get Active Profile commands
    * SettingsManager
      * Add Get, Set, and Save Settings commands
    * Add zone::active_mode, zone::mode fields for zone-specific modes
    * Add NET_PACKET_ID_RGBCONTROLLER_UPDATEZONEMODE packet for updating zone modes
    * Add segment::matrix_map to segment packet
    * Add NET_PACKET_ID_RGBCONTROLLER_SIGNALUPDATE packet for passing SignalUpdate signal from server to clients
  * NetworkServer
    * Formatting cleanup
    * Use per-controller threads for handling NetworkServer controller-specific packets to avoid delays from controller mutexes
  * NetworkClient
    * Formatting cleanup
  * RGBController
    * Clean up and modularize descriptor functions
2026-06-03 00:15:49 -05:00
Adam Honse e6d1c37306 Rework Profiles to use JSON format
* Update OpenRGB Plugin Interface to include functions for loading/saving profile JSON data into OpenRGB profiles
    * Update ProfileManager to handle auto-load profiles (Exit, Open, Resume, Suspend) and move their settings to ProfileManager section
    * Update ProfileManager to store profiles in "profiles" folder in .json format
    * Update ProfileManager to store size profile in sizes.json
    * Update ProfileManager to perform device UpdateMode/UpdateColors when loading profile
    * Code cleanup of ProfileManager and profile-related code
2026-06-03 00:15:49 -05:00
Adam Honse b083537b36 RGBController API Overhaul
* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
2026-06-03 00:15:21 -05:00
Adam Honse 0c431c8340 Move plugin SDK integration from callback into plugin API and PluginManager 2026-06-02 22:45:08 -05:00
Adam Honse e606b57acd Update Plugin API to 5 and SDK Protocol to 6 2026-06-02 22:45:08 -05:00
Adam Honse 77c70776cb Update default builds to Qt6
* Update Debian packages to use Qt6
  * Update Fedora packages to use Qt6
  * Update default AppImage builds to use Qt6
  * Update default Windows builds to use Qt6
  * Update default MacOS builds to use Qt6
2026-06-02 22:45:08 -05:00
Adam Honse cf79a04f05 Revert "Nollie 2.1 firmware for Master"
This reverts commit 07e7feca56.
2026-06-02 22:45:08 -05:00
Adam Honse 3dc1365d39 Add PowerShell implementation of build-msi for building MSI on Windows, add additional information about PawnIO and the OpenRGB system service to the installer. 2026-06-02 22:07:17 -05:00
Adam Honse b03cd94ae8 Fix incorrect firmware packet format and add timeouts to HID reads in ThermaltakeRiingController 2026-06-02 01:07:33 -05:00
Jefferson González bbf348d273 Add HyperX Eve 1800 keyboard support 2026-06-02 00:15:19 -05:00
David Glushkov dce48eb415 Add MSI Raider A18 HX A9WJG SteelSeries RGB 2026-06-02 00:05:18 -05:00
Ox HaK decf14635d Add Fnatic Streak65 support 2026-06-01 08:27:17 -05:00
Richard Harris db4f49bbba Implement Direct mode support for Roccat Vulcan TKL (non-Pro) 2026-05-31 12:38:57 -05:00
HorrorTroll 26824fcb6e Added support for Colorful iGame GeForce RTX 5060 Ultra W OC 2026-05-31 15:12:36 +07:00
Jerry Fan 8afad91b33 Add support for RealtekBridgeController 2026-05-29 07:46:22 -05:00
Adam Honse 69de0b13c4 Update PawnIO modules to 0.2.6 and enable Intel Skylake IMC SMBus module 2026-05-28 23:48:42 -05:00
alstruit 967153bc10 Add support for ASUS ROG Gladius III Core 2026-05-25 12:08:43 -05:00
JAO1988 971d9be1bd Added Colorful iGame RTX 5060TI 16GB Ultra W DUO Variant 2026-05-23 23:10:36 -05:00
Mark Willis 7a3faef886 Initial commit for ASUS TUF GeForce RTX 5070 Ti Gaming White OC 2026-05-22 12:25:59 -05:00
Purrple Kitten f67030fcc7 Add support for the Gigabyte AORUS RTX 5080 MASTER ICE 2026-05-18 07:30:37 -05:00
Alex Jawhari 7353e99449 Fix AMD GPU i2c bus PCI ID detection on Linux (sysfs path traversal) 2026-05-17 23:58:21 -05:00
JAO1988 91d9597c89 Added Support for ASUS ROG ASTRAL GeForce RTX 5080 WHITE 2026-05-17 23:47:55 -05:00
Adam Honse 2eb569912b XPGSummonerKeyboardController - Remove fake modes 2026-05-13 11:49:05 -05:00
Ken Sanislo 9410d9c066 Add support for Thrustmaster Sol series joystick RGB LEDs 2026-05-09 00:21:40 -05:00
Adam Honse 29d8788e25 Allow value 0x27 at address 0x00 for Galax GPU controllers at address 0x23 2026-05-08 20:05:40 -05:00
Elvis Pranskevichus 0304c50bc6 Add support for Gigabyte AORUS RX 7900 XTX ELITE 24G 2026-05-08 00:12:43 -05:00
Adam Honse dd22150cfe Add vertical spacer to OpenRGBDeviceInfoPage 2026-05-07 16:17:46 -05:00
Barry H 07e7feca56 Nollie 2.1 firmware for Master 2026-05-04 14:16:29 -05:00
Sha_425 a93eec8f50 Add ASUS ROG STRIX RTX 3060 Ti V2 LHR (subsystem 1043:8835) 2026-05-03 12:15:13 -05:00
w43322 88bad762e5 add MSI MEG Z890 UNIFY-X (MS-7E20) support 2026-05-02 19:19:10 -05:00
w43322 18dfe6ca8b add ASUS TUF GeForce RTX 5060 Gaming OC support 2026-05-02 19:15:16 -05:00
mangobiche 96dfa7009f Add support for Corsair Vengeance RGB DDR5 CMH32GX5M2E6000C36 2026-05-02 15:06:09 -05:00
NaifuKishi 92a9d8ad11 Initial commit for ASUS TUF Radeon RX 7900 GRE Gaming OC 2026-05-01 11:09:31 -05:00
Francesco P 2ab9094b41 Add support for MSI MAG B850 TOMAHAWK WiFi7 2026-04-29 21:54:51 -05:00
M1dDler Official f6154ccbc4 Add msi rtx 5070 gaming trio 2026-04-28 20:04:53 -05:00
Illustrious-Net-8110 0be01dde19 Add Asus Ryujin AIO Gen1 support 2026-04-24 07:35:53 -05:00
Adam Honse e113e91423 Deploy QOpenGL and QtCore5Compat frameworks used by the OpenRGB Effects Plugin 2026-04-23 23:42:36 -05:00
Adam Honse 28c63b8b9d Call macdeployqt a second time on Qt6 builds to ensure frameworks depended on by default plugins are deployed 2026-04-23 12:37:49 -05:00
Adam Honse c5aac4c44f Fix libsharpyuv macdeployqt error for Qt5 builds 2026-04-23 10:52:54 -05:00
Adam Honse 42e7f2a5c3 Ignore SDK version in Mac build 2026-04-23 03:56:07 -05:00
Adam Honse ae9ae18d31 Add build-macos.sh script for easier MacOS builds 2026-04-23 00:37:45 -05:00
ricarim f89cdac198 Initial commit for HyperX Origins 2 65 2026-04-20 23:32:49 -05:00
acehighdan e8f345ff77 Sync autostart system configuration with OpenRGB settings on startup
If the autostart system configuration is deleted (e.g. by a reinstall or
package manager) but the JSON config still has enabled=true, OpenRGB
would silently fail to start at login. Fix by calling ConfigureAutoStart()
in the settings page constructor so the system configuration is always
reconciled with the stored JSON state every time OpenRGB starts.

Commit amended to make wording more generic by Adam Honse <[email protected]>
2026-04-20 23:32:49 -05:00
Dmitry Kychanov aff0610df9 Fix default language load on start 2026-04-20 23:32:49 -05:00
JAO1988 9199d062d1 Add Support for MSI GeForce RTX 5080 SUPRIM LIQUID SOC 2026-04-20 23:32:49 -05:00
Dmitry Kychanov 0ec4aaa629 Fix losing software info upon changing language 2026-04-20 23:32:49 -05:00
Adam Honse 9fca99b4ef Reduce i2c_smbus_linux PCI log messages from warning to info, they are expected in many cases 2026-04-20 23:32:31 -05:00
Vasily Galkin 14853895f3 Add support for Gigabyte GTX 1050 G1 Gaming 2GB (1458:372B) 2026-04-20 23:32:31 -05:00
Adam Honse d79a400c8c Fix corrupted text in TabLabels when translation occurs after the constructor 2026-04-20 23:32:31 -05:00
Adam Honse f741385e43 Fix bug introduced in MSI controller merge 2026-04-20 23:32:31 -05:00
Adam Honse 840bd92afb Add AI guidelines section to CONTRIBUTING.md 2026-04-20 23:32:31 -05:00
Nameless Monarch 96e1fb0b10 Add support for MSI PRO B850M-VC WIFI6E 2026-04-20 23:32:31 -05:00
Adam Honse 388557e5f9 Ensure device view is initialized if there are no LEDs to avoid accessing out of bounds 2026-04-20 23:32:17 -05:00
Slim Amamou 3f32817272 Added support for PNY GeForce RTX 5060Ti ARGB Epic-X OC 2026-04-20 23:32:10 -05:00
Adam Honse 056b383536 Add SMBus Sleep Mode settings page 2026-04-15 00:29:54 -05:00
Adam Honse 0691f40588 Update PawnIO modules to release 0.2.4 and implement SMBus sleep mode setting 2026-04-15 00:03:38 -05:00
Adam Honse 800ca0aa7c Fix same heap buffer overflow in RGBController_MSIMysticLight761.cpp 2026-04-13 11:42:03 -05:00
kuroki-kael a91679609b Fix heap-buffer-overflow in RGBController_MSIMysticLight185::GetDeviceConfig() 2026-04-13 11:40:46 -05:00
Adam Honse 19f9408990 Fix remaining warning 2026-04-13 11:34:28 -05:00
Adam Honse 0eea0c9aca Fix warnings 2026-04-13 10:54:34 -05:00
Stella 9f95aa8271 Add support for colorful igame rtx 5070 ultraw ocv 2 2026-04-11 02:24:15 -05:00
Adam Honse 0ee04c497b Revert "Change test in ENE SMBus controller to fix a conflict where it locks up Corsair DDR5 Light Enhancement Kit sticks"
This reverts commit c4e0164479.
2026-04-11 01:29:05 -05:00
Adam Honse 2847270c97 Remove out-of-range addresses from ENE RAM address list 2026-04-10 11:52:50 -05:00
Adam Honse b98174afba Fix off-by-one error in CorsairDRAMController 2026-04-10 11:03:34 -05:00
MissingDLL 3416980849 Add MSI MPG B850 EDGE TI WIFI (MS-7E62) to 761 controller 2026-04-09 20:49:35 -05:00
Joseph E c171bfbf3b Apex Pro Gen 3 TKL wired, add media light and regional layout support 2026-04-09 18:11:52 -05:00
Eder Sánchez 583a737cb5 Fix Windows build in ZOTAC Blackwell GPU controller 2026-04-09 15:03:21 -05:00
rjc862003 d2af6289dd Roccat vulcan ii max support 2026-04-09 13:28:33 -05:00
Moh'd Khier Abualruz 44e6f455e9 Fix Apex Pro TKL 2023 Wireless (PIDs 0x1630/0x1632) RGB control 2026-04-09 13:18:38 -05:00
Eder Sánchez b3a50d669e Add support for ZOTAC GAMING GeForce RTX 5080 AMP Extreme INFINITY 2026-04-09 12:21:52 -05:00
ricarim 0092ea22e2 Fix name assignment for HyperXAlloyOrigins60and65 2026-04-09 10:14:06 -05:00
Jérôme Bauer 58fb35a9bb Fix MSI Mystic Light 185 for Common PID boards (0x0DB0:0x0076) 2026-04-09 10:09:55 -05:00
Adam Honse 9a6ff77545 Combine Corsair RAM controllers, Corsair RAM identification packet testing 2026-04-09 00:47:06 -05:00
Adam Honse c4e0164479 Change test in ENE SMBus controller to fix a conflict where it locks up Corsair DDR5 Light Enhancement Kit sticks 2026-04-08 22:24:56 -05:00
Adam Honse f872f1c591 Ignore modes out of range in VialRGB controller 2026-04-08 18:50:47 -05:00
kuroki-kael 03e64da845 Fix heap corruption in i2c_smbus_linux when sysfs files are empty 2026-04-08 15:54:38 -05:00
Frans Meulenbroeks 3150f64895 Mountain Everest 60: fix led index 2026-04-08 09:33:56 -05:00
Hugo Chabert 8b36e9c317 Add razer blackwidow v4 tenkeyless hyperspeed 2026-04-07 07:30:59 -05:00
Stella c5c5fc6c02 Add support for Colorful iGAME RTX 5060Ti 16GB Ultra W DUO V 2026-04-05 03:46:51 -05:00
Artemis Tomaras c7d9992a3d Fix SL V2 SendStartAction/SendCommitAction packet size 2026-04-05 01:52:56 -05:00
InterStella0 0d8f2c6b14 add colorful rtx 5070 ultra w ocv support 2026-04-03 18:22:49 -05:00
vitutu1 c1800f2a6f Add support for MSI RTX 4070 SUPER Gaming X Slim MLG 2026-04-03 16:46:23 +00:00
Micael Pereira d41a115a07 Add support for MSI PRO A620M-B (MS-7E28) 2026-04-03 01:31:28 -05:00
Elijah Mock 2640a3b93f Update docstring detector to match registered detector 2026-03-26 21:50:02 -05:00
Adam Honse 984c18cb11 Add Gigabyte 9070XT GAMING OC ICE 2026-03-23 16:44:30 -05:00
Adam Honse 23db15dfb9 Add support for E6K5-1114 ENE device 2026-03-23 11:46:04 -05:00
Org van Rensburg 9426f954b0 Add support for MSI MAG Z890 Tomahawk WIFI (MS-7E32) - Resolves #5438 2026-03-23 07:24:22 -05:00
asheriif 133b64778b Add support for Apex Pro TKL Gen 3 Wireless 2026-03-22 22:19:37 +01:00
Aakrisht Sharma Paudel a8a97fa38d Legion 5 gen10 2026-03-17 07:50:23 -05:00
Roy Biggins da6061bbde Add X570 AORUS XTREME zone mapping for IT8297BX 2026-03-16 10:29:38 -05:00
asheriif dfad607697 Add support for Steel Series CS2 Dragon Lore Edition 2026-03-10 21:58:47 +01:00
Yaroslav Syrytsia 5d7565bc59 Controllers/Razer: add initial support for Razer Basilisk V3 Pro 35K Phantom Green Edition 2026-03-08 23:28:27 -05:00
Anton Klimanov ab962ca98f Add support for Gigabyte Radeon RX 7900 XTX GAMING OC 24G (1458:240e) 2026-03-09 01:36:27 +03:00
Adam Honse dbbf9858f8 Fix warnings in CMARGBController 2026-03-04 22:23:20 -06:00
Adam Honse 51edb35e3f Rework CoolerMaster ARGB controller so that it doesn't create multiple devices and prepare it for per-zone mode support 2026-03-04 11:45:48 -06:00
Adam Honse 81c6ee6270 Replace usages of sprintf with snprintf 2026-03-03 11:29:19 -06:00
Adam Honse 9ad37cc98f Fix logical error from changing type to unsigned 2026-03-03 11:25:22 -06:00
Adam Honse c76864dd4b Warning fixes and cleanups 2026-03-03 11:05:11 -06:00
Marco Martinez e3889508c0 Add support for another Airgoo Fan + DRGB Controller variant 2026-03-03 07:37:45 -06:00
Adam Honse 22d908b9a3 Fix warnings in ClevoLightbarController.cpp 2026-03-02 23:18:40 -06:00
Adam Honse 13d3e09f1a Fix warnings in ClevoKeyboardController.cpp 2026-03-02 23:17:23 -06:00
Adam Honse 9ec15673d1 Fix warnings in AsusMonitorController.cpp 2026-03-02 23:15:36 -06:00
Adam Honse 3a00a803e9 Fix warnings in LianLiUniHubSLController 2026-03-02 23:08:51 -06:00
Adam Honse 4a12a0db90 Fix warnings in LianLiUniversalScreenController 2026-03-02 23:07:12 -06:00
Adam Honse b4940e3a75 Fix warning in QMKVialRGBController 2026-03-02 23:04:40 -06:00
Adam Honse ffe07bbe3b Fix warning in RazerKrakenV3Controller 2026-03-02 23:03:00 -06:00
Adam Honse 7fdb006465 Fix warning in WootingV1KeyboardController 2026-03-02 23:01:29 -06:00
Adam Honse 99da577c41 Fix warning in SPDAccessor.cpp 2026-03-02 22:54:22 -06:00
Adam Honse 0f6fdd6c3b Fix warnings in HPOmenLaptopWMI_Windows 2026-03-02 22:52:12 -06:00
Adam Honse 52ec58d67f Fix warnings in NVFC nvapi.cpp 2026-03-02 22:44:19 -06:00
Adam Honse c55fc59d18 Clean up and fix warning in SteelSeriesApexController 2026-03-02 18:07:52 -06:00
Adam Honse b68b63e8c9 Fix warning in LianLiUniHubSLController 2026-03-02 16:16:10 -06:00
Kevin Ferrare 84bb05d504 Add support for MSI PRO B850M-P WIFI (MS-7E71) 2026-02-26 22:50:46 +01:00
Frans Meulenbroeks f33a7ba870 Mountain Everest 60: fix initialisation 2026-02-22 17:19:18 -06:00
chetrez911 93830c12ee Add support for MSI MAG B850 TOMAHAWK MAX WIFI (MS-7E62) 2026-02-22 11:56:23 -06:00
Arno b8b50f6651 Initial commit for MSI PRO Z790-S WIFI 2026-02-22 11:40:25 -06:00
sebastien ayanouglou 8f331090f9 Added support to RTX 5070Ti MSI Vanguard 16G 2026-02-16 07:21:32 -06:00
gozzarda 7ec1e8ddfa PowerColor GPU: Accept V1 magic from V2 controller. 2026-02-15 14:05:32 -06:00
Adam Honse 880dc1450d PNY ARGB Epic-X GPU: Add additional modes 2026-02-13 16:27:30 -06:00
Daenney 801e655c09 Add support for MSI MPG X870E EDGE TI WiFi 2026-02-13 13:36:54 -06:00
Adam Honse 5e269dd089 Add support for the PNY Epic-X ARGB 5070, 5080, and 5090 variants 2026-02-13 11:25:42 -06:00
John360Boxer 476f81d5e8 Initial commit for Redragon K686 Eisa Pro 2026-02-09 07:39:40 -06:00
storto 66dfb5f6fd Add/Fix support for the Gigabyte AORUS 5080 MASTER GPU 2026-02-08 12:45:02 -06:00
Michał Przytarski a2f2991192 feat: support MSI GeForce RTX 4060 GAMING X NV Edition 8G 2026-02-07 14:42:15 -06:00
Adam Honse cfedcd2180 Add Razer Blackwidow V4 Pro 75% wireless mode and add missing underglow LEDs to the matrix 2026-02-07 00:14:36 -06:00
Arthur de Groot cc06c62164 Rename Setting RunZoneChecks -> run_zone_checks 2026-02-05 17:20:14 -06:00
bernibaer b4ca000402 Initial support for Corsair K70 CORE TKL Keyboard ID 1b1c:2b01. Volume knob... 2026-01-30 13:49:48 -06:00
eriosgamer b78a6f4418 Fixed incorrect PID and device name. 2026-01-29 20:18:55 -06:00
Kirill Khakimov d5693b7a08 Add PCI device ID for Palit GeForce RTX 5070 Ti GamingPro-S 2026-01-29 16:54:41 -06:00
Werner Sembach cae0670065 Add new keynames 2026-01-29 16:18:13 -06:00
Adam Honse f2d1188fdd Fix swatches not resizing properly when maximized 2026-01-28 18:35:22 -06:00
Yohan 70be81c92d Merge: Add CDC Check in JGINYUE Usb Controller #5128 2026-01-27 10:54:51 -06:00
rszyma 5d5af93401 Add support for MSI PRO X870-P WIFI (MS-7E47) motherboard 2026-01-27 01:30:11 -06:00
superstrom 74cbdcce55 New Device: Razer Kraken Kitty V2 Pro 2026-01-25 17:40:54 -06:00
John Smith 96d19a76cc Add support for Sapphire Radeon RX 9060 XT Pure 2026-01-25 12:01:23 +03:00
759 changed files with 63036 additions and 22472 deletions
+4 -16
View File
@@ -536,10 +536,7 @@ before_script:
- macos
stage: build
script:
- eval $(/opt/homebrew/bin/brew shellenv)
- qmake OpenRGB.pro
- make -j16
- macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt6 arm
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_ARM64_${CI_COMMIT_SHORT_SHA}"
@@ -555,10 +552,7 @@ before_script:
- macos
stage: build
script:
- eval $(/opt/homebrew/bin/brew shellenv)
- /opt/homebrew/opt/qt@5/bin/qmake OpenRGB.pro
- make -j16
- /opt/homebrew/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt5 arm
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Qt5_ARM64_${CI_COMMIT_SHORT_SHA}"
@@ -574,10 +568,7 @@ before_script:
- macos
stage: build
script:
- eval $(/usr/local/bin/brew shellenv)
- arch -x86_64 /usr/local/bin/qmake OpenRGB.pro
- arch -x86_64 make -j16
- arch -x86_64 /usr/local/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt6 intel
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Intel_${CI_COMMIT_SHORT_SHA}"
@@ -593,10 +584,7 @@ before_script:
- macos
stage: build
script:
- eval $(/usr/local/bin/brew shellenv)
- arch -x86_64 /usr/local/opt/qt@5/bin/qmake OpenRGB.pro
- arch -x86_64 make -j16
- arch -x86_64 /usr/local/opt/qt@5/bin/macdeployqt OpenRGB.app -codesign=OpenRGB
- ./scripts/build-macos.sh qt5 intel
artifacts:
name: "${CI_PROJECT_NAME}_MacOS_Intel_Qt5_${CI_COMMIT_SHORT_SHA}"
+1 -2
View File
@@ -22,13 +22,12 @@ CODEOWNERS @Calcprogrammer1
/Controllers/BlinkyTapeController/
/Controllers/CoolerMasterController/ @Dr_No
/Controllers/CorsairCommanderCoreController/
/Controllers/CorsairDominatorPlatinumController/
/Controllers/CorsairDRAMController/
/Controllers/CorsairHydroController/
/Controllers/CorsairHydroPlatinumController/
/Controllers/CorsairLightingNodeController/
/Controllers/CorsairPeripheralController/
/Controllers/CorsairVengeanceController/
/Controllers/CorsairVengeanceProController/
/Controllers/CorsairWirelessController/
/Controllers/CreativeController/
/Controllers/CrucialController/
+4
View File
@@ -69,3 +69,7 @@ OpenRGB is written in C++, uses the Qt framework for UI, and uses the QMake buil
Translation files are located in [`OpenRGB/qt/i18n/`](https://gitlab.com/CalcProgrammer1/OpenRGB/-/tree/master/qt/i18n), where languages are formatted using ISO 639-1 format: `OpenRGB_xx_XX.ts` — `xx_XX` representing the language code.
In order to translate a file, you need to [fork](https://gitlab.com/CalcProgrammer1/OpenRGB/-/forks/new) the project, create a new file for your language with `lupdate` (or edit an exisiting one), edit the file with `qtlinguist`, commit, push, and create a merge request.
## AI Guidelines
OpenRGB is an open source project developed by humans for humans. As a general rule, AI generated submissions are not permitted. The licensing behind AI generated code is problematic. If you choose to use AI for assistance in your development process, we can't stop you, but do not credit the AI in commits (no AI authorship/co-authorship). Ultimately, you as a human developer are responsible for the code you submit and it is expected that any code you submit you fully understand and have manually vetted before submission. Merge requests that appear to be straight from an AI output, commits with AI tool authorship or co-authorship tags, or otherwise AI generated submissions are subject to closure.
@@ -173,6 +173,8 @@ RGBController_BloodyB820R::RGBController_BloodyB820R(BloodyB820RController *cont
RGBController_BloodyB820R::~RGBController_BloodyB820R()
{
Shutdown();
delete controller;
}
@@ -203,7 +205,6 @@ void RGBController_BloodyB820R::SetupZones()
{
led new_led;
new_led.name = led_names[led_index];
new_led.value = led_index;
leds.push_back(new_led);
}
@@ -67,13 +67,13 @@ void BloodyMouseController::InitDevice()
hid_send_feature_report(dev, buffer, BLOODYMOUSE_WRITE_PACKET_SIZE);
}
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors)
void BloodyMouseController::SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets)
{
uint8_t buffer[BLOODYMOUSE_WRITE_PACKET_SIZE] = { 0x07, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 };
for(uint8_t i = 0; i < colors.size(); i++)
{
uint8_t offset = 3 * (colors[i] >> 24) + BLOODYMOUSE_DATA_BYTE;
uint8_t offset = 3 * (offsets[i]) + BLOODYMOUSE_DATA_BYTE;
buffer[offset] = RGBGetRValue(colors[i]);
buffer[offset + 1] = RGBGetGValue(colors[i]);
@@ -58,7 +58,7 @@ public:
std::string GetLocation();
std::string GetName();
void SetLedsDirect(std::vector<RGBColor> colors);
void SetLedsDirect(std::vector<RGBColor> colors, std::vector<uint8_t> offsets);
private:
uint16_t pid;
@@ -89,6 +89,8 @@ RGBController_BloodyMouse::RGBController_BloodyMouse(BloodyMouseController *cont
RGBController_BloodyMouse::~RGBController_BloodyMouse()
{
Shutdown();
delete controller;
}
@@ -140,7 +142,7 @@ void RGBController_BloodyMouse::SetupZones()
{
led new_led;
new_led.value = mz.zone_leds[lp_idx];
offsets.push_back(mz.zone_leds[lp_idx]);
if(bool_single)
{
@@ -161,14 +163,7 @@ void RGBController_BloodyMouse::SetupZones()
void RGBController_BloodyMouse::DeviceUpdateLEDs()
{
std::vector<RGBColor> colour;
for(size_t i = 0; i < colors.size(); i++)
{
RGBColor c = colors[i] | (leds[i].value << 24);
colour.push_back(c);
}
controller->SetLedsDirect(colour);
controller->SetLedsDirect(colors, offsets);
}
void RGBController_BloodyMouse::DeviceUpdateZoneLEDs(int /*zone*/)
@@ -39,4 +39,5 @@ public:
private:
BloodyMouseController* controller;
std::vector<uint8_t> offsets;
};
@@ -186,7 +186,7 @@ void AMBXController::SetLEDColor(unsigned int led, RGBColor color)
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
void AMBXController::SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count)
void AMBXController::SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count)
{
for(unsigned int i = 0; i < count; i++)
{
+1 -1
View File
@@ -44,7 +44,7 @@ public:
bool IsInitialized();
void SetLEDColor(unsigned int led, RGBColor color);
void SetLEDColors(unsigned int* leds, RGBColor* colors, unsigned int count);
void SetLEDColors(const unsigned int* leds, RGBColor* colors, unsigned int count);
private:
libusb_context* usb_context;
@@ -9,6 +9,15 @@
#include "RGBController_AMBX.h"
static const unsigned int led_values[] =
{
AMBX_LIGHT_LEFT,
AMBX_LIGHT_RIGHT,
AMBX_LIGHT_WALL_LEFT,
AMBX_LIGHT_WALL_CENTER,
AMBX_LIGHT_WALL_RIGHT
};
/**------------------------------------------------------------------*\
@name Philips amBX
@category Accessory
@@ -44,6 +53,8 @@ RGBController_AMBX::RGBController_AMBX(AMBXController* controller_ptr)
RGBController_AMBX::~RGBController_AMBX()
{
Shutdown();
delete controller;
}
@@ -69,27 +80,22 @@ void RGBController_AMBX::SetupZones()
// Set up LEDs
led left_light;
left_light.name = "Left";
left_light.value = AMBX_LIGHT_LEFT;
leds.push_back(left_light);
led right_light;
right_light.name = "Right";
right_light.value = AMBX_LIGHT_RIGHT;
leds.push_back(right_light);
led wall_left;
wall_left.name = "Wall Left";
wall_left.value = AMBX_LIGHT_WALL_LEFT;
leds.push_back(wall_left);
led wall_center;
wall_center.name = "Wall Center";
wall_center.value = AMBX_LIGHT_WALL_CENTER;
leds.push_back(wall_center);
led wall_right;
wall_right.name = "Wall Right";
wall_right.value = AMBX_LIGHT_WALL_RIGHT;
leds.push_back(wall_right);
SetupColors();
@@ -102,16 +108,7 @@ void RGBController_AMBX::DeviceUpdateLEDs()
return;
}
unsigned int led_values[5];
RGBColor led_colors[5];
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
led_values[led_idx] = leds[led_idx].value;
led_colors[led_idx] = colors[led_idx];
}
controller->SetLEDColors(led_values, led_colors, static_cast<unsigned int>(leds.size()));
controller->SetLEDColors(led_values, colors.data(), static_cast<unsigned int>(colors.size()));
}
void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
@@ -136,17 +133,17 @@ void RGBController_AMBX::DeviceUpdateZoneLEDs(int zone)
start_idx += zones[z_idx].leds_count;
}
unsigned int led_values[5];
RGBColor led_colors[5];
unsigned int tmp_values[5];
RGBColor tmp_colors[5];
for(unsigned int led_idx = 0; led_idx < zone_size; led_idx++)
{
unsigned int current_idx = start_idx + led_idx;
led_values[led_idx] = leds[current_idx].value;
led_colors[led_idx] = colors[current_idx];
tmp_values[led_idx] = led_values[current_idx];
tmp_colors[led_idx] = colors[current_idx];
}
controller->SetLEDColors(led_values, led_colors, zone_size);
controller->SetLEDColors(tmp_values, tmp_colors, zone_size);
}
void RGBController_AMBX::DeviceUpdateSingleLED(int led)
@@ -156,7 +153,7 @@ void RGBController_AMBX::DeviceUpdateSingleLED(int led)
return;
}
unsigned int led_value = leds[led].value;
unsigned int led_value = led_values[led];
RGBColor color = colors[led];
controller->SetLEDColor(led_value, color);
}
@@ -11,6 +11,33 @@
#include "RGBController_AMDWraithPrism.h"
/*---------------------------------------------------------*\
| LED maps |
\*---------------------------------------------------------*/
const unsigned char led_values[] =
{
// Logo
0x00,
// Fan
0x01,
// Ring
0x08,
0x07,
0x06,
0x05,
0x04,
0x03,
0x02,
0x10,
0x0F,
0x0E,
0x0D,
0x0C,
0x0B,
0x0A,
0x09
};
/**------------------------------------------------------------------*\
@name AMD Wraith Prism
@category Cooler
@@ -132,19 +159,13 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
{
Shutdown();
delete controller;
}
void RGBController_AMDWraithPrism::SetupZones()
{
/*-----------------------------------------------------*\
| LED maps |
\*-----------------------------------------------------*/
const unsigned int logo_leds[1] = { 0x00 };
const unsigned int fan_leds[1] = { 0x01 };
const unsigned int ring_leds[15] = { 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x10,
0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09 };
/*-----------------------------------------------------*\
| Set up zones |
\*-----------------------------------------------------*/
@@ -179,7 +200,6 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = logo_leds[led_idx];
leds.push_back(logo_led);
}
@@ -187,7 +207,6 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led fan_led;
fan_led.name = "Fan LED";
fan_led.value = fan_leds[led_idx];
leds.push_back(fan_led);
}
@@ -195,7 +214,6 @@ void RGBController_AMDWraithPrism::SetupZones()
{
led ring_led;
ring_led.name = "Ring LED";
ring_led.value = ring_leds[led_idx];
leds.push_back(ring_led);
}
@@ -216,7 +234,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
leds_count = 0;
for(std::size_t led_idx = 0; led_idx < 2; led_idx++)
{
led_ids[leds_count] = (unsigned char)leds[led_idx].value;
led_ids[leds_count] = led_values[led_idx];
color_buf[leds_count] = colors[led_idx];
leds_count++;
@@ -229,7 +247,7 @@ void RGBController_AMDWraithPrism::DeviceUpdateLEDs()
leds_count = 0;
for(std::size_t led_idx = 0; led_idx < ( colors.size() - 2 ); led_idx++)
{
led_ids[leds_count] = (unsigned char)leds[led_idx + 2].value;
led_ids[leds_count] = led_values[led_idx + 2];
color_buf[leds_count] = colors[led_idx + 2];
leds_count++;
@@ -31,7 +31,7 @@ AOCKeyboardController::~AOCKeyboardController()
std::string AOCKeyboardController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCKeyboardController::GetDeviceName()
@@ -257,6 +257,8 @@ RGBController_AOCKeyboard::RGBController_AOCKeyboard(AOCKeyboardController* cont
RGBController_AOCKeyboard::~RGBController_AOCKeyboard()
{
Shutdown();
delete controller;
}
@@ -284,7 +286,7 @@ void RGBController_AOCKeyboard::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
new_led.value = new_kb.GetKeyValueAt(led_idx);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
leds.push_back(new_led);
}
@@ -301,7 +303,7 @@ void RGBController_AOCKeyboard::DeviceUpdateLEDs()
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
color_buf[leds[led_idx].value] = colors[led_idx];
color_buf[led_values[led_idx]] = colors[led_idx];
}
controller->SetCustom(&color_buf[0]);
@@ -29,5 +29,6 @@ public:
void DeviceUpdateMode();
private:
AOCKeyboardController* controller;
AOCKeyboardController* controller;
std::vector<unsigned int> led_values;
};
@@ -27,7 +27,7 @@ AOCMouseController::~AOCMouseController()
std::string AOCMouseController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCMouseController::GetDeviceName()
@@ -123,6 +123,8 @@ RGBController_AOCMouse::RGBController_AOCMouse(AOCMouseController* controller_pt
RGBController_AOCMouse::~RGBController_AOCMouse()
{
Shutdown();
delete controller;
}
@@ -27,7 +27,7 @@ AOCMousematController::~AOCMousematController()
std::string AOCMousematController::GetDeviceLocation()
{
return("HID " + location);
return("HID: " + location);
}
std::string AOCMousematController::GetDeviceName()
@@ -113,6 +113,8 @@ RGBController_AOCMousemat::RGBController_AOCMousemat(AOCMousematController* cont
RGBController_AOCMousemat::~RGBController_AOCMousemat()
{
Shutdown();
delete controller;
}
@@ -191,7 +191,7 @@ void PolychromeUSBController::SetDeviceInfo()
WriteRGSwap(rgswap_final[0], rgswap_final[1], rgswap_final[2], rgswap_final[3], rgswap_final[4], rgswap_final[5], rgswap_final[6], rgswap_final[7]);
}
void PolychromeUSBController::DeviceResizeZone(int zone, int new_size)
void PolychromeUSBController::SetZoneSize(int zone, int new_size)
{
unsigned char zonecfg[POLYCHROME_USB_ZONE_MAX_NUM];
@@ -135,7 +135,7 @@ public:
unsigned int configsize
);
void DeviceResizeZone(int zone, int new_size);
void SetZoneSize(int zone, int new_size);
void SetRGSwap(bool reset);
protected:
@@ -185,8 +185,25 @@ RGBController_PolychromeUSB::RGBController_PolychromeUSB(PolychromeUSBController
SetupZones();
}
RGBController_PolychromeUSB::~RGBController_PolychromeUSB()
{
Shutdown();
delete controller;
}
void RGBController_PolychromeUSB::SetupZones()
{
/*-----------------------------------------------------*\
| Only set LED count on the first run |
\*-----------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
@@ -197,37 +214,64 @@ void RGBController_PolychromeUSB::SetupZones()
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
for(unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
PolychromeDeviceInfo device_info = controller->GetPolychromeDevices()[channel_idx];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
if(device_info.device_type== PolychromeDeviceType::ADDRESSABLE)
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
zones[channel_idx].leds_count = device_info.num_leds;
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = ASROCK_ADDRESSABLE_MAX_LEDS;
if(first_run)
{
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = device_info.num_leds;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(0);
}
}
else if(device_info.device_type==PolychromeDeviceType::FIXED)
{
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
zones[channel_idx].name = polychrome_USB_zone_names[device_info.zone_type];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
}
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
led new_led;
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
new_led.value = channel_idx;
leds.push_back(new_led);
led_values.push_back(channel_idx);
}
}
@@ -252,7 +296,7 @@ void RGBController_PolychromeUSB::SetupZones()
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
unsigned char led = (unsigned char)leds[led_idx].value;
unsigned char led = (unsigned char)led_values[led_idx];
colors[led_idx] = zones_info[led].color;
}
@@ -271,10 +315,14 @@ void RGBController_PolychromeUSB::SetupZones()
}
}
void RGBController_PolychromeUSB::DeviceResizeZone(int zone, int new_size)
void RGBController_PolychromeUSB::DeviceConfigureZone(int zone_idx)
{
zones[zone].leds_count = (unsigned char) new_size;
controller->DeviceResizeZone(zones_info[zone].zone, new_size);
if((size_t)zone_idx < zones.size())
{
controller->SetZoneSize(zones_info[zone_idx].zone, zones[zone_idx].leds_count);
SetupZones();
}
}
void RGBController_PolychromeUSB::DeviceUpdateLEDs()
@@ -311,7 +359,7 @@ void RGBController_PolychromeUSB::DeviceUpdateZoneLEDs(int zone)
void RGBController_PolychromeUSB::DeviceUpdateSingleLED(int led)
{
unsigned int channel = leds[led].value;
unsigned int channel = led_values[led];
unsigned char set_mode = zones_info[channel].mode;
if(set_mode > modes.size())
@@ -19,10 +19,11 @@ class RGBController_PolychromeUSB : public RGBController
{
public:
RGBController_PolychromeUSB(PolychromeUSBController* controller_ptr);
~RGBController_PolychromeUSB();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -32,6 +33,7 @@ public:
private:
PolychromeUSBController* controller;
std::vector<unsigned int> led_values;
std::vector<PolychromeZoneInfo> zones_info;
unsigned char GetDeviceMode(unsigned char zone);
@@ -36,7 +36,7 @@ ASRockASRRGBSMBusController::~ASRockASRRGBSMBusController()
std::string ASRockASRRGBSMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -113,6 +113,8 @@ RGBController_ASRockASRRGBSMBus::RGBController_ASRockASRRGBSMBus(ASRockASRRGBSMB
RGBController_ASRockASRRGBSMBus::~RGBController_ASRockASRRGBSMBus()
{
Shutdown();
delete controller;
}
@@ -156,14 +158,12 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
\*---------------------------------------------------------*/
leds.push_back(*new_led);
SetupColors();
}
void RGBController_ASRockASRRGBSMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
| Initialize led_values vector |
\*---------------------------------------------------------*/
led_values.push_back(0);
SetupColors();
}
void RGBController_ASRockASRRGBSMBus::DeviceUpdateLEDs()
@@ -189,9 +189,9 @@ void RGBController_ASRockASRRGBSMBus::DeviceUpdateSingleLED(int led)
| If the LED value is non-zero, this LED overrides the LED |
| index |
\*---------------------------------------------------------*/
if(leds[led].value != 0)
if(led_values[led] != 0)
{
led = leds[led].value;
led = led_values[led];
}
controller->SetColorsAndSpeed(led, red, grn, blu);
@@ -22,8 +22,6 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
@@ -32,4 +30,5 @@ public:
private:
ASRockASRRGBSMBusController* controller;
std::vector<unsigned int> led_values;
};
@@ -36,7 +36,7 @@ ASRockPolychromeV1SMBusController::~ASRockPolychromeV1SMBusController()
std::string ASRockPolychromeV1SMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -230,6 +230,8 @@ RGBController_ASRockPolychromeV1SMBus::RGBController_ASRockPolychromeV1SMBus(ASR
RGBController_ASRockPolychromeV1SMBus::~RGBController_ASRockPolychromeV1SMBus()
{
Shutdown();
delete controller;
}
@@ -283,23 +285,22 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
led* new_led = new led();
new_led->name = polychrome_v1_zone_names[zone_idx];
new_led->value = zone_idx;
/*---------------------------------------------------------*\
| Push new LED to LEDs vector |
\*---------------------------------------------------------*/
leds.push_back(*new_led);
zoneIndexMap.push_back(zone_idx);
led_values.push_back(zone_idx);
}
}
SetupColors();
}
void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size)
void RGBController_ASRockPolychromeV1SMBus::DeviceConfigureZone(int zone_idx)
{
LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
controller-> SetARGBSize(new_size & 0xFF);
controller-> SetARGBSize(zones[zone_idx].leds_count & 0xFF);
zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1;
}
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -32,7 +32,9 @@ public:
void DeviceUpdateMode();
private:
ASRockPolychromeV1SMBusController* controller;
uint8_t getModeIndex(uint8_t mode_value);
std::vector<uint8_t> zoneIndexMap;
ASRockPolychromeV1SMBusController* controller;
std::vector<unsigned int> led_values;
std::vector<uint8_t> zoneIndexMap;
uint8_t getModeIndex(uint8_t mode_value);
};
@@ -37,7 +37,7 @@ ASRockPolychromeV2SMBusController::~ASRockPolychromeV2SMBusController()
std::string ASRockPolychromeV2SMBusController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -185,6 +185,8 @@ RGBController_ASRockPolychromeV2SMBus::RGBController_ASRockPolychromeV2SMBus(ASR
RGBController_ASRockPolychromeV2SMBus::~RGBController_ASRockPolychromeV2SMBus()
{
Shutdown();
delete controller;
}
@@ -254,11 +256,14 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
new_led->name = polychrome_v2_zone_names[zone_idx];
new_led->name.append(" " + std::to_string(led_idx + 1));
new_led->value = 0;
if(zone_idx == POLYCHROME_V2_ZONE_ADDRESSABLE)
{
new_led->value = 0x19;
led_values.push_back(0x19);
}
else
{
led_values.push_back(0);
}
/*---------------------------------------------------------*\
@@ -279,7 +284,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_ASRockPolychromeV2SMBus::DeviceConfigureZone(int /*zone_idx*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
@@ -309,9 +314,9 @@ void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateSingleLED(int led)
| If the LED value is non-zero, this LED overrides the LED |
| index |
\*---------------------------------------------------------*/
if(leds[led].value != 0)
if(led_values[led] != 0)
{
led = leds[led].value;
led = led_values[led];
}
controller->SetColorsAndSpeed(led, red, grn, blu);
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -32,5 +32,6 @@ public:
void DeviceUpdateMode();
private:
ASRockPolychromeV2SMBusController* controller;
ASRockPolychromeV2SMBusController* controller;
std::vector<unsigned int> led_values;
};
@@ -85,31 +85,31 @@ uint16_t GetFirmwareVersion(i2c_smbus_interface* bus, uint8_t address)
}
}
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& busses)
DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface*>& buses)
{
DetectedControllers detected_controllers;
for(unsigned int bus = 0; bus < busses.size(); bus++)
for(unsigned int bus = 0; bus < buses.size(); bus++)
{
IF_MOBO_SMBUS(busses[bus]->pci_vendor, busses[bus]->pci_device)
IF_MOBO_SMBUS(buses[bus]->info.pci_vendor, buses[bus]->info.pci_device)
{
if(busses[bus]->pci_subsystem_vendor == ASROCK_SUB_VEN)
if(buses[bus]->info.pci_subsystem_vendor == ASROCK_SUB_VEN)
{
LOG_DEBUG(SMBUS_CHECK_DEVICE_MESSAGE_EN, ASROCK_DETECTOR_NAME, bus, VENDOR_NAME, SMBUS_ADDRESS);
// Check for Polychrome controller at 0x6A
if(TestForPolychromeSMBusController(busses[bus], SMBUS_ADDRESS))
if(TestForPolychromeSMBusController(buses[bus], SMBUS_ADDRESS))
{
LOG_DEBUG("[%s] Detected a device at address 0x%02X, testing for a known controller", ASROCK_DETECTOR_NAME, SMBUS_ADDRESS);
u16_to_u8 version;
version.u16 = GetFirmwareVersion(busses[bus], SMBUS_ADDRESS);
version.u16 = GetFirmwareVersion(buses[bus], SMBUS_ADDRESS);
switch(version.msb)
{
case ASROCK_TYPE_ASRLED:
{
LOG_DEBUG("[%s] Found a ASR RGB LED Controller", ASROCK_DETECTOR_NAME);
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(busses[bus], SMBUS_ADDRESS);
ASRockASRRGBSMBusController* controller = new ASRockASRRGBSMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockASRRGBSMBus* rgb_controller = new RGBController_ASRockASRRGBSMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -119,7 +119,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
case ASROCK_TYPE_POLYCHROME_V1:
{
LOG_DEBUG("[%s] Found a Polychrome v1 Controller", ASROCK_DETECTOR_NAME);
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(busses[bus], SMBUS_ADDRESS);
ASRockPolychromeV1SMBusController* controller = new ASRockPolychromeV1SMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockPolychromeV1SMBus* rgb_controller = new RGBController_ASRockPolychromeV1SMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -129,7 +129,7 @@ DetectedControllers DetectASRockSMBusControllers(std::vector<i2c_smbus_interface
case ASROCK_TYPE_POLYCHROME_V2:
{
LOG_DEBUG("[%s] Found a Polychrome v2 Controller", ASROCK_DETECTOR_NAME);
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(busses[bus], SMBUS_ADDRESS);
ASRockPolychromeV2SMBusController* controller = new ASRockPolychromeV2SMBusController(buses[bus], SMBUS_ADDRESS);
controller-> fw_version = version.u16;
RGBController_ASRockPolychromeV2SMBus* rgb_controller = new RGBController_ASRockPolychromeV2SMBus(controller);
detected_controllers.push_back(rgb_controller);
@@ -125,6 +125,13 @@ RGBController_Alienware::RGBController_Alienware(AlienwareController* controller
controller->UpdateDim();
}
RGBController_Alienware::~RGBController_Alienware()
{
Shutdown();
delete controller;
}
void RGBController_Alienware::SetupZones()
{
/*-------------------------------------------------*\
@@ -19,6 +19,7 @@ class RGBController_Alienware : public RGBController
{
public:
RGBController_Alienware(AlienwareController* controller_ptr);
~RGBController_Alienware();
void SetupZones();
@@ -278,6 +278,8 @@ RGBController_AlienwareAW410K::RGBController_AlienwareAW410K(AlienwareAW410KCont
RGBController_AlienwareAW410K::~RGBController_AlienwareAW410K()
{
Shutdown();
delete controller;
}
@@ -311,7 +313,7 @@ void RGBController_AlienwareAW410K::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
led_values.push_back(led_names[led_idx].idx);
leds.push_back(new_led);
}
@@ -327,14 +329,14 @@ void RGBController_AlienwareAW410K::DeviceUpdateLEDs()
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
SelectedButtons key;
SelectedButtons key;
key.idx = (unsigned char)leds[led_idx].value;
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
key.idx = led_values[led_idx];
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
frame_buf_keys.push_back(key);
frame_buf_keys.push_back(key);
}
controller->SendInitialize();
@@ -356,7 +358,7 @@ void RGBController_AlienwareAW410K::DeviceUpdateZoneLEDs(int zone)
void RGBController_AlienwareAW410K::DeviceUpdateSingleLED(int led)
{
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
}
void RGBController_AlienwareAW410K::DeviceUpdateMode()
@@ -32,4 +32,5 @@ public:
private:
AlienwareAW410KController* controller;
std::vector<RGBColor> current_colors;
std::vector<unsigned char> led_values;
};
@@ -277,6 +277,8 @@ RGBController_AlienwareAW510K::RGBController_AlienwareAW510K(AlienwareAW510KCont
RGBController_AlienwareAW510K::~RGBController_AlienwareAW510K()
{
Shutdown();
delete controller;
}
@@ -310,7 +312,7 @@ void RGBController_AlienwareAW510K::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
led_values.push_back(led_names[led_idx].idx);
leds.push_back(new_led);
}
@@ -326,7 +328,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs()
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
if (current_colors[led_idx]==new_colors[led_idx])
if(current_colors[led_idx] == new_colors[led_idx])
{
/*-------------------------------------------------*\
| Don't send if key color is not changed |
@@ -334,28 +336,14 @@ void RGBController_AlienwareAW510K::DeviceUpdateLEDs()
continue;
}
if(RGBGetRValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00 || RGBGetBValue(colors[led_idx]) != 0x00)
{
SelectedKeys key;
SelectedKeys key;
key.idx = (unsigned char)leds[led_idx].value;
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
key.idx = led_values[led_idx];
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
frame_buf_keys.push_back(key);
}
else
{
SelectedKeys key;
key.idx = (unsigned char)leds[led_idx].value;
key.red = RGBGetRValue(colors[led_idx]);
key.green = RGBGetGValue(colors[led_idx]);
key.blue = RGBGetBValue(colors[led_idx]);
frame_buf_keys.push_back(key);
}
frame_buf_keys.push_back(key);
}
controller->SendInitialize();
@@ -377,7 +365,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateZoneLEDs(int zone)
void RGBController_AlienwareAW510K::DeviceUpdateSingleLED(int led)
{
controller->DeviceUpdateSingleLED(leds[led].value, RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
controller->DeviceUpdateSingleLED(led_values[led], RGBGetRValue(colors[led]), RGBGetGValue(colors[led]), RGBGetBValue(colors[led]));
}
void RGBController_AlienwareAW510K::DeviceUpdateMode()
@@ -31,4 +31,5 @@ public:
private:
AlienwareAW510KController* controller;
std::vector<RGBColor> current_colors;
std::vector<unsigned char> led_values;
};
@@ -11,6 +11,13 @@
#include "RGBController_AlienwareAW3423DWF.h"
static const unsigned char led_values[] =
{
0x01,
0x02,
0x08
};
/**------------------------------------------------------------------*\
@name AW3423DWF
@category Accessory
@@ -46,6 +53,8 @@ RGBController_AlienwareAW3423DWF::RGBController_AlienwareAW3423DWF(AlienwareAW34
RGBController_AlienwareAW3423DWF::~RGBController_AlienwareAW3423DWF()
{
Shutdown();
delete controller;
}
@@ -61,7 +70,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led Logo_LED;
Logo_LED.name = "Logo";
Logo_LED.value = 0x01;
leds.push_back(Logo_LED);
zone Number;
@@ -74,7 +82,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led Number_LED;
Number_LED.name = "Number";
Number_LED.value = 0x02;
leds.push_back(Number_LED);
zone PowerButton;
@@ -87,7 +94,6 @@ void RGBController_AlienwareAW3423DWF::SetupZones()
led PowerButton_LED;
PowerButton_LED.name = "Power Button";
PowerButton_LED.value = 0x08;
leds.push_back(PowerButton_LED);
SetupColors();
@@ -126,7 +132,7 @@ void RGBController_AlienwareAW3423DWF::DeviceUpdateSingleLED(int led)
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
controller->SendColor(leds[led].value, red, grn, blu);
controller->SendColor(led_values[led], red, grn, blu);
}
void RGBController_AlienwareAW3423DWF::DeviceUpdateMode()
@@ -11,6 +11,13 @@
#include "RGBController_AlienwareMonitor.h"
static const unsigned char led_values[] =
{
0x01,
0x02,
0x08
};
/**------------------------------------------------------------------*\
@name Alienware Monitor
@category Accessory
@@ -46,6 +53,8 @@ RGBController_AlienwareMonitor::RGBController_AlienwareMonitor(AlienwareMonitorC
RGBController_AlienwareMonitor::~RGBController_AlienwareMonitor()
{
Shutdown();
delete controller;
}
@@ -61,7 +70,6 @@ void RGBController_AlienwareMonitor::SetupZones()
led Logo_LED;
Logo_LED.name = "Logo";
Logo_LED.value = 0x01;
leds.push_back(Logo_LED);
zone Number;
@@ -74,7 +82,6 @@ void RGBController_AlienwareMonitor::SetupZones()
led Number_LED;
Number_LED.name = "Number";
Number_LED.value = 0x02;
leds.push_back(Number_LED);
zone PowerButton;
@@ -87,7 +94,6 @@ void RGBController_AlienwareMonitor::SetupZones()
led PowerButton_LED;
PowerButton_LED.name = "Power Button";
PowerButton_LED.value = 0x08;
leds.push_back(PowerButton_LED);
SetupColors();
@@ -126,7 +132,7 @@ void RGBController_AlienwareMonitor::DeviceUpdateSingleLED(int led)
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);
unsigned char blu = RGBGetBValue(colors[led]);
controller->SendColor(leds[led].value, red, grn, blu);
controller->SendColor(led_values[led], red, grn, blu);
}
void RGBController_AlienwareMonitor::DeviceUpdateMode()
@@ -38,76 +38,69 @@ static const unsigned int zone_sizes[] =
LED_COUNT,
};
typedef struct
static const char* led_names[] =
{
const char * name;
const unsigned char idx;
} annepro2_led_type;
static const annepro2_led_type led_names[] =
{
/* Key Label Index */
{ KEY_EN_ESCAPE, 0 },
{ KEY_EN_1, 1 },
{ KEY_EN_2, 2 },
{ KEY_EN_3, 3 },
{ KEY_EN_4, 4 },
{ KEY_EN_5, 5 },
{ KEY_EN_6, 6 },
{ KEY_EN_7, 7 },
{ KEY_EN_8, 8 },
{ KEY_EN_9, 9 },
{ KEY_EN_0, 10 },
{ KEY_EN_MINUS, 11 },
{ KEY_EN_EQUALS, 12 },
{ KEY_EN_BACKSPACE, 13 },
{ KEY_EN_TAB, 14 },
{ KEY_EN_Q, 15 },
{ KEY_EN_W, 16 },
{ KEY_EN_E, 17 },
{ KEY_EN_R, 18 },
{ KEY_EN_T, 19 },
{ KEY_EN_Y, 20 },
{ KEY_EN_U, 21 },
{ KEY_EN_I, 22 },
{ KEY_EN_O, 23 },
{ KEY_EN_P, 24 },
{ KEY_EN_LEFT_BRACKET, 25 },
{ KEY_EN_RIGHT_BRACKET, 26 },
{ KEY_EN_ANSI_BACK_SLASH, 27 },
{ KEY_EN_CAPS_LOCK, 28 },
{ KEY_EN_A, 29 },
{ KEY_EN_S, 30 },
{ KEY_EN_D, 31 },
{ KEY_EN_F, 32 },
{ KEY_EN_G, 33 },
{ KEY_EN_H, 34 },
{ KEY_EN_J, 35 },
{ KEY_EN_K, 36 },
{ KEY_EN_L, 37 },
{ KEY_EN_SEMICOLON, 38 },
{ KEY_EN_QUOTE, 39 },
{ KEY_EN_ANSI_ENTER, 40 },
{ KEY_EN_LEFT_SHIFT, 41 },
{ KEY_EN_Z, 42 },
{ KEY_EN_X, 43 },
{ KEY_EN_C, 44 },
{ KEY_EN_V, 45 },
{ KEY_EN_B, 46 },
{ KEY_EN_N, 47 },
{ KEY_EN_M, 48 },
{ KEY_EN_COMMA, 49 },
{ KEY_EN_PERIOD, 50 },
{ KEY_EN_FORWARD_SLASH, 51 },
{ KEY_EN_RIGHT_SHIFT, 52 },
{ KEY_EN_LEFT_CONTROL, 53 },
{ KEY_EN_LEFT_WINDOWS, 54 },
{ KEY_EN_LEFT_ALT, 55 },
{ KEY_EN_SPACE, 56 },
{ KEY_EN_RIGHT_ALT, 57 },
{ KEY_EN_RIGHT_FUNCTION, 58 },
{ KEY_EN_MENU, 59 },
{ KEY_EN_RIGHT_CONTROL, 60 },
KEY_EN_ESCAPE,
KEY_EN_1,
KEY_EN_2,
KEY_EN_3,
KEY_EN_4,
KEY_EN_5,
KEY_EN_6,
KEY_EN_7,
KEY_EN_8,
KEY_EN_9,
KEY_EN_0,
KEY_EN_MINUS,
KEY_EN_EQUALS,
KEY_EN_BACKSPACE,
KEY_EN_TAB,
KEY_EN_Q,
KEY_EN_W,
KEY_EN_E,
KEY_EN_R,
KEY_EN_T,
KEY_EN_Y,
KEY_EN_U,
KEY_EN_I,
KEY_EN_O,
KEY_EN_P,
KEY_EN_LEFT_BRACKET,
KEY_EN_RIGHT_BRACKET,
KEY_EN_ANSI_BACK_SLASH,
KEY_EN_CAPS_LOCK,
KEY_EN_A,
KEY_EN_S,
KEY_EN_D,
KEY_EN_F,
KEY_EN_G,
KEY_EN_H,
KEY_EN_J,
KEY_EN_K,
KEY_EN_L,
KEY_EN_SEMICOLON,
KEY_EN_QUOTE,
KEY_EN_ANSI_ENTER,
KEY_EN_LEFT_SHIFT,
KEY_EN_Z,
KEY_EN_X,
KEY_EN_C,
KEY_EN_V,
KEY_EN_B,
KEY_EN_N,
KEY_EN_M,
KEY_EN_COMMA,
KEY_EN_PERIOD,
KEY_EN_FORWARD_SLASH,
KEY_EN_RIGHT_SHIFT,
KEY_EN_LEFT_CONTROL,
KEY_EN_LEFT_WINDOWS,
KEY_EN_LEFT_ALT,
KEY_EN_SPACE,
KEY_EN_RIGHT_ALT,
KEY_EN_RIGHT_FUNCTION,
KEY_EN_MENU,
KEY_EN_RIGHT_CONTROL,
};
/**------------------------------------------------------------------*\
@@ -144,6 +137,8 @@ RGBController_AnnePro2::RGBController_AnnePro2(AnnePro2Controller* controller_pt
RGBController_AnnePro2::~RGBController_AnnePro2()
{
Shutdown();
delete controller;
}
@@ -175,8 +170,7 @@ void RGBController_AnnePro2::SetupZones()
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
new_led.name = led_names[led_idx];
leds.push_back(new_led);
}
@@ -192,7 +186,7 @@ void RGBController_AnnePro2::DeviceUpdateLEDs()
| TODO: Send packets with multiple LED frames |
\*---------------------------------------------------------*/
std::size_t led_real_idx = 0;
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
for(std::size_t led_idx = 0; led_idx < colors.size(); led_idx++)
{
frame_buf[(led_real_idx * 3) + 0] = RGBGetRValue(colors[led_idx]);
frame_buf[(led_real_idx * 3) + 1] = RGBGetGValue(colors[led_idx]);
@@ -55,6 +55,8 @@ RGBController_Arctic::RGBController_Arctic(ArcticController* controller_ptr)
RGBController_Arctic::~RGBController_Arctic()
{
Shutdown();
keepalive_thread_run = false;
keepalive_thread.join();
delete controller;
@@ -73,7 +75,6 @@ void RGBController_Arctic::SetupZones()
led Led;
Led.name = LedZone.name + " LED";
Led.value = channel;
zones.push_back(LedZone);
leds.push_back(Led);
@@ -125,6 +125,8 @@ RGBController_Areson::RGBController_Areson(AresonController* controller_ptr)
RGBController_Areson::~RGBController_Areson()
{
Shutdown();
delete controller;
}
@@ -45,6 +45,13 @@ RGBController_AuraCore::RGBController_AuraCore(AuraCoreController* controller_pt
SetupZones();
}
RGBController_AuraCore::~RGBController_AuraCore()
{
Shutdown();
delete controller;
}
void RGBController_AuraCore::SetupKeyboard()
{
name = "ASUS Aura Keyboard";
@@ -170,11 +177,6 @@ void RGBController_AuraCore::SetupGA15DH()
modes.push_back(Static);
}
RGBController_AuraCore::~RGBController_AuraCore()
{
delete controller;
}
void RGBController_AuraCore::SetupZones()
{
zone auraZone;
@@ -268,6 +268,8 @@ RGBController_AsusAuraCoreLaptop::RGBController_AsusAuraCoreLaptop(AsusAuraCoreL
RGBController_AsusAuraCoreLaptop::~RGBController_AsusAuraCoreLaptop()
{
Shutdown();
delete controller;
}
@@ -349,11 +351,14 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
new_zone.leds_count = new_kb.GetKeyCount();
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
{
led new_led;
led new_led;
unsigned int new_led_value;
new_led.name = new_kb.GetKeyNameAt(led_idx);
new_led.value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led.value);
new_led_value = new_kb.GetKeyValueAt(led_idx);
max_led_value = std::max(max_led_value, new_led_value);
led_values.push_back(new_led_value);
leds.push_back(new_led);
}
}
@@ -383,24 +388,12 @@ void RGBController_AsusAuraCoreLaptop::SetupZones()
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
buffer_map[leds[led_idx].value] = &colors[led_idx];
buffer_map[led_values[led_idx]] = &colors[led_idx];
}
}
void RGBController_AsusAuraCoreLaptop::DeviceUpdateLEDs()
{
for(size_t i = 85; i < leds.size(); i++)
{
LOG_DEBUG("[%s] Setting %s @ LED index %d and buffer index %d to R: %02X G: %02X B: %02X",
name.c_str(),
leds[i].name.c_str(),
i,
leds[i].value,
RGBGetRValue(colors[i]),
RGBGetGValue(colors[i]),
RGBGetBValue(colors[i]));
}
controller->SetLedsDirect(buffer_map);
}
@@ -33,6 +33,7 @@ public:
private:
RGBColor null_color = 0;
std::vector<RGBColor *> buffer_map;
std::vector<unsigned int> led_values;
AsusAuraCoreLaptopController* controller;
};
@@ -32,7 +32,7 @@ std::string AuraGPUController::GetDeviceName()
std::string AuraGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -79,7 +79,7 @@ void AuraGPUController::AuraGPURegisterWrite(unsigned char reg, unsigned char va
bool AuraGPUController::SaveOnlyApplies()
{
switch (bus->pci_subsystem_device)
switch (bus->info.pci_subsystem_device)
{
case ASUS_VEGA64_STRIX:
return false;
@@ -21,7 +21,7 @@
bool TestForAsusAuraGPUController(i2c_smbus_interface* bus, unsigned char address)
{
if(bus->pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
if(bus->info.pci_vendor == AMD_GPU_VEN && !is_amd_gpu_i2c_bus(bus))
{
return false;
}
@@ -124,6 +124,8 @@ RGBController_AuraGPU::RGBController_AuraGPU(AuraGPUController * controller_ptr)
RGBController_AuraGPU::~RGBController_AuraGPU()
{
Shutdown();
delete controller;
}
@@ -112,6 +112,8 @@ RGBController_AuraHeadsetStand::RGBController_AuraHeadsetStand(AuraHeadsetStandC
RGBController_AuraHeadsetStand::~RGBController_AuraHeadsetStand()
{
Shutdown();
delete controller;
}
@@ -380,6 +380,8 @@ RGBController_AuraKeyboard::RGBController_AuraKeyboard(AuraKeyboardController* c
RGBController_AuraKeyboard::~RGBController_AuraKeyboard()
{
Shutdown();
delete controller;
}
@@ -469,8 +471,8 @@ void RGBController_AuraKeyboard::SetupZones()
{
led new_led;
new_led.name = led_names[led_idx].name;
new_led.value = led_names[led_idx].idx;
led_values.push_back(led_names[led_idx].idx);
leds.push_back(new_led);
}
@@ -491,7 +493,7 @@ void RGBController_AuraKeyboard::DeviceUpdateLEDs()
\*---------------------------------------------------------*/
for(std::size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
frame_buf[(led_idx * 4) + 0] = leds[led_idx].value;
frame_buf[(led_idx * 4) + 0] = led_values[led_idx];
frame_buf[(led_idx * 4) + 1] = RGBGetRValue(colors[led_idx]);
frame_buf[(led_idx * 4) + 2] = RGBGetGValue(colors[led_idx]);
frame_buf[(led_idx * 4) + 3] = RGBGetBValue(colors[led_idx]);
@@ -54,4 +54,5 @@ public:
private:
AuraKeyboardController* controller;
AuraKeyboardMappingLayoutType layout;
std::vector<unsigned char> led_values;
};
@@ -45,6 +45,8 @@ RGBController_AuraMonitor::RGBController_AuraMonitor(AuraMonitorController* cont
RGBController_AuraMonitor::~RGBController_AuraMonitor()
{
Shutdown();
delete controller;
}
@@ -22,6 +22,7 @@
#define AURA_ROG_GLADIUS_II_WIRELESS_1_PID 0x189E
#define AURA_ROG_GLADIUS_II_WIRELESS_2_PID 0x18A0
#define AURA_ROG_GLADIUS_III_PID 0x197B
#define AURA_ROG_GLADIUS_III_CORE_PID 0x1C8D
#define AURA_ROG_GLADIUS_III_WIRELESS_USB_PID 0x197D
#define AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID 0x197F
#define AURA_ROG_GLADIUS_III_WIRELESS_BT_PID 0x1981
@@ -217,6 +218,20 @@ static std::map<int,mouse_type> aura_mouse_devices =
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_WAVE, AURA_MOUSE_MODE_REACTIVE, AURA_MOUSE_MODE_COMET, AURA_MOUSE_MODE_BATTERY }
}
},
{
AURA_ROG_GLADIUS_III_CORE_PID, // ROG Gladius III Core
{
0,
0,
0,
100,
false,
1,
false,
{ AURA_MOUSE_ZONE_LOGO, AURA_MOUSE_ZONE_SCROLL },
{ AURA_MOUSE_MODE_STATIC, AURA_MOUSE_MODE_BREATHING, AURA_MOUSE_MODE_SPECTRUM, AURA_MOUSE_MODE_NONE, AURA_MOUSE_MODE_REACTIVE }
}
},
{
AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, // ROG Gladius III Wireless USB
{
@@ -185,6 +185,8 @@ RGBController_AuraMouse::RGBController_AuraMouse(AuraMouseController* controller
RGBController_AuraMouse::~RGBController_AuraMouse()
{
Shutdown();
delete controller;
}
@@ -205,8 +207,8 @@ void RGBController_AuraMouse::SetupZones()
led mouse_led;
mouse_led.name = mouse_zone.name + " LED";
mouse_led.value = *zone_it;
led_values.push_back(*zone_it);
leds.push_back(mouse_led);
}
@@ -245,7 +247,7 @@ void RGBController_AuraMouse::DeviceUpdateSingleLED(int led)
uint8_t grn = RGBGetGValue(colors[led]);
uint8_t blu = RGBGetBValue(colors[led]);
controller->SendUpdate(leds[led].value, modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
controller->SendUpdate(led_values[led], modes[active_mode].value, red, grn, blu, 0, false, 0, modes[active_mode].brightness);
}
void RGBController_AuraMouse::DeviceUpdateMode()
@@ -31,5 +31,6 @@ public:
private:
AuraMouseController* controller;
std::vector<uint8_t> led_values;
uint16_t pid;
};
@@ -116,6 +116,8 @@ RGBController_AsusROGSpatha::RGBController_AsusROGSpatha(AsusAuraMouseGen1Contro
RGBController_AsusROGSpatha::~RGBController_AsusROGSpatha()
{
Shutdown();
delete controller;
}
@@ -139,7 +141,6 @@ void RGBController_AsusROGSpatha::SetupZones()
led spatha_led;
spatha_led.name = zones_names[i];
spatha_led.value = 1;
leds.push_back(spatha_led);
}
@@ -79,6 +79,8 @@ RGBController_AsusROGStrixEvolve::RGBController_AsusROGStrixEvolve(AsusAuraMouse
RGBController_AsusROGStrixEvolve::~RGBController_AsusROGStrixEvolve()
{
Shutdown();
delete controller;
}
@@ -97,7 +99,6 @@ void RGBController_AsusROGStrixEvolve::SetupZones()
led mouse_led;
mouse_led.name = "Underglow";
mouse_led.value = 1;
leds.push_back(mouse_led);
@@ -182,6 +182,8 @@ RGBController_AuraMousemat::RGBController_AuraMousemat(AuraMousematController* c
RGBController_AuraMousemat::~RGBController_AuraMousemat()
{
Shutdown();
delete controller;
}
@@ -19,7 +19,10 @@ AsusAuraRyuoAIOController::AsusAuraRyuoAIOController(hid_device* dev_handle, con
| Manually adding device info for now |
| TODO: Implement config table accurately |
\*-----------------------------------------------------*/
device_info.push_back({0x00, 0x00, 12, 0, AuraDeviceType::FIXED});
uint8_t leds = (dev_name.find("Ryujin") != std::string::npos) ? 5 : 12;
device_info.push_back({0x00, 0x00, leds, 0, AuraDeviceType::FIXED});
}
AsusAuraRyuoAIOController::~AsusAuraRyuoAIOController()
@@ -128,6 +128,8 @@ RGBController_AsusAuraRyuoAIO::RGBController_AsusAuraRyuoAIO(AsusAuraRyuoAIOCont
RGBController_AsusAuraRyuoAIO::~RGBController_AsusAuraRyuoAIO()
{
Shutdown();
delete controller;
}
@@ -161,7 +163,6 @@ void RGBController_AsusAuraRyuoAIO::SetupZones()
new_led.name = zones[zone_idx].name;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = lp_idx;
leds.push_back(new_led);
}
@@ -410,6 +410,8 @@ RGBController_AuraTUFKeyboard::RGBController_AuraTUFKeyboard(AuraTUFKeyboardCont
RGBController_AuraTUFKeyboard::~RGBController_AuraTUFKeyboard()
{
Shutdown();
delete controller;
}
@@ -518,7 +520,7 @@ void RGBController_AuraTUFKeyboard::SetupZones()
{
led new_led;
new_led.name = keyboard[layout].led_names[led_id].name;
new_led.value = keyboard[layout].led_names[led_id].id;
led_values.push_back(keyboard[layout].led_names[led_id].id);
leds.push_back(new_led);
}
@@ -536,7 +538,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateLEDs()
for(size_t i = 0; i < colors.size(); i++)
{
led_color_list.push_back({ leds[i].value, colors[i] });
led_color_list.push_back({ led_values[i], colors[i] });
}
controller->UpdateLeds(led_color_list);
@@ -558,7 +560,7 @@ void RGBController_AuraTUFKeyboard::DeviceUpdateSingleLED(int led)
unsigned char green = RGBGetGValue(colors[led]);
unsigned char blue = RGBGetBValue(colors[led]);
controller->UpdateSingleLed(leds[led].value, red, green, blue);
controller->UpdateSingleLed(led_values[led], red, green, blue);
}
static const uint8_t direction_map[2][6] =
@@ -53,4 +53,5 @@ public:
private:
AuraTUFKeyboardController* controller;
uint16_t pid;
std::vector<uint8_t> led_values;
};
@@ -119,6 +119,8 @@ RGBController_AuraUSB::RGBController_AuraUSB(AuraUSBController* controller_ptr)
RGBController_AuraUSB::~RGBController_AuraUSB()
{
Shutdown();
delete controller;
}
@@ -145,41 +147,68 @@ void RGBController_AuraUSB::SetupZones()
| Set zones and leds |
\*-------------------------------------------------*/
int addressableCounter = 1;
for (unsigned int channel_idx = 0; channel_idx < zones.size(); channel_idx++)
for(std::size_t channel_idx = 0; channel_idx < zones.size(); channel_idx++)
{
AuraDeviceInfo device_info = controller->GetAuraDevices()[channel_idx];
zones[channel_idx].type = ZONE_TYPE_LINEAR;
if(device_info.device_type == AuraDeviceType::FIXED)
{
zones[channel_idx].name = "Aura Mainboard";
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
zones[channel_idx].name = "Aura Mainboard";
zones[channel_idx].type = ZONE_TYPE_LINEAR;
zones[channel_idx].leds_min = device_info.num_leds;
zones[channel_idx].leds_max = device_info.num_leds;
zones[channel_idx].leds_count = device_info.num_leds;
}
else
{
zones[channel_idx].name = "Aura Addressable ";
zones[channel_idx].name.append(std::to_string(addressableCounter));
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
addressableCounter++;
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = AURA_ADDRESSABLE_MAX_LEDS;
if(first_run)
{
zones[channel_idx].leds_count = 0;
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
zones[channel_idx].name = "Addressable RGB Header ";
zones[channel_idx].name.append(std::to_string(addressableCounter));
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = 0;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(0);
}
addressableCounter++;
}
unsigned int num_mainboard_leds = device_info.num_leds - device_info.num_headers;
for (unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
unsigned led_idx = led_ch_idx + 1;
led new_led;
new_led.name = zones[channel_idx].name;
if(device_info.device_type == AuraDeviceType::FIXED && led_ch_idx >= num_mainboard_leds)
{
new_led.name.append(", RGB Header ");
@@ -189,6 +218,7 @@ void RGBController_AuraUSB::SetupZones()
{
new_led.name.append(", LED ");
}
new_led.name.append(std::to_string(led_idx));
new_led.value = channel_idx;
@@ -200,17 +230,10 @@ void RGBController_AuraUSB::SetupZones()
SetupColors();
}
void RGBController_AuraUSB::DeviceResizeZone(int zone, int new_size)
void RGBController_AuraUSB::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < zones.size())
{
return;
}
if(((unsigned int)new_size >= zones[zone].leds_min) && ((unsigned int)new_size <= zones[zone].leds_max))
{
zones[zone].leds_count = new_size;
SetupZones();
}
}
@@ -24,7 +24,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -120,6 +120,7 @@
#define AURA_TERMINAL_PID 0x1889
#define ROG_STRIX_LC120_PID 0x879E
#define AURA_RYUO_AIO_PID 0x1887
#define AURA_RYUJIN_AIO_PID 0x18AE
#define ASUS_ROG_ALLY_PID 0x1ABE
#define ASUS_ROG_ALLY_X_PID 0x1B4C
@@ -463,6 +464,7 @@ REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Origin COD",
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_1_PID, 1, 0xFF13);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius II Wireless", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_II_WIRELESS_2_PID, 2, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Core", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_CORE_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless USB", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_USB_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless 2.4Ghz", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_2_4_PID, 0, 0xFF01);
REGISTER_HID_DETECTOR_IP("ASUS ROG Gladius III Wireless Bluetooth", DetectAsusAuraUSBMice, AURA_USB_VID, AURA_ROG_GLADIUS_III_WIRELESS_BT_PID, 0, 0xFF01);
@@ -523,6 +525,7 @@ REGISTER_HID_DETECTOR_PU("ASUS ROG PG32UQ", DetectAs
REGISTER_HID_DETECTOR ("ASUS ROG AURA Terminal", DetectAsusAuraUSBTerminal, AURA_USB_VID, AURA_TERMINAL_PID);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Strix LC", DetectAsusAuraUSBROGStrixLC, AURA_USB_VID, ROG_STRIX_LC120_PID, 0x00FF, 1);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryuo AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUO_AIO_PID, 0xFF72, 0x00A1);
REGISTER_HID_DETECTOR_PU ("ASUS ROG Ryujin AIO", DetectAsusAuraUSBRyuoAIO, AURA_USB_VID, AURA_RYUJIN_AIO_PID, 0xFF72, 0x00A1);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_PID, 0);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_PID, 0);
REGISTER_HID_DETECTOR_I ("ASUS ROG Throne QI GUNDAM", DetectAsusAuraUSBHeadsetStand, AURA_USB_VID, AURA_ROG_THRONE_QI_GUNDAM_PID, 0);
@@ -117,6 +117,8 @@ RGBController_AsusROGAlly::RGBController_AsusROGAlly(ROGAllyController* controll
RGBController_AsusROGAlly::~RGBController_AsusROGAlly()
{
Shutdown();
delete controller;
}
@@ -129,6 +129,8 @@ RGBController_AsusROGStrixLC::RGBController_AsusROGStrixLC(AsusROGStrixLCControl
RGBController_AsusROGStrixLC::~RGBController_AsusROGStrixLC()
{
Shutdown();
delete controller;
}
@@ -162,7 +164,6 @@ void RGBController_AsusROGStrixLC::SetupZones()
new_led.name = zones[zone_idx].name;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = lp_idx;
leds.push_back(new_led);
}
@@ -283,6 +283,8 @@ RGBController_AsusCerberusKeyboard::RGBController_AsusCerberusKeyboard(AsusCerbe
RGBController_AsusCerberusKeyboard::~RGBController_AsusCerberusKeyboard()
{
Shutdown();
delete controller;
}
@@ -165,6 +165,8 @@ RGBController_AsusSagarisKeyboard::RGBController_AsusSagarisKeyboard(AsusSagaris
RGBController_AsusSagarisKeyboard::~RGBController_AsusSagarisKeyboard()
{
Shutdown();
delete controller;
}
@@ -71,7 +71,6 @@ void RGBController_StrixClaw::SetupZones()
led scroll_wheel_led;
scroll_wheel_led.name = "Scroll Wheel LED";
scroll_wheel_led.value = 1;
leds.push_back(scroll_wheel_led);
@@ -88,7 +87,6 @@ void RGBController_StrixClaw::SetupZones()
led logo_led;
logo_led.name = "Logo LED";
logo_led.value = 1;
leds.push_back(logo_led);
@@ -89,7 +89,7 @@ void AsusMonitorController::SetDirect(std::vector<RGBColor> colors)
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = 0x40;
usb_buf[0x02] = 0x84;
usb_buf[0x04] = colors.size();
usb_buf[0x04] = (uint8_t)colors.size();
for(size_t i = 0; i < colors.size(); i++)
{
@@ -46,6 +46,8 @@ RGBController_AsusMonitor::RGBController_AsusMonitor(AsusMonitorController* cont
RGBController_AsusMonitor::~RGBController_AsusMonitor()
{
Shutdown();
delete controller;
}
@@ -92,6 +92,13 @@ RGBController_AsusTUFLaptopLinux::RGBController_AsusTUFLaptopLinux(AsusTUFLaptop
SetupZones();
}
RGBController_AsusTUFLaptopLinux::~RGBController_AsusTUFLaptopLinux()
{
Shutdown();
delete controller;
}
void RGBController_AsusTUFLaptopLinux::SetupZones()
{
/*---------------------------------------------------------*\
@@ -16,6 +16,7 @@ class RGBController_AsusTUFLaptopLinux : public RGBController
{
public:
RGBController_AsusTUFLaptopLinux(AsusTUFLaptopLinuxController* controller_ptr);
~RGBController_AsusTUFLaptopLinux();
void SetupZones();
@@ -85,6 +85,8 @@ RGBController_AsusTUFLaptopWMI::RGBController_AsusTUFLaptopWMI(AsusTUFLaptopCont
RGBController_AsusTUFLaptopWMI::~RGBController_AsusTUFLaptopWMI()
{
Shutdown();
delete controller;
}
@@ -44,86 +44,90 @@ RGBController_BlinkyTape::RGBController_BlinkyTape(BlinkyTapeController* control
RGBController_BlinkyTape::~RGBController_BlinkyTape()
{
Shutdown();
delete controller;
}
void RGBController_BlinkyTape::SetupZones()
{
zones.clear();
/*-------------------------------------------------*\
| Only set LED count on the first run |
\*-------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(1);
zone led_zone;
led_zone.name = "LED Strip";
led_zone.type = ZONE_TYPE_LINEAR;
led_zone.leds_min = 0;
led_zone.leds_max = 512;
led_zone.leds_count = 0;
zones.push_back(led_zone);
/*-----------------------------------------------------*\
| Set up zones |
\*-----------------------------------------------------*/
zones[0].leds_min = 0;
zones[0].leds_max = 512;
DeviceResizeZone(0, led_zone.leds_count);
}
void RGBController_BlinkyTape::DeviceResizeZone(int zone, int new_size)
{
/*-------------------------------------------------*\
| Explicitly cast these to avoid compiler warnings |
\*-------------------------------------------------*/
const unsigned int zone_u = static_cast<unsigned int>(zone);
const unsigned int new_size_u = static_cast<unsigned int>(new_size);
/*-------------------------------------------------*\
| Check that the zone is in bounds |
\*-------------------------------------------------*/
if((zone_u > zones.size()) || (zone < 0))
if(first_run)
{
return;
zones[0].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
/*-------------------------------------------------*\
| And that the new size is in bounds |
\*-------------------------------------------------*/
if((new_size_u > zones.at(zone).leds_max) || (new_size_u < zones.at(zone).leds_min))
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
return;
zones[0].name = "Addressable RGB Header";
}
/*-------------------------------------------------*\
| And that there's actually a change |
\*-------------------------------------------------*/
if(zones.at(zone).leds_count == new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
return;
zones[0].leds_count = 0;
}
/*-------------------------------------------------*\
| If the new size is less than the current size, |
| just chop off the end |
\*-------------------------------------------------*/
if(leds.size() > new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
leds.resize(new_size);
zones[0].type = ZONE_TYPE_LINEAR;
}
/*-------------------------------------------------*\
| Otherwise, add new LEDs to the end |
\*-------------------------------------------------*/
if(leds.size() < new_size_u)
if(!(zones[0].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
for(size_t led_idx = leds.size(); led_idx < new_size_u; led_idx++)
{
led new_led;
new_led.name = "LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
zones[0].matrix_map.width = 0;
zones[0].matrix_map.height = 0;
zones[0].matrix_map.map.resize(0);
}
zones.at(zone).leds_count = new_size;
/*-----------------------------------------------------*\
| Set up LEDs |
\*-----------------------------------------------------*/
for(size_t led_idx = leds.size(); led_idx < zones[0].leds_count; led_idx++)
{
led new_led;
new_led.name = zones[0].name + ", LED ";
new_led.name.append(std::to_string(led_idx));
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_BlinkyTape::DeviceConfigureZone(int zone_idx)
{
if((size_t)zone_idx < zones.size())
{
SetupZones();
}
}
void RGBController_BlinkyTape::DeviceUpdateLEDs()
{
controller->SetLEDs(colors);
@@ -23,7 +23,7 @@ public:
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
@@ -312,6 +312,8 @@ RGBController_CherryKeyboard::RGBController_CherryKeyboard(CherryKeyboardControl
RGBController_CherryKeyboard::~RGBController_CherryKeyboard()
{
Shutdown();
delete controller;
}
@@ -10,8 +10,9 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "ClevoKeyboardController.h"
#include <cstring>
#include "ClevoKeyboardController.h"
#include "StringUtils.h"
ClevoKeyboardController::ClevoKeyboardController(hid_device* dev_handle, const hid_device_info& info)
{
@@ -40,10 +41,7 @@ std::string ClevoKeyboardController::GetSerialString()
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
return(StringUtils::wstring_to_string(serial_string));
}
std::string ClevoKeyboardController::GetFirmwareVersion()
@@ -9,8 +9,8 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "ClevoKeyboardController.h"
#include "DetectionManager.h"
#include "RGBController_ClevoKeyboard.h"
#include "RGBController.h"
#include <hidapi.h>
@@ -26,7 +26,7 @@
\*---------------------------------------------------------*/
#define CLEVO_KEYBOARD_PID_600B 0x600B
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& name)
DetectedControllers DetectClevoKeyboardControllers(hid_device_info* info, const std::string& /*name*/)
{
DetectedControllers detected_controllers;
hid_device* dev;
@@ -199,6 +199,8 @@ RGBController_ClevoKeyboard::RGBController_ClevoKeyboard(ClevoKeyboardController
RGBController_ClevoKeyboard::~RGBController_ClevoKeyboard()
{
Shutdown();
delete controller;
}
@@ -239,9 +241,9 @@ void RGBController_ClevoKeyboard::SetupZones()
led new_led;
new_led.name = new_kb.GetKeyNameAt(led_idx);
new_led.value = new_kb.GetKeyValueAt(led_idx);
leds.push_back(new_led);
led_values.push_back(new_kb.GetKeyValueAt(led_idx));
}
SetupColors();
@@ -256,7 +258,7 @@ void RGBController_ClevoKeyboard::SetupZones()
for(size_t led_idx = 0; led_idx < leds.size(); led_idx++)
{
buffer_map[leds[led_idx].value] = &colors[led_idx];
buffer_map[led_values[led_idx]] = &colors[led_idx];
}
}
@@ -32,5 +32,6 @@ public:
private:
ClevoKeyboardController* controller;
std::vector<RGBColor*> buffer_map;
std::vector<unsigned int> led_values;
RGBColor null_color;
};
@@ -10,8 +10,9 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "ClevoLightbarController.h"
#include <cstring>
#include "ClevoLightbarController.h"
#include "StringUtils.h"
ClevoLightbarController::ClevoLightbarController(hid_device* dev_handle, const hid_device_info& info)
{
@@ -40,10 +41,7 @@ std::string ClevoLightbarController::GetSerialString()
return("");
}
std::wstring return_wstring = serial_string;
std::string return_string(return_wstring.begin(), return_wstring.end());
return(return_string);
return(StringUtils::wstring_to_string(serial_string));
}
std::string ClevoLightbarController::GetFirmwareVersion()
@@ -9,8 +9,8 @@
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "DetectionManager.h"
#include "ClevoLightbarController.h"
#include "DetectionManager.h"
#include "RGBController_ClevoLightbar.h"
#include "RGBController.h"
#include <hidapi.h>
@@ -25,7 +25,7 @@
\*---------------------------------------------------------*/
#define CLEVO_LIGHTBAR_PID 0x7001
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& name)
DetectedControllers DetectClevoLightbarControllers(hid_device_info* info, const std::string& /*name*/)
{
DetectedControllers detected_controllers;
hid_device* dev;
@@ -121,6 +121,8 @@ RGBController_ClevoLightbar::RGBController_ClevoLightbar(ClevoLightbarController
RGBController_ClevoLightbar::~RGBController_ClevoLightbar()
{
Shutdown();
delete controller;
}
@@ -26,7 +26,7 @@ ColorfulGPUController::~ColorfulGPUController()
std::string ColorfulGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -45,7 +45,7 @@ void ColorfulGPUController::SetDirect(RGBColor color)
uint8_t g = RGBGetGValue(color);
uint8_t b = RGBGetBValue(color);
if(this->bus->pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
if(this->bus->info.pci_subsystem_device == COLORFUL_IGAME_RTX_4070_VULCAN_OCV)
{
uint8_t data_pkt[COLORFUL_PACKET_LENGTH_V2] = { 0xAA, 0xEF, 0x01, 0x04, 0x88, 0x26 };
for(int i=6; i < COLORFUL_PACKET_LENGTH_V2 -2; i = i + 3)
@@ -1,4 +1,4 @@
/*---------------------------------------------------------*\
/*---------------------------------------------------------*\
| ColorfulGPUControllerDetect.cpp |
| |
| Detector for Colorful GPU |
@@ -52,7 +52,7 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Advanced OC 12G L-V", Detec
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_GA106_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ultra W OC 12G L-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Ultra W OC LHR-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060_ULTRAW_OC_12G_2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3070_ADVANCED_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 3060 Ti Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX3060TI_LHR_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_3060TI_ADVANCED_OC, 0x61);
@@ -76,3 +76,8 @@ REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", Detec
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4080 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4080_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4080_ULTRAW_OCV2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 4090 Advanced OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX4090_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_4090_ADVANCED_OCV2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ultra W OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060_ULTRAW_OC, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5060 Ti Ultra W DUO OC", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5060TI_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5060TI_ULTRAW_DUO_OC_2, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV, 0x61);
REGISTER_I2C_PCI_DETECTOR("iGame GeForce RTX 5070 Ultra W OC-V", DetectColorfulGPUControllers, NVIDIA_VEN, NVIDIA_RTX5070_DEV, COLORFUL_SUB_VEN, COLORFUL_IGAME_RTX_5070_ULTRAW_OCV2, 0x61);
@@ -44,6 +44,8 @@ RGBController_ColorfulGPU::RGBController_ColorfulGPU(ColorfulGPUController * col
RGBController_ColorfulGPU::~RGBController_ColorfulGPU()
{
Shutdown();
delete controller;
}
@@ -24,7 +24,7 @@ ColorfulTuringGPUController::~ColorfulTuringGPUController()
std::string ColorfulTuringGPUController::GetDeviceLocation()
{
std::string return_string(bus->device_name);
std::string return_string(bus->info.device_name);
char addr[5];
snprintf(addr, 5, "0x%02X", dev);
return_string.append(", address ");
@@ -17,7 +17,7 @@ DetectedControllers DetectColorfulTuringGPUControllers(i2c_smbus_interface* bus,
{
DetectedControllers detected_controllers;
if(bus->port_id == 1)
if(bus->info.port_id == 1)
{
ColorfulTuringGPUController* controller = new ColorfulTuringGPUController(bus, i2c_addr, name);
RGBController_ColorfulTuringGPU* rgb_controller = new RGBController_ColorfulTuringGPU(controller);
@@ -75,6 +75,8 @@ RGBController_ColorfulTuringGPU::RGBController_ColorfulTuringGPU(ColorfulTuringG
RGBController_ColorfulTuringGPU::~RGBController_ColorfulTuringGPU()
{
Shutdown();
delete controller;
}
@@ -12,16 +12,27 @@
#include "CMARGBController.h"
#include "StringUtils.h"
CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex)
/*---------------------------------------------------------*\
| Map to convert port index to port ID used in protocol |
\*---------------------------------------------------------*/
static unsigned char cm_argb_port_index_to_id[5] =
{
dev = dev_handle;
location = _path;
zone_index = _zone_idx;
mutex_ptr = cm_mutex;
CM_ARGB_PORT_ARGB_1,
CM_ARGB_PORT_ARGB_2,
CM_ARGB_PORT_ARGB_3,
CM_ARGB_PORT_ARGB_4,
CM_ARGB_PORT_RGB
};
/*---------------------------------------------------------*\
| Get device name from HID manufacturer and product strings |
\*---------------------------------------------------------*/
CMARGBController::CMARGBController(hid_device* dev_handle, char *path)
{
dev = dev_handle;
location = path;
/*-----------------------------------------------------*\
| Get device name from HID manufacturer and product |
| strings |
\*-----------------------------------------------------*/
wchar_t name_string[HID_MAX_STR];
hid_get_manufacturer_string(dev, name_string, HID_MAX_STR);
@@ -29,57 +40,11 @@ CMARGBController::CMARGBController(hid_device* dev_handle, char *_path, unsigned
hid_get_product_string(dev, name_string, HID_MAX_STR);
device_name.append(" ").append(StringUtils::wstring_to_string(name_string));
GetStatus();
}
CMARGBController::~CMARGBController()
{
if(mutex_ptr.use_count() <= 1)
{
hid_close(dev);
}
}
void CMARGBController::GetStatus()
{
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0B, 0x01 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int rgb_offset = 0;
int zone;
if (argb_header_data[zone_index].digital)
{
zone = argb_header_data[zone_index].header;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
}
else
{
zone = 0x00;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
rgb_offset = 1;
}
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
/*---------------------------------------------------------*\
| If this is the group then just return the first status |
\*---------------------------------------------------------*/
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
current_mode = buffer[4 - rgb_offset];
bool_random = ( buffer[5 - rgb_offset] == 0x00 );
current_speed = buffer[6 - rgb_offset];
current_brightness = buffer[7 - rgb_offset];
current_red = buffer[8 - rgb_offset];
current_green = buffer[9 - rgb_offset];
current_blue = buffer[10 - rgb_offset];
hid_close(dev);
}
std::string CMARGBController::GetDeviceName()
@@ -87,6 +52,33 @@ std::string CMARGBController::GetDeviceName()
return(device_name);
}
std::string CMARGBController::GetLocation()
{
return("HID: " + location);
}
std::string CMARGBController::GetVersion()
{
/*-----------------------------------------------------*\
| This device uses the serial value to determine the |
| version. It does not report a proper unique serial. |
\*-----------------------------------------------------*/
std::string serial_string = GetSerial();
if(serial_string == CM_ARGB_FW0023)
{
return("0023");
}
else if(serial_string == CM_ARGB_FW0028)
{
return("0028");
}
else
{
return("Unsupported");
}
}
std::string CMARGBController::GetSerial()
{
wchar_t serial_string[HID_MAX_STR];
@@ -100,118 +92,187 @@ std::string CMARGBController::GetSerial()
return(StringUtils::wstring_to_string(serial_string));
}
std::string CMARGBController::GetLocation()
void CMARGBController::GetPortStatus
(
unsigned char port_idx,
unsigned char* port_mode,
unsigned char* port_speed,
unsigned char* port_brightness,
bool* port_random,
unsigned char* port_red,
unsigned char* port_green,
unsigned char* port_blue
)
{
return("HID: " + location);
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0B, 0x01};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
int rgb_offset = 0;
int zone;
/*-----------------------------------------------------*\
| RGB port is handled differently from ARGB ports |
\*-----------------------------------------------------*/
if(cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB)
{
zone = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
}
else
{
zone = 0x00;
buffer[CM_ARGB_COMMAND_BYTE] = 0x0A;
rgb_offset = 1;
}
/*-----------------------------------------------------*\
| If this is the group then just return the first |
| status |
\*-----------------------------------------------------*/
buffer[CM_ARGB_ZONE_BYTE] = ( zone > 0x08 ) ? 0x01 : zone;
/*-----------------------------------------------------*\
| Send the command and read the response |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
/*-----------------------------------------------------*\
| Read data out of response |
\*-----------------------------------------------------*/
*port_mode = buffer[4 - rgb_offset];
*port_random = (buffer[5 - rgb_offset] == 0x00);
*port_speed = buffer[6 - rgb_offset];
*port_brightness = buffer[7 - rgb_offset];
*port_red = buffer[8 - rgb_offset];
*port_green = buffer[9 - rgb_offset];
*port_blue = buffer[10 - rgb_offset];
}
unsigned char CMARGBController::GetZoneIndex()
void CMARGBController::SetPortLEDCount(unsigned char port_idx, unsigned char led_count)
{
return(zone_index);
}
unsigned char CMARGBController::GetMode()
{
return(current_mode);
}
unsigned char CMARGBController::GetLedRed()
{
return(current_red);
}
unsigned char CMARGBController::GetLedGreen()
{
return(current_green);
}
unsigned char CMARGBController::GetLedBlue()
{
return(current_blue);
}
unsigned char CMARGBController::GetLedSpeed()
{
return(current_speed);
}
bool CMARGBController::GetRandomColours()
{
return(bool_random);
}
void CMARGBController::SetLedCount(int zone, int led_count)
{
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00, 0x80, 0x0D, 0x02 };
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00, 0x80, 0x0D, 0x02};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
buffer[CM_ARGB_ZONE_BYTE] = zone;
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_MODE_BYTE] = led_count;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = (0x0F - led_count > 0) ? 0x0F - led_count : 0x01;
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = 1;
/*-----------------------------------------------------*\
| Send the command |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
}
void CMARGBController::SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours)
void CMARGBController::SetPortMode
(
unsigned char port_idx,
unsigned char port_mode,
unsigned char port_speed,
unsigned char port_brightness,
bool port_random,
unsigned char port_red,
unsigned char port_green,
unsigned char port_blue
)
{
bool needs_update = !( (current_mode == mode) && (current_speed == speed) && (current_brightness == brightness) && (ToRGBColor(current_red, current_green, current_blue) == colour));
unsigned char buffer[CM_ARGB_PACKET_SIZE] = {0x00};
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
bool boolARGB_header = (cm_argb_port_index_to_id[port_idx] != CM_ARGB_PORT_RGB);
bool boolPassthru = (port_mode == CM_ARGB_MODE_PASSTHRU) || (port_mode == CM_RGB_MODE_PASSTHRU);
bool boolDirect = (port_mode == CM_ARGB_MODE_DIRECT);
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
if (needs_update)
if(boolDirect)
{
current_mode = mode;
current_speed = speed;
current_brightness = brightness;
current_red = RGBGetRValue(colour);
current_green = RGBGetGValue(colour);
current_blue = RGBGetBValue(colour);
bool_random = random_colours;
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
SendUpdate();
/*-------------------------------------------------*\
| Send the command |
\*-------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-------------------------------------------------*\
| Direct mode is now set up and no other mode |
| packet is required |
\*-------------------------------------------------*/
return;
}
buffer[CM_ARGB_FUNCTION_BYTE] = function;
/*-----------------------------------------------------*\
| Send the command |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-----------------------------------------------------*\
| ARGB ports send command 0x0B, RGB port sends 0x04 |
\*-----------------------------------------------------*/
if(boolARGB_header)
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B;
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02;
buffer[CM_ARGB_ZONE_BYTE] = cm_argb_port_index_to_id[port_idx];
buffer[CM_ARGB_MODE_BYTE] = port_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = port_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE] = port_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE] = port_brightness;
buffer[CM_ARGB_RED_BYTE] = port_red;
buffer[CM_ARGB_GREEN_BYTE] = port_green;
buffer[CM_ARGB_BLUE_BYTE] = port_blue;
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04;
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = port_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = port_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = port_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = port_brightness;
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = port_red;
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = port_green;
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = port_blue;
}
/*-----------------------------------------------------*\
| Send the command and wait for response |
\*-----------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
}
void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_count)
void CMARGBController::SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count)
{
const unsigned char buffer_size = CM_ARGB_PACKET_SIZE;
unsigned char buffer[buffer_size] = { 0x00, 0x00, 0x07, 0x02 };
unsigned char packet_count = 0;
std::vector<uint8_t> colours;
/*---------------------------------------------*\
| Set up the RGB triplets to send |
\*---------------------------------------------*/
/*-----------------------------------------------------*\
| Set up the RGB triplets to send |
\*-----------------------------------------------------*/
for(unsigned int i = 0; i < led_count; i++)
{
RGBColor colour = led_colours[i];
colours.push_back( RGBGetRValue(colour) );
colours.push_back( RGBGetGValue(colour) );
colours.push_back( RGBGetBValue(colour) );
colours.push_back(RGBGetRValue(colour));
colours.push_back(RGBGetGValue(colour));
colours.push_back(RGBGetBValue(colour));
}
buffer[CM_ARGB_FUNCTION_BYTE] = zone_index - 1;
buffer[CM_ARGB_FUNCTION_BYTE] = port_idx;
buffer[CM_ARGB_ZONE_BYTE] = led_count;
unsigned char buffer_idx = CM_ARGB_MODE_BYTE;
/*---------------------------------------------*\
| Guard the writes to the controller until the |
| for loop has completed to avoid collisons |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
for(std::vector<unsigned char>::iterator it = colours.begin(); it != colours.end(); buffer_idx = CM_ARGB_COMMAND_BYTE)
{
/*-----------------------------------------------------------------*\
| Fill the write buffer till its full or the colour buffer is empty |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| Fill the write buffer till its full or the |
| colour buffer is empty |
\*-------------------------------------------------*/
buffer[CM_ARGB_REPORT_BYTE] = packet_count;
while (( buffer_idx < buffer_size) && ( it != colours.end() ))
while((buffer_idx < buffer_size) && (it != colours.end()))
{
buffer[buffer_idx] = *it;
buffer_idx++;
@@ -223,76 +284,15 @@ void CMARGBController::SetLedsDirect(RGBColor *led_colours, unsigned int led_cou
buffer[CM_ARGB_REPORT_BYTE] += 0x80;
}
/*-------------------------------------------------*\
| Send the buffer |
\*-------------------------------------------------*/
hid_write(dev, buffer, buffer_size);
/*-----------------------------------------------------------------*\
| Reset the write buffer |
\*-----------------------------------------------------------------*/
/*-------------------------------------------------*\
| Reset the write buffer |
\*-------------------------------------------------*/
memset(buffer, 0x00, buffer_size );
packet_count++;
}
}
void CMARGBController::SendUpdate()
{
/*---------------------------------------------*\
| Guard the writes to the controller |
\*---------------------------------------------*/
std::lock_guard<std::mutex> guard(*mutex_ptr);
unsigned char buffer[CM_ARGB_PACKET_SIZE] = { 0x00 };
int buffer_size = (sizeof(buffer) / sizeof(buffer[0]));
bool boolARGB_header = argb_header_data[zone_index].digital;
bool boolPassthru = ( current_mode == CM_ARGB_MODE_PASSTHRU ) || ( current_mode == CM_RGB_MODE_PASSTHRU );
bool boolDirect = ( current_mode == CM_ARGB_MODE_DIRECT );
unsigned char function = boolPassthru ? (boolARGB_header ? 0x02 : 0x04) : (boolARGB_header ? 0x01 : 0x03);
buffer[CM_ARGB_REPORT_BYTE] = 0x80;
buffer[CM_ARGB_COMMAND_BYTE] = 0x01;
if(boolDirect)
{
buffer[CM_ARGB_FUNCTION_BYTE] = 0x01;
buffer[CM_ARGB_ZONE_BYTE] = 0x02;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
/*-----------------------------------------------------------------*\
| Direct mode is now set up and no other mode packet is required |
\*-----------------------------------------------------------------*/
return;
}
buffer[CM_ARGB_FUNCTION_BYTE] = function;
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
if(boolARGB_header)
{
buffer[CM_ARGB_COMMAND_BYTE] = 0x0B; //ARGB sends 0x0B (1011) RGB sends 0x04 (0100)
buffer[CM_ARGB_FUNCTION_BYTE] = (false) ? 0x01 : 0x02; //This controls direct mode TODO
buffer[CM_ARGB_ZONE_BYTE] = argb_header_data[zone_index].header;
buffer[CM_ARGB_MODE_BYTE] = current_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE] = bool_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE] = current_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE] = current_brightness;
buffer[CM_ARGB_RED_BYTE] = current_red;
buffer[CM_ARGB_GREEN_BYTE] = current_green;
buffer[CM_ARGB_BLUE_BYTE] = current_blue;
}
else
{
buffer[CM_ARGB_COMMAND_BYTE] = boolPassthru ? 0x01 : 0x04; //ARGB sends 0x0b (1011) RGB sends 0x04 (0100)
buffer[CM_ARGB_MODE_BYTE + CM_RGB_OFFSET] = current_mode;
buffer[CM_ARGB_COLOUR_INDEX_BYTE + CM_RGB_OFFSET] = bool_random ? 0x00 : 0x10;
buffer[CM_ARGB_SPEED_BYTE + CM_RGB_OFFSET] = current_speed;
buffer[CM_ARGB_BRIGHTNESS_BYTE + CM_RGB_OFFSET] = current_brightness;
buffer[CM_ARGB_RED_BYTE + CM_RGB_OFFSET] = current_red;
buffer[CM_ARGB_GREEN_BYTE + CM_RGB_OFFSET] = current_green;
buffer[CM_ARGB_BLUE_BYTE + CM_RGB_OFFSET] = current_blue;
}
hid_write(dev, buffer, buffer_size);
hid_read_timeout(dev, buffer, buffer_size, CM_ARGB_INTERRUPT_TIMEOUT);
}
@@ -16,19 +16,20 @@
#include <array>
#include <memory>
#include <hidapi.h>
#include "RGBController.h" //Needed to set the direct mode
#include "RGBController.h"
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
#define CM_ARGB_INTERRUPT_TIMEOUT 250
#define CM_ARGB_PACKET_SIZE 65
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_RGB_OFFSET -2
#define HID_MAX_STR 255
#define CM_ARGB_COLOUR_MODE_DATA_SIZE (sizeof(colour_mode_data[0]) / sizeof(colour_mode_data[0][0]))
#define CM_ARGB_HEADER_DATA_SIZE (sizeof(argb_header_data) / sizeof(argb_headers) )
#define CM_ARGB_INTERRUPT_TIMEOUT 250
#define CM_ARGB_PACKET_SIZE 65
#define CM_ARGB_DEVICE_NAME_SIZE (sizeof(device_name) / sizeof(device_name[ 0 ]))
#define CM_RGB_OFFSET -2
#define HID_MAX_STR 255
#define CM_ARGB_BRIGHTNESS_MAX 255
#define CM_ARGB_FW0023 std::string("A202011171238")
#define CM_ARGB_FW0028 std::string("A202105291658")
#define CM_ARGB_BRIGHTNESS_MAX 255
#define CM_ARGB_FW0000 std::string("A201804091608")
#define CM_ARGB_FW0023 std::string("A202011171238")
#define CM_ARGB_FW0028 std::string("A202105291658")
enum
{
@@ -45,22 +46,13 @@ enum
CM_ARGB_BLUE_BYTE = 11
};
struct argb_headers
enum
{
const char* name;
unsigned char header;
bool digital;
unsigned int count;
};
static argb_headers argb_header_data[] =
{
{ "RGB Header", 0xFE, false, 1 },
{ "Digital ARGB1", 0x01, true, 12 },
{ "Digital ARGB2", 0x02, true, 12 },
{ "Digital ARGB3", 0x04, true, 12 },
{ "Digital ARGB4", 0x08, true, 12 },
//{ "All Digital ARGB", 0xFF, true, 12 }
CM_ARGB_PORT_ARGB_1 = 0x01,
CM_ARGB_PORT_ARGB_2 = 0x02,
CM_ARGB_PORT_ARGB_3 = 0x04,
CM_ARGB_PORT_ARGB_4 = 0x08,
CM_ARGB_PORT_RGB = 0xFE,
};
enum
@@ -101,40 +93,44 @@ enum
class CMARGBController
{
public:
CMARGBController(hid_device* dev_handle, char *_path, unsigned char _zone_idx, std::shared_ptr<std::mutex> cm_mutex);
CMARGBController(hid_device* dev_handle, char* path);
~CMARGBController();
std::string GetDeviceName();
std::string GetSerial();
std::string GetLocation();
std::string GetVersion();
unsigned char GetZoneIndex();
unsigned char GetMode();
unsigned char GetLedRed();
unsigned char GetLedGreen();
unsigned char GetLedBlue();
unsigned char GetLedSpeed();
bool GetRandomColours();
void SetLedCount(int zone, int led_count);
void SetMode(uint8_t mode, uint8_t speed, uint8_t brightness, RGBColor colour, bool random_colours);
void SetLedsDirect(RGBColor * led_colours, unsigned int led_count);
void GetPortStatus
(
unsigned char port_idx,
unsigned char* port_mode,
unsigned char* port_speed,
unsigned char* port_brightness,
bool* port_random,
unsigned char* port_red,
unsigned char* port_green,
unsigned char* port_blue
);
void SetPortLEDCount(unsigned char port_idx, unsigned char led_count);
void SetPortMode
(
unsigned char port_idx,
unsigned char port_mode,
unsigned char port_speed,
unsigned char port_brightness,
bool port_random,
unsigned char port_red,
unsigned char port_green,
unsigned char port_blue
);
void SetPortLEDsDirect(unsigned char port_idx, RGBColor *led_colours, unsigned int led_count);
private:
std::string device_name;
std::string location;
hid_device* dev;
std::shared_ptr<std::mutex> mutex_ptr;
unsigned char zone_index;
unsigned char current_mode;
unsigned char current_speed;
unsigned char current_red;
unsigned char current_green;
unsigned char current_blue;
unsigned char current_brightness;
bool bool_random;
void GetStatus();
void SendUpdate();
hid_device* dev;
std::string device_name;
std::string location;
};
@@ -27,401 +27,594 @@
RGBController_CMARGBController::RGBController_CMARGBController(CMARGBController* controller_ptr)
{
controller = controller_ptr;
unsigned char speed = controller->GetLedSpeed();
name = argb_header_data[controller->GetZoneIndex()].name;
name = controller->GetDeviceName();
vendor = "Cooler Master";
type = DEVICE_TYPE_LEDSTRIP;
description = controller->GetDeviceName();
version = "3.0 for FW0028";
description = "Cooler Master ARGB Controller Device";
version = controller->GetVersion();
serial = controller->GetSerial();
location = controller->GetLocation();
if(argb_header_data[controller->GetZoneIndex()].digital)
{
mode Off;
Off.name = "Turn Off";
Off.value = CM_ARGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
mode Reload;
Reload.name = "Reload";
Reload.value = CM_ARGB_MODE_RELOAD;
Reload.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Reload.colors_min = 1;
Reload.colors_max = 1;
Reload.colors.resize(Reload.colors_max);
Reload.brightness_min = 0;
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reload.speed = speed;
modes.push_back(Reload);
mode Recoil;
Recoil.name = "Recoil";
Recoil.value = CM_ARGB_MODE_RECOIL;
Recoil.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Recoil.colors_min = 1;
Recoil.colors_max = 1;
Recoil.colors.resize(Recoil.colors_max);
Recoil.brightness_min = 0;
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
Recoil.speed = speed;
modes.push_back(Recoil);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CM_ARGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed = speed;
modes.push_back(Breathing);
mode Refill;
Refill.name = "Refill";
Refill.value = CM_ARGB_MODE_REFILL;
Refill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Refill.colors_min = 1;
Refill.colors_max = 1;
Refill.colors.resize(Refill.colors_max);
Refill.brightness_min = 0;
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
Refill.speed = speed;
modes.push_back(Refill);
mode Demo;
Demo.name = "Demo";
Demo.value = CM_ARGB_MODE_DEMO;
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Demo.brightness_min = 0;
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
Demo.color_mode = MODE_COLORS_NONE;
Demo.speed = speed;
modes.push_back(Demo);
mode Spectrum;
Spectrum.name = "Spectrum";
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Spectrum.brightness_min = 0;
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
Spectrum.color_mode = MODE_COLORS_NONE;
Spectrum.speed = speed;
modes.push_back(Spectrum);
mode FillFlow;
FillFlow.name = "Fill Flow";
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
FillFlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
FillFlow.brightness_min = 0;
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
FillFlow.color_mode = MODE_COLORS_NONE;
FillFlow.speed = speed;
modes.push_back(FillFlow);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CM_ARGB_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.brightness_min = 0;
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.speed = speed;
modes.push_back(Rainbow);
mode Static;
Static.name = "Static";
Static.value = CM_ARGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.speed_min = CM_ARGB_SPEED_SLOWEST;
Static.speed_max = CM_ARGB_SPEED_FASTEST;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.speed = speed;
modes.push_back(Static);
mode Direct;
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
Direct.value = CM_ARGB_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
mode PassThru;
PassThru.name = "Pass Thru";
PassThru.value = CM_ARGB_MODE_PASSTHRU;
PassThru.flags = 0;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
}
else
{
mode Static;
Static.name = "Static";
Static.value = CM_RGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.speed = 0;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CM_RGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Breathing);
mode Flash;
Flash.name = "Flash";
Flash.value = CM_RGB_MODE_FLASH;
Flash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Flash.colors_min = 1;
Flash.colors_max = 1;
Flash.colors.resize(Flash.colors_max);
Flash.brightness_min = 0;
Flash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Flash.brightness = CM_ARGB_BRIGHTNESS_MAX;
Flash.speed_min = CM_ARGB_SPEED_SLOWEST;
Flash.speed_max = CM_ARGB_SPEED_FASTEST;
Flash.color_mode = MODE_COLORS_MODE_SPECIFIC;
Flash.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Flash);
mode Mirage;
Mirage.name = "Mirage";
Mirage.value = CM_RGB_MODE_MIRAGE;
Mirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Mirage.colors_min = 1;
Mirage.colors_max = 1;
Mirage.colors.resize(Mirage.colors_max);
Mirage.brightness_min = 0;
Mirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Mirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
Mirage.speed_min = CM_ARGB_SPEED_SLOWEST;
Mirage.speed_max = CM_ARGB_SPEED_FASTEST;
Mirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
Mirage.speed = CM_ARGB_SPEED_NORMAL;
modes.push_back(Mirage);
mode PassThru;
PassThru.name = "Pass Thru";
PassThru.value = CM_RGB_MODE_PASSTHRU;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
mode Off;
Off.name = "Turn Off";
Off.value = CM_RGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
}
Init_Controller();
SetupZones();
SetupModes();
int temp_mode = controller->GetMode();
for(int mode_idx = 0; mode_idx < (int)modes.size() ; mode_idx++)
/*-----------------------------------------------------*\
| Initialize the active mode to port 0 |
\*-----------------------------------------------------*/
unsigned char port_mode;
unsigned char port_speed;
unsigned char port_brightness;
bool port_random;
unsigned char port_red;
unsigned char port_green;
unsigned char port_blue;
controller->GetPortStatus(0, &port_mode, &port_speed, &port_brightness, &port_random, &port_red, &port_green, &port_blue);
for(std::size_t mode_idx = 0; mode_idx < modes.size(); mode_idx++)
{
if (temp_mode == modes[mode_idx].value)
if(modes[mode_idx].value == port_mode)
{
active_mode = mode_idx;
active_mode = (int)mode_idx;
if((modes[mode_idx].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR) && (modes[mode_idx].colors.size() > 0))
{
modes[mode_idx].colors[0] = ToRGBColor(port_red, port_green, port_blue);
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_SPEED)
{
modes[mode_idx].speed = port_speed;
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_BRIGHTNESS)
{
modes[mode_idx].brightness = port_brightness;
}
if(modes[mode_idx].flags & MODE_FLAG_HAS_RANDOM_COLOR)
{
if(port_random)
{
modes[mode_idx].color_mode = MODE_COLORS_RANDOM;
}
}
break;
}
}
if (modes[active_mode].flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
{
modes[active_mode].colors[0] = ToRGBColor(controller->GetLedRed(), controller->GetLedGreen(), controller->GetLedBlue());
modes[active_mode].color_mode = (controller->GetRandomColours()) ? MODE_COLORS_RANDOM : MODE_COLORS_MODE_SPECIFIC;
}
if (modes[active_mode].flags & MODE_FLAG_HAS_SPEED)
{
modes[active_mode].speed = controller->GetLedSpeed();
}
}
RGBController_CMARGBController::~RGBController_CMARGBController()
{
Shutdown();
delete controller;
}
void RGBController_CMARGBController::Init_Controller()
void RGBController_CMARGBController::SetupModes()
{
int zone_idx = controller->GetZoneIndex();
int zone_led_count = argb_header_data[zone_idx].count;
/*-----------------------------------------------------*\
| Define Direct and Passthrough modes as require entire |
| device, these are not available as per-zone modes |
\*-----------------------------------------------------*/
mode Direct;
Direct.name = (serial >= CM_ARGB_FW0028) ? "Direct" : "Custom";
Direct.value = CM_ARGB_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
/*-------------------------------------------------*\
| If argb_header_data[zone_idx].count == 1 then the |
| zone is ZONE_TYPE_SINGLE |
\*-------------------------------------------------*/
bool boolSingleLED = ( zone_led_count == 1 );
mode PassThru;
PassThru.name = "Passthrough";
PassThru.value = CM_ARGB_MODE_PASSTHRU | MODE_FLAG_REQUIRES_ENTIRE_DEVICE;
PassThru.flags = 0;
PassThru.color_mode = MODE_COLORS_NONE;
modes.push_back(PassThru);
zone ARGB_zone;
ARGB_zone.name = std::to_string(zone_idx);
ARGB_zone.type = (boolSingleLED) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
ARGB_zone.leds_min = 4;
ARGB_zone.leds_max = 48;
ARGB_zone.leds_count = zone_led_count;
zones.push_back(ARGB_zone);
/*-----------------------------------------------------*\
| The ARGB ports support more modes than the RGB port. |
| Define all of the modes the ARGB ports support and |
| map RGB modes to them as best as we can. |
\*-----------------------------------------------------*/
mode Off;
Off.name = "Off";
Off.value = CM_ARGB_MODE_OFF;
Off.color_mode = MODE_COLORS_NONE;
modes.push_back(Off);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Off);
}
mode Reload;
Reload.name = "Reload";
Reload.value = CM_ARGB_MODE_RELOAD;
Reload.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Reload.speed_min = CM_ARGB_SPEED_SLOWEST;
Reload.speed_max = CM_ARGB_SPEED_FASTEST;
Reload.speed = CM_ARGB_SPEED_NORMAL;
Reload.brightness_min = 0;
Reload.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Reload.brightness = CM_ARGB_BRIGHTNESS_MAX;
Reload.color_mode = MODE_COLORS_MODE_SPECIFIC;
Reload.colors_min = 1;
Reload.colors_max = 1;
Reload.colors.resize(Reload.colors_max);
modes.push_back(Reload);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Reload);
}
mode Recoil;
Recoil.name = "Recoil";
Recoil.value = CM_ARGB_MODE_RECOIL;
Recoil.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Recoil.color_mode = MODE_COLORS_MODE_SPECIFIC;
Recoil.speed_min = CM_ARGB_SPEED_SLOWEST;
Recoil.speed_max = CM_ARGB_SPEED_FASTEST;
Recoil.speed = CM_ARGB_SPEED_NORMAL;
Recoil.brightness_min = 0;
Recoil.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Recoil.brightness = CM_ARGB_BRIGHTNESS_MAX;
Recoil.colors_min = 1;
Recoil.colors_max = 1;
Recoil.colors.resize(Recoil.colors_max);
modes.push_back(Recoil);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Recoil);
}
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = CM_ARGB_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
Breathing.speed_min = CM_ARGB_SPEED_SLOWEST;
Breathing.speed_max = CM_ARGB_SPEED_FASTEST;
Breathing.speed = CM_ARGB_SPEED_NORMAL;
Breathing.brightness_min = 0;
Breathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Breathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
Breathing.colors_min = 1;
Breathing.colors_max = 1;
Breathing.colors.resize(Breathing.colors_max);
modes.push_back(Breathing);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Breathing);
}
mode Refill;
Refill.name = "Refill";
Refill.value = CM_ARGB_MODE_REFILL;
Refill.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Refill.color_mode = MODE_COLORS_MODE_SPECIFIC;
Refill.speed_min = CM_ARGB_SPEED_SLOWEST;
Refill.speed_max = CM_ARGB_SPEED_FASTEST;
Refill.speed = CM_ARGB_SPEED_NORMAL;
Refill.brightness_min = 0;
Refill.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Refill.brightness = CM_ARGB_BRIGHTNESS_MAX;
Refill.colors_min = 1;
Refill.colors_max = 1;
Refill.colors.resize(Refill.colors_max);
modes.push_back(Refill);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Refill);
}
mode Demo;
Demo.name = "Demo";
Demo.value = CM_ARGB_MODE_DEMO;
Demo.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Demo.color_mode = MODE_COLORS_NONE;
Demo.speed_min = CM_ARGB_SPEED_SLOWEST;
Demo.speed_max = CM_ARGB_SPEED_FASTEST;
Demo.speed = CM_ARGB_SPEED_NORMAL;
Demo.brightness_min = 0;
Demo.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Demo.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Demo);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Demo);
}
mode Spectrum;
Spectrum.name = "Rainbow Wave";
Spectrum.value = CM_ARGB_MODE_SPECTRUM;
Spectrum.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Spectrum.color_mode = MODE_COLORS_NONE;
Spectrum.speed_min = CM_ARGB_SPEED_SLOWEST;
Spectrum.speed_max = CM_ARGB_SPEED_FASTEST;
Spectrum.speed = CM_ARGB_SPEED_NORMAL;
Spectrum.brightness_min = 0;
Spectrum.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Spectrum.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Spectrum);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Spectrum);
}
mode FillFlow;
FillFlow.name = "Fill Flow";
FillFlow.value = CM_ARGB_MODE_FILLFLOW;
FillFlow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
FillFlow.color_mode = MODE_COLORS_NONE;
FillFlow.speed_min = CM_ARGB_SPEED_SLOWEST;
FillFlow.speed_max = CM_ARGB_SPEED_FASTEST;
FillFlow.speed = CM_ARGB_SPEED_NORMAL;
FillFlow.brightness_min = 0;
FillFlow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
FillFlow.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(FillFlow);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(FillFlow);
}
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CM_ARGB_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
Rainbow.color_mode = MODE_COLORS_NONE;
Rainbow.speed_min = CM_ARGB_SPEED_SLOWEST;
Rainbow.speed_max = CM_ARGB_SPEED_FASTEST;
Rainbow.speed = CM_ARGB_SPEED_NORMAL;
Rainbow.brightness_min = 0;
Rainbow.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Rainbow.brightness = CM_ARGB_BRIGHTNESS_MAX;
modes.push_back(Rainbow);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Rainbow);
}
mode Static;
Static.name = "Static";
Static.value = CM_ARGB_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
Static.brightness_min = 0;
Static.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
Static.brightness = CM_ARGB_BRIGHTNESS_MAX;
Static.colors_min = 1;
Static.colors_max = 1;
Static.colors.resize(Static.colors_max);
modes.push_back(Static);
for(std::size_t zone_idx = 0; zone_idx < 4; zone_idx++)
{
zones[zone_idx].modes.push_back(Static);
}
/*-----------------------------------------------------*\
| Define zone-specific modes for the RGB port |
\*-----------------------------------------------------*/
mode RGBOff;
RGBOff.name = "Off";
RGBOff.value = CM_RGB_MODE_OFF;
RGBOff.color_mode = MODE_COLORS_NONE;
zones[4].modes.push_back(RGBOff);
mode RGBMirage;
RGBMirage.name = "Mirage";
RGBMirage.value = CM_RGB_MODE_MIRAGE;
RGBMirage.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBMirage.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBMirage.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBMirage.speed_max = CM_ARGB_SPEED_FASTEST;
RGBMirage.speed = CM_ARGB_SPEED_NORMAL;
RGBMirage.brightness_min = 0;
RGBMirage.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBMirage.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBMirage.colors_min = 1;
RGBMirage.colors_max = 1;
RGBMirage.colors.resize(RGBMirage.colors_max);
zones[4].modes.push_back(RGBMirage);
mode RGBFlash;
RGBFlash.name = "Flash";
RGBFlash.value = CM_RGB_MODE_FLASH;
RGBFlash.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBFlash.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBFlash.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBFlash.speed_max = CM_ARGB_SPEED_FASTEST;
RGBFlash.speed = CM_ARGB_SPEED_NORMAL;
RGBFlash.brightness_min = 0;
RGBFlash.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBFlash.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBFlash.colors_min = 1;
RGBFlash.colors_max = 1;
RGBFlash.colors.resize(RGBFlash.colors_max);
zones[4].modes.push_back(RGBFlash);
mode RGBBreathing;
RGBBreathing.name = "Breathing";
RGBBreathing.value = CM_RGB_MODE_BREATHING;
RGBBreathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBBreathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBBreathing.speed_min = CM_ARGB_SPEED_SLOWEST;
RGBBreathing.speed_max = CM_ARGB_SPEED_FASTEST;
RGBBreathing.speed = CM_ARGB_SPEED_NORMAL;
RGBBreathing.brightness_min = 0;
RGBBreathing.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBBreathing.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBBreathing.colors_min = 1;
RGBBreathing.colors_max = 1;
RGBBreathing.colors.resize(RGBBreathing.colors_max);
zones[4].modes.push_back(RGBBreathing);
mode RGBStatic;
RGBStatic.name = "Static";
RGBStatic.value = CM_RGB_MODE_STATIC;
RGBStatic.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
RGBStatic.color_mode = MODE_COLORS_MODE_SPECIFIC;
RGBStatic.brightness_min = 0;
RGBStatic.brightness_max = CM_ARGB_BRIGHTNESS_MAX;
RGBStatic.brightness = CM_ARGB_BRIGHTNESS_MAX;
RGBStatic.colors_min = 1;
RGBStatic.colors_max = 1;
RGBStatic.colors.resize(RGBStatic.colors_max);
zones[4].modes.push_back(RGBStatic);
}
void RGBController_CMARGBController::SetupZones()
{
/*-------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-------------------------------------------------*/
/*-----------------------------------------------------*\
| Only set LED count on the first run |
\*-----------------------------------------------------*/
bool first_run = false;
if(zones.size() == 0)
{
first_run = true;
}
/*-----------------------------------------------------*\
| Clear any existing color/LED configuration |
\*-----------------------------------------------------*/
leds.clear();
colors.clear();
zones.resize(5);
/*---------------------------------------------------------*\
| Set up zones |
\*---------------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
/*-----------------------------------------------------*\
| Set up addressable zones |
\*-----------------------------------------------------*/
for(unsigned int channel_idx = 0; channel_idx < 4; channel_idx++)
{
bool boolSingleLED = (zones[zone_idx].type == ZONE_TYPE_SINGLE);
zones[channel_idx].leds_min = 0;
zones[channel_idx].leds_max = 48;
if (!boolSingleLED)
if(first_run)
{
controller->SetLedCount( std::stoi(zones[zone_idx].name), zones[zone_idx].leds_count);
zones[channel_idx].flags = ZONE_FLAG_MANUALLY_CONFIGURABLE_SIZE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_NAME
| ZONE_FLAG_MANUALLY_CONFIGURABLE_TYPE
| ZONE_FLAG_MANUALLY_CONFIGURABLE_MATRIX_MAP
| ZONE_FLAG_MANUALLY_CONFIGURABLE_SEGMENTS;
}
for(unsigned int lp_idx = 0; lp_idx < zones[zone_idx].leds_count; lp_idx++)
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_NAME))
{
led new_led;
unsigned int i = std::stoi(zones[zone_idx].name);
zones[channel_idx].name = "Addressable RGB Header ";
zones[channel_idx].name.append(std::to_string(channel_idx + 1));
}
if(boolSingleLED)
{
new_led.name = i;
new_led.value = argb_header_data[i].header;
}
else
{
new_led.name = i;
new_led.name.append(" LED " + std::to_string(lp_idx));
new_led.value = argb_header_data[i].header;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_SIZE))
{
zones[channel_idx].leds_count = 0;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_TYPE))
{
zones[channel_idx].type = ZONE_TYPE_LINEAR;
}
if(!(zones[channel_idx].flags & ZONE_FLAG_MANUALLY_CONFIGURED_MATRIX_MAP))
{
zones[channel_idx].matrix_map.width = 0;
zones[channel_idx].matrix_map.height = 0;
zones[channel_idx].matrix_map.map.resize(0);
}
for(unsigned int led_ch_idx = 0; led_ch_idx < zones[channel_idx].leds_count; led_ch_idx++)
{
led new_led;
new_led.name = zones[channel_idx].name;
new_led.name.append(", LED ");
new_led.name.append(std::to_string(led_ch_idx + 1));
new_led.value = channel_idx;
leds.push_back(new_led);
}
}
/*-----------------------------------------------------*\
| Set up RGB zone |
\*-----------------------------------------------------*/
zones[4].name = "RGB Header";
zones[4].type = ZONE_TYPE_SINGLE;
zones[4].leds_min = 1;
zones[4].leds_max = 1;
zones[4].leds_count = 1;
led new_led;
new_led.name = "RGB Header";
new_led.value = 4;
leds.push_back(new_led);
SetupColors();
}
void RGBController_CMARGBController::DeviceResizeZone(int zone, int new_size)
void RGBController_CMARGBController::DeviceConfigureZone(int zone_idx)
{
if((size_t) zone >= zones.size())
if((size_t)zone_idx < zones.size())
{
return;
}
uint8_t end_zone = last_zone(zone);
controller->SetPortLEDCount(zone_idx, zones[zone_idx].leds_count);
for(std::size_t zone_idx = first_zone(zone); zone_idx < end_zone; zone_idx++)
{
if(((unsigned int)new_size >= zones[zone_idx].leds_min) && ((unsigned int)new_size <= zones[zone_idx].leds_max))
{
zones[zone_idx].leds_count = new_size;
}
SetupZones();
}
SetupZones();
}
void RGBController_CMARGBController::DeviceUpdateLEDs()
{
uint8_t end_zone = last_zone(cmargb->GetZoneIndex());
for(int zone_idx = first_zone(cmargb->GetZoneIndex()); zone_idx < end_zone; zone_idx++)
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
DeviceUpdateZoneLEDs(zone_idx);
DeviceUpdateZoneLEDs((int)zone_idx);
}
}
void RGBController_CMARGBController::DeviceUpdateZoneLEDs(int zone)
{
controller->SetLedsDirect( zones[zone].colors, zones[zone].leds_count );
if(modes[active_mode].value != CM_ARGB_MODE_DIRECT)
{
return;
}
/*-----------------------------------------------------*\
| The RGB zone doesn't have a separate Direct mode, so |
| use static mode with the per-LED color for it |
\*-----------------------------------------------------*/
if(zone < 4)
{
controller->SetPortLEDsDirect(zone, zones[zone].colors, zones[zone].leds_count);
}
else
{
controller->SetPortMode(zone, CM_RGB_MODE_STATIC, 0, 255, false, RGBGetRValue(zones[zone].colors[0]), RGBGetGValue(zones[zone].colors[0]), RGBGetBValue(zones[zone].colors[0]));
}
}
void RGBController_CMARGBController::DeviceUpdateSingleLED(int led)
{
DeviceUpdateZoneLEDs(GetLED_Zone(led));
unsigned int zone_idx = leds[led].value;
UpdateZoneLEDs(zone_idx);
}
void RGBController_CMARGBController::DeviceUpdateMode()
{
bool random_colours = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
RGBColor colour = (modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC) ? modes[active_mode].colors[0] : 0;
controller->SetMode( modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, colour, random_colours );
/*-----------------------------------------------------*\
| Apply mode to all zones |
\*-----------------------------------------------------*/
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
DeviceUpdateZoneMode((int)zone_idx);
}
}
int RGBController_CMARGBController::GetLED_Zone(int led_idx)
void RGBController_CMARGBController::DeviceUpdateZoneMode(int zone)
{
/*---------------------------------------------------------*\
| This may be more useful in the abstract RGBController.cpp |
\*---------------------------------------------------------*/
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
{
int zone_start = zones[zone_idx].start_idx;
int zone_end = zone_start + zones[zone_idx].leds_count - 1;
/*-----------------------------------------------------*\
| Determine the active mode for this zone |
\*-----------------------------------------------------*/
bool use_zone_mode = false;
int zone_active_mode = active_mode;
int zone_mode_value = modes[active_mode].value;
if(zone_start <= led_idx && zone_end >= led_idx)
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
RGBColor color = 0;
unsigned int brightness = modes[active_mode].brightness;
unsigned int speed = modes[active_mode].speed;
if(modes[active_mode].colors.size() > 0)
{
color = modes[active_mode].colors[0];
}
if(!(modes[active_mode].flags & MODE_FLAG_REQUIRES_ENTIRE_DEVICE))
{
if(zones[zone].active_mode >= 0)
{
return(zone_idx);
use_zone_mode = true;
zone_active_mode = zones[zone].active_mode;
zone_mode_value = zones[zone].modes[zone_active_mode].value;
random = (zones[zone].modes[zone_active_mode].color_mode == MODE_COLORS_RANDOM);
if(zones[zone].modes[zone_active_mode].colors.size() > 0)
{
color = zones[zone].modes[zone_active_mode].colors[0];
}
brightness = zones[zone].modes[zone_active_mode].brightness;
speed = zones[zone].modes[zone_active_mode].speed;
}
}
return -1;
if((zone == 4) && !use_zone_mode)
{
/*-------------------------------------------------*\
| Map entire-device ARGB modes with the equivalent |
| RGB modes for the RGB zone |
\*-------------------------------------------------*/
switch(modes[active_mode].value)
{
case CM_ARGB_MODE_SPECTRUM:
case CM_ARGB_MODE_FILLFLOW:
case CM_ARGB_MODE_RAINBOW:
zone_mode_value = CM_RGB_MODE_MIRAGE;
random = true;
break;
case CM_ARGB_MODE_RELOAD:
case CM_ARGB_MODE_RECOIL:
zone_mode_value = CM_RGB_MODE_FLASH;
break;
case CM_ARGB_MODE_BREATHING:
zone_mode_value = CM_RGB_MODE_BREATHING;
break;
case CM_ARGB_MODE_REFILL:
case CM_ARGB_MODE_STATIC:
zone_mode_value = CM_RGB_MODE_STATIC;
break;
case CM_ARGB_MODE_DEMO:
zone_mode_value = CM_RGB_MODE_FLASH;
random = true;
break;
case CM_ARGB_MODE_OFF:
default:
zone_mode_value = CM_RGB_MODE_OFF;
break;
case CM_ARGB_MODE_PASSTHRU:
zone_mode_value = CM_RGB_MODE_PASSTHRU;
break;
}
}
controller->SetPortMode
(
zone,
zone_mode_value,
speed,
brightness,
random,
RGBGetRValue(color),
RGBGetGValue(color),
RGBGetBValue(color)
);
}
@@ -12,11 +12,8 @@
#pragma once
#include <vector>
#include "RGBController.h"
#include "CMARGBController.h"
#define first_zone(zn) ((zones.size() > 1) ? 1 : 0)
#define last_zone(zn) ((zones.size() > 1) ? 4 : 1)
#include "RGBController.h"
class RGBController_CMARGBController : public RGBController
{
@@ -24,19 +21,19 @@ public:
RGBController_CMARGBController(CMARGBController* controller_ptr);
~RGBController_CMARGBController();
void SetupModes();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceUpdateZoneMode(int zone);
private:
void Init_Controller();
int GetDeviceMode();
int GetLED_Zone(int led_idx);
CMARGBController* controller;
CMARGBController* controller;
std::vector<unsigned int> leds_channel;
};
@@ -186,6 +186,8 @@ RGBController_CMARGBGen2A1Controller::RGBController_CMARGBGen2A1Controller(CMARG
RGBController_CMARGBGen2A1Controller::~RGBController_CMARGBGen2A1Controller()
{
Shutdown();
delete controller;
}
@@ -218,10 +220,8 @@ void RGBController_CMARGBGen2A1Controller::SetupZones()
SetupColors();
}
void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_size)
void RGBController_CMARGBGen2A1Controller::DeviceConfigureZone(int zone_idx)
{
zones[zone].leds_count = new_size;
unsigned int total_leds = 0;
for(unsigned int channel = 0; channel < CM_ARGB_GEN2_A1_CHANNEL_COUNT; channel++)
@@ -236,7 +236,7 @@ void RGBController_CMARGBGen2A1Controller::DeviceResizeZone(int zone, int new_si
leds[i].name = "LED " + std::to_string(i + 1);
}
controller->SetupZoneSize(zone, new_size);
controller->SetupZoneSize(zone_idx, zones[zone_idx].leds_count);
SetupColors();
}
@@ -23,7 +23,7 @@ public:
~RGBController_CMARGBGen2A1Controller();
void SetupZones();
void DeviceResizeZone(int zone, int new_size);
void DeviceConfigureZone(int zone_idx);
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void UpdateSegmentLEDs(int zone, int subchannel);
@@ -140,6 +140,8 @@ RGBController_CMGD160Controller::RGBController_CMGD160Controller(CMGD160Controll
RGBController_CMGD160Controller::~RGBController_CMGD160Controller()
{
Shutdown();
delete controller;
}
@@ -157,7 +159,7 @@ void RGBController_CMGD160Controller::SetupZones()
{
led l;
l.name = "Front LED " + std::to_string(i + 1);
l.value = i;
leds.push_back(l);
}
@@ -173,7 +175,7 @@ void RGBController_CMGD160Controller::SetupZones()
{
led l;
l.name = "Back LED " + std::to_string(i + 1);
l.value = i;
leds.push_back(l);
}

Some files were not shown because too many files have changed in this diff Show More