aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ashby <martin@martin-laptop.lan>2018-05-21 10:34:08 +0100
committerMartin Ashby <martin@martin-laptop.lan>2018-05-21 10:34:08 +0100
commit7213657a539c86dccef9446c373ba8a1ba386c20 (patch)
treed33741a56341d5705dc845a4da6793d46d74f0d8
parent731f339144d657d8dece768690cc870769d16254 (diff)
downloadunicornpaint-7213657a539c86dccef9446c373ba8a1ba386c20.tar.gz
unicornpaint-7213657a539c86dccef9446c373ba8a1ba386c20.tar.bz2
unicornpaint-7213657a539c86dccef9446c373ba8a1ba386c20.tar.xz
unicornpaint-7213657a539c86dccef9446c373ba8a1ba386c20.zip
fixed real unicorns
-rw-r--r--unicorn/RealUnicorn.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/unicorn/RealUnicorn.go b/unicorn/RealUnicorn.go
index fb10a79..a114c73 100644
--- a/unicorn/RealUnicorn.go
+++ b/unicorn/RealUnicorn.go
@@ -6,6 +6,7 @@ import (
"github.com/ecc1/spi"
"log"
"os"
+ "syscall"
)
type RealUnicorn struct {
@@ -65,9 +66,9 @@ func (u *RealUnicorn) Close() error {
// MainLoop ...
// Do nothing until SIGTERM, then close the SPI library
-func MainLoop() {
+func (u *RealUnicorn) MainLoop() {
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
- <- c
- Close()
+ <-c
+ u.Close()
}