Fixed argument expansion
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7ec2b3255d
commit
d4e6feb083
@ -76,8 +76,8 @@ def main() -> None:
|
|||||||
logging.basicConfig(stream=sys.stdout, format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
logging.basicConfig(stream=sys.stdout, format="%(asctime)s - %(name)s [%(levelname)s]: %(message)s",
|
||||||
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO)
|
level=logging.DEBUG if '--debug' in sys.argv else logging.INFO)
|
||||||
BirbnetesIoTPlatformStatusDriver.init()
|
BirbnetesIoTPlatformStatusDriver.init()
|
||||||
listofabcsignaprocessors = (SoundSignalProcessor())
|
listofabcsignaprocessors = [SoundSignalProcessor()]
|
||||||
loopingtimer = LoopingTimer(function=timer_tick, args=[listofabcsignaprocessors], interval=config.TICK_INTERVAL)
|
loopingtimer = LoopingTimer(function=timer_tick, tick_args=listofabcsignaprocessors, interval=config.TICK_INTERVAL)
|
||||||
loopingtimer.start()
|
loopingtimer.start()
|
||||||
|
|
||||||
client = paho.mqtt.client.Client(userdata=Loudspeaker(config.ENEMY_SOUNDS), client_id=config.DEVICE_ID)
|
client = paho.mqtt.client.Client(userdata=Loudspeaker(config.ENEMY_SOUNDS), client_id=config.DEVICE_ID)
|
||||||
|
@ -15,19 +15,19 @@ class LoopingTimer:
|
|||||||
"""
|
"""
|
||||||
Looping timer. Executes a function and repeates it in the given interval.
|
Looping timer. Executes a function and repeates it in the given interval.
|
||||||
"""
|
"""
|
||||||
def __init__(self, interval, function, *args, **kwargs):
|
def __init__(self, interval, function, tick_args=[], tick_kwargs={}):
|
||||||
"""
|
"""
|
||||||
Initialize class
|
Initialize class
|
||||||
:param interval:
|
:param interval:
|
||||||
:param function:
|
:param function:
|
||||||
:param args:
|
:param tick_args:
|
||||||
:param kwargs:
|
:param tick_kwargs:
|
||||||
"""
|
"""
|
||||||
self._timer = None
|
self._timer = None
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
self.function = function
|
self.function = function
|
||||||
self.args = args
|
self._tick_args = tick_args
|
||||||
self.kwargs = kwargs
|
self._tick_kwargs = tick_kwargs
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class LoopingTimer:
|
|||||||
"""
|
"""
|
||||||
self.is_running = False
|
self.is_running = False
|
||||||
self.start()
|
self.start()
|
||||||
self.function(*self.args, **self.kwargs)
|
self.function(*self._tick_args, **self._tick_kwargs)
|
||||||
|
|
||||||
def start(self) -> None:
|
def start(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user