Fixed AL status code lookup.
authorFlorian Pose <fp@igh-essen.com>
Mon, 06 Aug 2012 14:18:05 +0200
changeset 2412 7ac02fa34e8b
parent 2411 01370d59233d
child 2415 af21f0bdc7c9
Fixed AL status code lookup.
master/fsm_change.c
--- a/master/fsm_change.c	Tue Sep 04 14:19:06 2012 +0200
+++ b/master/fsm_change.c	Mon Aug 06 14:18:05 2012 +0200
@@ -428,14 +428,18 @@
     } else {
         code = EC_READ_U16(datagram->data);
         for (al_msg = al_status_messages; al_msg->code != 0xffff; al_msg++) {
-            if (al_msg->code != code) continue;
+            if (al_msg->code != code) {
+                continue;
+            }
+
             EC_SLAVE_ERR(fsm->slave, "AL status message 0x%04X: \"%s\".\n",
                     al_msg->code, al_msg->message);
             break;
         }
-        if (!al_msg->code)
+        if (al_msg->code == 0xffff) { /* not found in our list. */
             EC_SLAVE_ERR(fsm->slave, "Unknown AL status code 0x%04X.\n",
                     code);
+        }
     }
 
     // acknowledge "old" slave state