mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 17:50:37 +00:00
Fix #167
This commit is contained in:
@@ -140,7 +140,7 @@ class LEDBoard(SourceMixin, CompositeDevice):
|
|||||||
raise ValueError('fade_out_time must be 0 with non-PWM LEDs')
|
raise ValueError('fade_out_time must be 0 with non-PWM LEDs')
|
||||||
self._stop_blink()
|
self._stop_blink()
|
||||||
self._blink_thread = GPIOThread(
|
self._blink_thread = GPIOThread(
|
||||||
target=self._blink_leds,
|
target=self._blink_device,
|
||||||
args=(on_time, off_time, fade_in_time, fade_out_time, n)
|
args=(on_time, off_time, fade_in_time, fade_out_time, n)
|
||||||
)
|
)
|
||||||
self._blink_thread.start()
|
self._blink_thread.start()
|
||||||
@@ -153,7 +153,7 @@ class LEDBoard(SourceMixin, CompositeDevice):
|
|||||||
self._blink_thread.stop()
|
self._blink_thread.stop()
|
||||||
self._blink_thread = None
|
self._blink_thread = None
|
||||||
|
|
||||||
def _blink_leds(self, on_time, off_time, fade_in_time, fade_out_time, n, fps=50):
|
def _blink_device(self, on_time, off_time, fade_in_time, fade_out_time, n, fps=50):
|
||||||
sequence = []
|
sequence = []
|
||||||
if fade_in_time > 0:
|
if fade_in_time > 0:
|
||||||
sequence += [
|
sequence += [
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ class DigitalOutputDevice(OutputDevice):
|
|||||||
"""
|
"""
|
||||||
self._stop_blink()
|
self._stop_blink()
|
||||||
self._blink_thread = GPIOThread(
|
self._blink_thread = GPIOThread(
|
||||||
target=self._blink_led, args=(on_time, off_time, n)
|
target=self._blink_device, args=(on_time, off_time, n)
|
||||||
)
|
)
|
||||||
self._blink_thread.start()
|
self._blink_thread.start()
|
||||||
if not background:
|
if not background:
|
||||||
@@ -178,7 +178,7 @@ class DigitalOutputDevice(OutputDevice):
|
|||||||
self._blink_thread.stop()
|
self._blink_thread.stop()
|
||||||
self._blink_thread = None
|
self._blink_thread = None
|
||||||
|
|
||||||
def _blink_led(self, on_time, off_time, n):
|
def _blink_device(self, on_time, off_time, n):
|
||||||
iterable = repeat(0) if n is None else repeat(0, n)
|
iterable = repeat(0) if n is None else repeat(0, n)
|
||||||
for i in iterable:
|
for i in iterable:
|
||||||
self._write(True)
|
self._write(True)
|
||||||
@@ -412,7 +412,7 @@ class PWMOutputDevice(OutputDevice):
|
|||||||
"""
|
"""
|
||||||
self._stop_blink()
|
self._stop_blink()
|
||||||
self._blink_thread = GPIOThread(
|
self._blink_thread = GPIOThread(
|
||||||
target=self._blink_led,
|
target=self._blink_device,
|
||||||
args=(on_time, off_time, fade_in_time, fade_out_time, n)
|
args=(on_time, off_time, fade_in_time, fade_out_time, n)
|
||||||
)
|
)
|
||||||
self._blink_thread.start()
|
self._blink_thread.start()
|
||||||
@@ -425,7 +425,7 @@ class PWMOutputDevice(OutputDevice):
|
|||||||
self._blink_thread.stop()
|
self._blink_thread.stop()
|
||||||
self._blink_thread = None
|
self._blink_thread = None
|
||||||
|
|
||||||
def _blink_led(
|
def _blink_device(
|
||||||
self, on_time, off_time, fade_in_time, fade_out_time, n, fps=50):
|
self, on_time, off_time, fade_in_time, fade_out_time, n, fps=50):
|
||||||
sequence = []
|
sequence = []
|
||||||
if fade_in_time > 0:
|
if fade_in_time > 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user