Clear unused ports; use arrows for next slaves. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Fri, 03 Mar 2017 17:08:39 +0100
branchstable-1.5
changeset 2674 3be68a020748
parent 2673 459758a800b3
child 2680 e6f324a3d8a0
Clear unused ports; use arrows for next slaves.
tool/CommandCrc.cpp
--- a/tool/CommandCrc.cpp	Fri Mar 03 16:49:13 2017 +0100
+++ b/tool/CommandCrc.cpp	Fri Mar 03 17:08:39 2017 +0100
@@ -58,8 +58,7 @@
         << endl
         << "FWD - Forwarded RX Error Counter       0x308, 0x309, 0x30a, 0x30b"
         << endl
-        << "LNK - Lost Link Counter                0x310, 0x311, 0x312, 0x313"
-        << endl
+        << "NXT - Next slave" << endl
         << endl;
 
     return str.str();
@@ -130,12 +129,15 @@
 
     cout << "   |";
     for (unsigned int port = 0; port < EC_MAX_PORTS; port++) {
-        cout << "CRC PHY FWD LNK|";
+        cout << "CRC PHY FWD NXT|";
     }
     cout << endl;
 
     for (unsigned int i = 0; i < master.slave_count; i++) {
 
+        ec_ioctl_slave_t slave;
+        m.getSlave(&slave, i);
+
         io.slave_position = i;
         try {
             m.readReg(&io);
@@ -145,15 +147,30 @@
 
         cout << setw(3) << i << "|";
         for (int port = 0; port < 4; port++) {
+            if (slave.ports[port].link.loop_closed) {
+                cout << "               |";
+                continue;
+            }
+
             cout << setw(3) << (unsigned int) io.data[ 0 + port * 2]; // CRC
             cout << setw(4) << (unsigned int) io.data[ 1 + port * 2]; // PHY
             cout << setw(4) << (unsigned int) io.data[ 8 + port]; // FWD
-            cout << setw(4) << (unsigned int) io.data[16 + port]; // LNK
+            if (slave.ports[port].next_slave == i - 1) {
+                cout << "   ↑";
+            }
+            else if (slave.ports[port].next_slave == i + 1) {
+                cout << "   ↓";
+            }
+            else if (slave.ports[port].next_slave != 0xffff) {
+                cout << setw(4) << slave.ports[port].next_slave;
+            }
+            else {
+                cout << "    ";
+            }
+
             cout << "|";
         }
 
-        ec_ioctl_slave_t slave;
-        m.getSlave(&slave, i);
         std::string slaveName(slave.name);
         slaveName = slaveName.substr(0, 11);
         cout << slaveName << endl;