Fix end switch logic
This commit is contained in:
parent
44405f9e70
commit
5236517975
1 changed files with 2 additions and 2 deletions
|
@ -76,8 +76,8 @@ func (c *Can) Handle(frame can.Frame) {
|
||||||
log.Printf("Got feedback message: %+v", obj.(FeedbackMessage))
|
log.Printf("Got feedback message: %+v", obj.(FeedbackMessage))
|
||||||
log.Printf("Data: 0x%02x 0x%02x", frame.Data[0], frame.Data[1])
|
log.Printf("Data: 0x%02x 0x%02x", frame.Data[0], frame.Data[1])
|
||||||
c.swstate = obj.(FeedbackMessage)
|
c.swstate = obj.(FeedbackMessage)
|
||||||
// when all end switches are off: send stop command
|
// 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 {
|
if c.swstate.EndD && c.swstate.EndE && c.swstate.EndF && c.swstate.EndG && c.swstate.EndH {
|
||||||
log.Printf("All end switches off, stopping dispenser")
|
log.Printf("All end switches off, stopping dispenser")
|
||||||
c.Cancel()
|
c.Cancel()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue