Reduce frequency of DC Sync debug messages
author"Dave Page <dave.page@gleeble.com>"
Mon, 16 Mar 2015 14:18:55 -0400
changeset 2608 ec0b5d9a2ff1
parent 2607 b59d6aecdbaa
child 2609 777d1a8b3a27
Reduce frequency of DC Sync debug messages
master/fsm_foe.c
master/fsm_slave_config.c
--- a/master/fsm_foe.c	Wed Mar 05 06:36:18 2014 +1300
+++ b/master/fsm_foe.c	Mon Mar 16 14:18:55 2015 -0400
@@ -54,7 +54,7 @@
 // uint8_t  reserved
 // uint32_t PacketNo, Password, ErrorCode
 
-//#define DEBUG_FOE
+#define DEBUG_FOE
 
 /*****************************************************************************/
 
--- a/master/fsm_slave_config.c	Wed Mar 05 06:36:18 2014 +1300
+++ b/master/fsm_slave_config.c	Mon Mar 16 14:18:55 2015 -0400
@@ -1399,8 +1399,12 @@
             EC_SLAVE_WARN(slave, "Slave did not sync after %lu ms.\n",
                     diff_ms);
         } else {
-            EC_SLAVE_DBG(slave, 1, "Sync after %4lu ms: %10u ns\n",
-                    diff_ms, abs_sync_diff);
+            static unsigned long last_diff_ms = 0;
+            if ((diff_ms < last_diff_ms) || (diff_ms >= (last_diff_ms + 100))) {
+                last_diff_ms = diff_ms;
+                EC_SLAVE_DBG(slave, 1, "Sync after %4lu ms: %10u ns\n",
+                        diff_ms, abs_sync_diff);
+            }
 
             // check synchrony again
             ec_datagram_fprd(datagram, slave->station_address, 0x092c, 4);