From 5236517975c3f12bfb57fc79d6364419e54f4055 Mon Sep 17 00:00:00 2001 From: Gregor Riepl Date: Sun, 14 Feb 2021 05:10:19 +0100 Subject: [PATCH] Fix end switch logic --- uncanny/can.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uncanny/can.go b/uncanny/can.go index 2b696ef..3daab44 100644 --- a/uncanny/can.go +++ b/uncanny/can.go @@ -76,8 +76,8 @@ func (c *Can) Handle(frame can.Frame) { log.Printf("Got feedback message: %+v", obj.(FeedbackMessage)) log.Printf("Data: 0x%02x 0x%02x", frame.Data[0], frame.Data[1]) c.swstate = obj.(FeedbackMessage) - // when all end switches are off: send stop command - if !c.swstate.EndD && !c.swstate.EndE && !c.swstate.EndF && !c.swstate.EndG && !c.swstate.EndH { + // when all end switches are open (i.e. true): send stop command + if c.swstate.EndD && c.swstate.EndE && c.swstate.EndF && c.swstate.EndG && c.swstate.EndH { log.Printf("All end switches off, stopping dispenser") c.Cancel() }