# HG changeset patch
# User Florian Pose <fp@igh-essen.com>
# Date 1164366576 0
# Node ID b2aee224195229e58d57245e35125b37764dbea7
# Parent  88c597598bbc7b65638c7c682761c6c72d8e373b
Fixed lost frames display bug when no frames were sent.

diff -r 88c597598bbc -r b2aee2241952 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");