Fixed lost frames display bug when no frames were sent.
authorFlorian Pose <fp@igh-essen.com>
Fri, 24 Nov 2006 11:09:36 +0000
changeset 496 b2aee2241952
parent 495 88c597598bbc
child 497 04552130dd54
Fixed lost frames display bug when no frames were sent.
master/master.c
--- a/master/master.c	Fri Nov 24 11:02:35 2006 +0000
+++ b/master/master.c	Fri Nov 24 11:09:36 2006 +0000
@@ -842,6 +842,7 @@
     off_t off = 0;
     ec_eoe_t *eoe;
     uint32_t cur, sum, min, max, pos, i;
+    unsigned int frames_lost;
 
     off += sprintf(buffer + off, "\nVersion: %s", ec_master_version_str);
     off += sprintf(buffer + off, "\nMode: ");
@@ -864,8 +865,9 @@
 		   master->device->tx_count);
     off += sprintf(buffer + off, "  Frames received: %u\n",
 		   master->device->rx_count);
-    off += sprintf(buffer + off, "  Frames lost:     %u\n",
-		   master->device->tx_count - master->device->rx_count - 1);
+    frames_lost = master->device->tx_count - master->device->rx_count;
+    if (frames_lost) frames_lost--;
+    off += sprintf(buffer + off, "  Frames lost:     %u\n", frames_lost);
 
     off += sprintf(buffer + off, "\nTiming (min/avg/max) [us]:\n");