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