Fixed AL status code lookup.
authorFlorian Pose <fp@igh-essen.com>
Mon, 06 Aug 2012 14:18:05 +0200
changeset 2409 adb7171e83b1
parent 2406 fee219bb31a9
child 2413 01f1e120aaa4
Fixed AL status code lookup.
master/fsm_change.c
--- a/master/fsm_change.c	Mon Jul 23 16:20:40 2012 +0200
+++ b/master/fsm_change.c	Mon Aug 06 14:18:05 2012 +0200
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- *  $Id$
+ *  $Id: fsm_change.c,v 37a25c76987b 2011/12/16 10:42:55 fp $
  *
  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
  *
@@ -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