Skip to content

Commit

Permalink
Remove segment support from A1 devices (not actually supported) (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Dec 25, 2021
1 parent be65c03 commit eb3cfb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
24 changes: 9 additions & 15 deletions flux_led/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class MusicMode(Enum):
@dataclass
class LEDENETAddressableDeviceConfiguration:
pixels_per_segment: int # pixels per segment
segments: int # number of segments
music_pixels_per_segment: int # music pixels per segment
music_segments: int # number of music segments
segments: Optional[int] # number of segments
music_pixels_per_segment: Optional[int] # music pixels per segment
music_segments: Optional[int] # number of music segments
wirings: List[str] # available wirings in the current mode
wiring: Optional[str] # RGB/BRG/GBR etc
wiring_num: Optional[int] # RGB/BRG/GBR number
Expand Down Expand Up @@ -1144,17 +1144,11 @@ def parse_strip_setting(self, msg: bytes) -> LEDENETAddressableDeviceConfigurati
hex(low_byte),
pixels_per_segment,
)
segments = msg[5]
_LOGGER.debug(
"Segment count (%s) is: %s",
hex(segments),
segments,
)
return LEDENETAddressableDeviceConfiguration(
pixels_per_segment=pixels_per_segment,
segments=segments,
music_pixels_per_segment=0,
music_segments=0,
segments=None,
music_pixels_per_segment=None,
music_segments=None,
wirings=list(ADDRESSABLE_RGB_WIRING_TO_NUM),
wiring_num=msg[10],
wiring=ADDRESSABLE_RGB_NUM_TO_WIRING.get(msg[10]),
Expand Down Expand Up @@ -1960,9 +1954,9 @@ def parse_strip_setting(self, msg: bytes) -> LEDENETAddressableDeviceConfigurati
"""Parse a strip settings message."""
return LEDENETAddressableDeviceConfiguration(
pixels_per_segment=6,
segments=1,
music_pixels_per_segment=0,
music_segments=0,
segments=None,
music_pixels_per_segment=None,
music_segments=None,
wirings=[],
wiring_num=None,
wiring=None,
Expand Down
6 changes: 3 additions & 3 deletions tests_aio.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,9 +745,9 @@ def _updated_callback(*args, **kwargs):

await task
assert light.pixels_per_segment == 50
assert light.segments == 0
assert light.music_pixels_per_segment == 0
assert light.music_segments == 0
assert light.segments is None
assert light.music_pixels_per_segment is None
assert light.music_segments is None
assert light.ic_types == [
"UCS1903",
"SM16703",
Expand Down

0 comments on commit eb3cfb2

Please sign in to comment.