Skip to content

Commit

Permalink
Drop zero init of all channels.
Browse files Browse the repository at this point in the history
Fix the malloc(): invalid size (unsorted) error.
  • Loading branch information
Gadgetoid committed Nov 4, 2024
1 parent a7f6e6d commit 5cc1dfd
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 24 deletions.
8 changes: 0 additions & 8 deletions examples/SK6812_lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@
# that you delete its memory by calling delete_ws2811_t when it's not needed.
leds = ws.new_ws2811_t()

# Initialize all channels to off
for channum in range(2):
channel = ws.ws2811_channel_get(leds, channum)
ws.ws2811_channel_t_count_set(channel, 0)
ws.ws2811_channel_t_gpionum_set(channel, 0)
ws.ws2811_channel_t_invert_set(channel, 0)
ws.ws2811_channel_t_brightness_set(channel, 0)

channel = ws.ws2811_channel_get(leds, LED_CHANNEL)

ws.ws2811_channel_t_count_set(channel, LED_COUNT)
Expand Down
8 changes: 0 additions & 8 deletions examples/lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@
# that you delete its memory by calling delete_ws2811_t when it's not needed.
leds = ws.new_ws2811_t()

# Initialize all channels to off
for channum in range(2):
channel = ws.ws2811_channel_get(leds, channum)
ws.ws2811_channel_t_count_set(channel, 0)
ws.ws2811_channel_t_gpionum_set(channel, 0)
ws.ws2811_channel_t_invert_set(channel, 0)
ws.ws2811_channel_t_brightness_set(channel, 0)

channel = ws.ws2811_channel_get(leds, LED_CHANNEL)

ws.ws2811_channel_t_count_set(channel, LED_COUNT)
Expand Down
8 changes: 0 additions & 8 deletions library/rpi_ws281x/rpi_ws281x.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ def __init__(self, num, pin, freq_hz=800000, dma=10, invert=False,
# Create ws2811_t structure and fill in parameters.
self._leds = ws.new_ws2811_t()

# Initialize the channels to zero
for channum in range(2):
chan = ws.ws2811_channel_get(self._leds, channum)
ws.ws2811_channel_t_count_set(chan, 0)
ws.ws2811_channel_t_gpionum_set(chan, 0)
ws.ws2811_channel_t_invert_set(chan, 0)
ws.ws2811_channel_t_brightness_set(chan, 0)

# Initialize the channel in use
self._channel = ws.ws2811_channel_get(self._leds, channel)

Expand Down

0 comments on commit 5cc1dfd

Please sign in to comment.