Skip to content

Commit

Permalink
guards on neopixel start
Browse files Browse the repository at this point in the history
  • Loading branch information
supertick committed Nov 17, 2024
1 parent dd9306d commit e32826d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/org/myrobotlab/service/NeoPixel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit e32826d

Please sign in to comment.