# HG changeset patch # User Florian Pose # Date 1272656058 -7200 # Node ID c58633eed20b833ea7e42cf9ba73f28a657da1ee # Parent 6129a5f715fb75438f6fd37095b7481199479e09 Fixed AL state display in command-line tool. diff -r 6129a5f715fb -r c58633eed20b TODO --- a/TODO Fri Apr 30 15:08:09 2010 +0200 +++ b/TODO Fri Apr 30 21:34:18 2010 +0200 @@ -42,7 +42,6 @@ * recompile tool/CommandVersion.cpp if revision changes. * Log SoE IDNs with real name ([SP]-x-yyyy). * Output SoE IDN configurations in 'ethercat config'. -* Output AL status error flag correctly in 'ethercat slaves'. * Fix casting away constness during expected WC calculation. Future issues: diff -r 6129a5f715fb -r c58633eed20b tool/Command.cpp --- a/tool/Command.cpp Fri Apr 30 15:08:09 2010 +0200 +++ b/tool/Command.cpp Fri Apr 30 21:34:18 2010 +0200 @@ -371,14 +371,22 @@ string Command::alStateString(uint8_t state) { - switch (state) { - case 1: return "INIT"; - case 2: return "PREOP"; - case 3: return "BOOT"; - case 4: return "SAFEOP"; - case 8: return "OP"; - default: return "???"; - } -} - -/****************************************************************************/ + string ret; + + switch (state & EC_SLAVE_STATE_MASK) { + case 1: ret = "INIT"; break; + case 2: ret = "PREOP"; break; + case 3: ret = "BOOT"; break; + case 4: ret = "SAFEOP"; break; + case 8: ret = "OP"; break; + default: ret = "???"; + } + + if (state & EC_SLAVE_STATE_ACK_ERR) { + ret += "+ERROR"; + } + + return ret; +} + +/****************************************************************************/ diff -r 6129a5f715fb -r c58633eed20b tool/CommandConfig.cpp --- a/tool/CommandConfig.cpp Fri Apr 30 15:08:09 2010 +0200 +++ b/tool/CommandConfig.cpp Fri Apr 30 21:34:18 2010 +0200 @@ -330,10 +330,7 @@ str.clear(); str.str(""); - str << alStateString(slave.al_state); - info.state = str.str(); - str.clear(); - str.str(""); + info.state = alStateString(slave.al_state); } else { str << "-"; info.slavePos = str.str();