10se1ucgo / cue_sdk

Python wrapper for the Corsair Utility Engine SDK
Other
21 stars 2 forks source link

CLK entries higher than 107 not working #6

Closed ZingBallyhoo closed 8 years ago

ZingBallyhoo commented 8 years ago

Keyboard: STRAFE RGB UK Product number: CH9000121-UK When printing all CLK values, 107 is the last one, when keys like "Numpad 0" are higher than 107 (it is 119) Effected keys are: KeypadEnter = 108 Keypad7 = 109 Keypad8 = 110 Keypad9 = 111 KeypadComma = 112 Keypad4 = 113 Keypad5 = 114 Keypad6 = 115 Keypad1 = 116 Keypad2 = 117 Keypad3 = 118 Keypad0 = 119 KeypadPeriodAndDelete = 120 Fn = 147 Logo = 154 The leds can be set directly by their CLK names, but you can't get their CLK names when using "for led in range(led_positions.numberOfLed): " and then "print(CLK(led)" All of the leds can be lit manually by using their IDs Can't seem to find out what is causing this issue, I presume it is something to do with the UK layout Hopefully this can be fixed

10se1ucgo commented 8 years ago

you should be doing

for led in led_positions:
    print(led.ledId)

as numberOfLed is only the number of LEDs, not in any order.

ZingBallyhoo commented 8 years ago

Hmm. I took the led position code from the "color_pulse" example so I presumed it was correct. Now using the exact code you gave me it says " 'int' object has no attribute 'ledId' " To get positions I use "led_positions = Corsair.GetLedPositions(0)", is this correct? Thanks for the help

10se1ucgo commented 8 years ago

My bad, it should be

for led in led_positions.pLedPosition:
    print(led.ledId)

The color_pulse example works because it uses it to index the array, not create a new enum CLK() instance.

color_pulse.py

for led in range(led_positions.numberOfLed):
    led_id = led_positions.pLedPosition[led].ledId

vs

yours

for led in range(led_positions.numberOfLed):
    led_id = CLK(led)

Also, GetLedPositions() no longer requires an ID, it was an error on my part when writing the wrapper.

ZingBallyhoo commented 8 years ago

Thanks! All working now