8000 Fix 'wings' mode in SmartDevice by pferreir · Pull Request #769 · liquidctl/liquidctl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix 'wings' mode in SmartDevice #769

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions liquidctl/driver/smart_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ def _write_colors(self, cid, mode, colors, sval, direction='forward',):
for [g, r, b] in colors:
self._write([0x22, 0x10, cid]) # clear out all independent LEDs
self._write([0x22, 0x11, cid]) # clear out all independent LEDs
color_lists = [] * 3
color_lists = [0] * 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking back into how the broken line of coded ended up here (mea culpa), it seems that the intention was to create a list of four empty lists:

Suggested change
color_lists = [0] * 3
color_lists = [[]] * 4

The first three lists would be filled in, but the forth would be left empty.

color_lists[0] = [g, r, b] * 8
color_lists[1] = [int(x // 2.5) for x in color_lists[0]]
color_lists[2] = [int(x // 4) for x in color_lists[1]]
Expand All @@ -653,7 +653,7 @@ def _write_colors(self, cid, mode, colors, sval, direction='forward',):
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,
0x05, 0x85, 0x05, 0x85, 0x05, 0x85, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00])
self._write(msg + color_lists[i % 4])
self._write(msg + color_lists[i % 3])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reasons unknown to me (don't have this particular device), it seems that the modulo 4 indexing was intentional, and that some writes should send an empty color list.

Suggested change
self._write(msg + color_lists[i % 3])
self._write(msg + color_lists[i % 4])

self._write([0x22, 0x03, cid, 0x08]) # this actually enables wings mode
else:
byte7 = (mod4 & 0x10) >> 4 # sets 'moving' flag for moving alternating modes
Expand Down
Loading
0