Stop on all-off, more debugging
This commit is contained in:
parent
22315fbe47
commit
680b9d48c2
1 changed files with 6 additions and 0 deletions
|
@ -53,7 +53,13 @@ func (c *Can) Handle(frame can.Frame) {
|
||||||
switch typ {
|
switch typ {
|
||||||
case MessageTypeFeedback:
|
case MessageTypeFeedback:
|
||||||
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])
|
||||||
c.swstate = obj.(FeedbackMessage)
|
c.swstate = obj.(FeedbackMessage)
|
||||||
|
// when all end switches are off: send stop command
|
||||||
|
if !c.swstate.EmptyD && !c.swstate.EmptyE && !c.swstate.EmptyF && !c.swstate.EmptyG && !c.swstate.EmptyH {
|
||||||
|
log.Printf("All end switches off, stopping dispenser")
|
||||||
|
c.Cancel()
|
||||||
|
}
|
||||||
case MessageTypeFeedbackRequest:
|
case MessageTypeFeedbackRequest:
|
||||||
// ignore
|
// ignore
|
||||||
case MessageTypePower:
|
case MessageTypePower:
|
||||||
|
|
Loading…
Reference in a new issue