Added reception debugging

This commit is contained in:
Gregor Riepl 2021-01-31 18:25:21 +01:00
parent 191deb7db3
commit cb83de4bf5

View file

@ -40,6 +40,7 @@ func (c *Can) Stop() {
} }
func (c *Can) Handle(frame can.Frame) { func (c *Can) Handle(frame can.Frame) {
log.Printf("Got CAN frame to 0x%08x", frame.ID)
typ, obj, err := DecodeMessage(frame) typ, obj, err := DecodeMessage(frame)
if err != nil { if err != nil {
if err == UnsupportedMessageType { if err == UnsupportedMessageType {
@ -50,14 +51,17 @@ func (c *Can) Handle(frame can.Frame) {
} else { } else {
switch typ { switch typ {
case MessageTypeFeedback: case MessageTypeFeedback:
log.Printf("Got feedback message: %+v", obj.(FeedbackMessage))
c.swstate = obj.(FeedbackMessage) c.swstate = obj.(FeedbackMessage)
case MessageTypeFeedbackRequest: case MessageTypeFeedbackRequest:
// ignore // ignore
case MessageTypePower: case MessageTypePower:
log.Printf("Got power message: %+v", obj.(PowerMessage))
// ignore // ignore
case MessageTypePowerRequest: case MessageTypePowerRequest:
// ignore // ignore
case MessageTypeDispense: case MessageTypeDispense:
log.Printf("Got dispense message: %+v", obj.(DispenseMessage))
c.dispstate = obj.(DispenseMessage).Slot c.dispstate = obj.(DispenseMessage).Slot
case MessageTypeAuto: case MessageTypeAuto:
// ignore // ignore