From e32826d0ee4257afa586e85c9c0c96670eef389a Mon Sep 17 00:00:00 2001 From: supertick Date: Sun, 17 Nov 2024 07:23:29 -0800 Subject: [PATCH] guards on neopixel start --- src/main/java/org/myrobotlab/service/NeoPixel.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/myrobotlab/service/NeoPixel.java b/src/main/java/org/myrobotlab/service/NeoPixel.java index 3c36b5bc15..f13918256d 100644 --- a/src/main/java/org/myrobotlab/service/NeoPixel.java +++ b/src/main/java/org/myrobotlab/service/NeoPixel.java @@ -177,9 +177,13 @@ public void run() { // FIXME - this should just wait/notify - not start a thread public synchronized void start() { - running = false; - thread = new Thread(this, String.format("%s-animation-runner", getName())); - thread.start(); + if (thread == null) { + running = true; + thread = new Thread(this, String.format("%s-animation-runner", getName())); + thread.start(); + } else { + log.info("animation runner already running"); + } } public synchronized void stop() {