Beispiel #1
0
def random_single(strip, queue, color, delay, max_brightness=255):
    strip.setBrightness(max_brightness)
    for p in range(strip.numPixels()):
        strip.setPixelColorRGB(p, *wheel(random.randint(0, 255)))
    strip.show()
    while True:
        strip.setPixelColorRGB(random.randint(0, strip.numPixels()), *wheel(random.randint(0, 255)))
        strip.show()
        if not queue.empty():
            return
        milli_sleep(delay)
def random_single(strip, queue, color, delay, brightness_manager, *args,
                  **kwargs):
    while True:
        brightness_manager.reset_brightness()
        for p in range(strip.numPixels()):
            strip.setPixelColorRGB(p, *wheel(random.randint(0, 255)))
        strip.show()
        while True:
            strip.setPixelColorRGB(random.randint(0, strip.numPixels()),
                                   *wheel(random.randint(0, 255)))
            strip.show()
            if not q_poll_milli_sleep(delay, queue):
                return
Beispiel #3
0
def rainbow(strip, queue, color, delay, max_brightness=255):
    strip.setBrightness(max_brightness)
    for i in range(256):
        solid_color(strip, queue, wheel(i), delay, max_brightness, set_brightness=False, wait=False)
        if not queue.empty():
            return
        milli_sleep(delay)
Beispiel #4
0
def rainbow_cycle(strip, queue, color, delay, max_brightness=255):
    strip.setBrightness(max_brightness)
    for j in range(256):
        for i in range(strip.numPixels()):
            strip.setPixelColorRGB(i, *wheel(
                (int(i * 256 / strip.numPixels()) + j) & 255))
        strip.show()
        if not queue.empty():
            return
        milli_sleep(delay)
def rainbow_cycle(strip, queue, color, delay, brightness_manager, *args,
                  **kwargs):
    while True:
        brightness_manager.reset_brightness()
        for j in range(256):
            for i in range(strip.numPixels()):
                strip.setPixelColorRGB(
                    i, *wheel((int(i * 256 / strip.numPixels()) + j) & 255))
            strip.show()
            if not q_poll_milli_sleep(delay, queue):
                return
def rainbow(strip, queue, color, delay, brightness_manager, *args, **kwargs):
    while True:
        for i in range(256):
            solid_color(
                strip=strip,
                queue=queue,
                color=wheel(i),
                delay=delay,
                wait=False,
                brightness_manager=brightness_manager,
            )
            if not q_poll_milli_sleep(delay, queue):
                return
Beispiel #7
0
    def test_wheel(self):
        from octoprint_ws281x_led_status.util import wheel

        tests = {
            29: (87, 168, 0),
            64: (192, 63, 0),
            108: (186, 0, 69),
            181: (0, 33, 222),
            183: (0, 39, 216),
            244: (0, 222, 33),
            250: (0, 240, 15),
        }

        for test_case, test_result in tests.items():
            self.assertTupleEqual(wheel(test_case), test_result)