author | Florian Pose <fp@igh-essen.com> |
Fri, 10 Oct 2008 09:37:06 +0000 | |
changeset 1259 | 5f9d1abbee71 |
parent 1254 | c19d273a9e76 |
child 1327 | 4d179b06dd3c |
permissions | -rw-r--r-- |
1142 | 1 |
/***************************************************************************** |
2 |
* |
|
3 |
* $Id$ |
|
4 |
* |
|
5 |
****************************************************************************/ |
|
6 |
||
7 |
#include <list> |
|
8 |
#include <iostream> |
|
9 |
#include <iomanip> |
|
10 |
#include <sstream> |
|
11 |
using namespace std; |
|
12 |
||
13 |
#include "CommandConfig.h" |
|
14 |
||
15 |
/*****************************************************************************/ |
|
16 |
||
17 |
CommandConfig::CommandConfig(): |
|
18 |
Command("config", "Show slave configurations.") |
|
19 |
{ |
|
20 |
} |
|
21 |
||
22 |
/*****************************************************************************/ |
|
23 |
||
24 |
string CommandConfig::helpString() const |
|
25 |
{ |
|
26 |
stringstream str; |
|
27 |
||
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
28 |
str << getName() << " [OPTIONS]" << endl |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
29 |
<< endl |
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
30 |
<< getBriefDescription() << endl |
1142 | 31 |
<< endl |
32 |
<< "Without the --verbose option, slave configurations are" << endl |
|
33 |
<< "output one-per-line. Example:" << endl |
|
34 |
<< endl |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
35 |
<< "1001:0 0x0000003b/0x02010000 3 OP" << endl |
1142 | 36 |
<< "| | | |" << endl |
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
37 |
<< "| | | \\- Application-layer" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
38 |
<< "| | | state of the attached" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
39 |
<< "| | | slave, or '-', if no" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
40 |
<< "| | | slave is attached." << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
41 |
<< "| | \\- Absolute decimal ring" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
42 |
<< "| | position of the attached" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
43 |
<< "| | slave, or '-' if none" << endl |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
44 |
<< "| | attached." << endl |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
45 |
<< "| \\- Expected vendor ID and product code (both" << endl |
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
46 |
<< "| hexadecimal)." << endl |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
47 |
<< "\\- Alias address and relative position (both decimal)." << endl |
1142 | 48 |
<< endl |
49 |
<< "With the --verbose option given, the configured Pdos and" << endl |
|
1144
7dbfdd61812c
Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents:
1142
diff
changeset
|
50 |
<< "Sdos are output in addition." << endl |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
51 |
<< endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
52 |
<< "Configuration selection:" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
53 |
<< " Slave configurations can be selected with" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
54 |
<< " the --alias and --position parameters as follows:" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
55 |
<< endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
56 |
<< " 1) If neither the --alias nor the --position option" << endl |
1167 | 57 |
<< " is given, all slave configurations are displayed." << endl |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
58 |
<< " 2) If only the --position option is given, an alias" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
59 |
<< " of zero is assumed (see 4))." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
60 |
<< " 3) If only the --alias option is given, all slave" << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
61 |
<< " configurations with the given alias address" << endl |
1167 | 62 |
<< " are displayed." << endl |
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
63 |
<< " 4) If both the --alias and the --position option are" << endl |
1167 | 64 |
<< " given, the selection can match a single" << endl |
65 |
<< " configuration, that is displayed, if it exists." << endl |
|
1142 | 66 |
<< endl |
67 |
<< "Command-specific options:" << endl |
|
1157
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
68 |
<< " --alias -a <alias> Configuration alias (see above)." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
69 |
<< " --position -p <pos> Relative position (see above)." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
70 |
<< " --verbose -v Show detailed configurations." << endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
71 |
<< endl |
04d1c950cf9d
Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents:
1156
diff
changeset
|
72 |
<< numericInfo(); |
1142 | 73 |
|
74 |
return str.str(); |
|
75 |
} |
|
76 |
||
77 |
/*****************************************************************************/ |
|
78 |
||
79 |
/** Lists the bus configuration. |
|
80 |
*/ |
|
81 |
void CommandConfig::execute(MasterDevice &m, const StringVector &args) |
|
82 |
{ |
|
1156
ecaf2a896ea3
Implemented alias and position for configs.
Florian Pose <fp@igh-essen.com>
parents:
1148
diff
changeset
|
83 |
ConfigList configs; |
1142 | 84 |
|
85 |
m.open(MasterDevice::Read); |
|
1156
ecaf2a896ea3
Implemented alias and position for configs.
Florian Pose <fp@igh-essen.com>
parents:
1148
diff
changeset
|
86 |
configs = selectedConfigs(m); |
1142 | 87 |
|
88 |
if (getVerbosity() == Verbose) { |
|
1156
ecaf2a896ea3
Implemented alias and position for configs.
Florian Pose <fp@igh-essen.com>
parents:
1148
diff
changeset
|
89 |
showDetailedConfigs(m, configs); |
1142 | 90 |
} else { |
1156
ecaf2a896ea3
Implemented alias and position for configs.
Florian Pose <fp@igh-essen.com>
parents:
1148
diff
changeset
|
91 |
listConfigs(m, configs); |
1142 | 92 |
} |
93 |
} |
|
94 |
||
95 |
/*****************************************************************************/ |
|
96 |
||
97 |
/** Lists the complete bus configuration. |
|
98 |
*/ |
|
99 |
void CommandConfig::showDetailedConfigs( |
|
100 |
MasterDevice &m, |
|
101 |
const ConfigList &configList |
|
102 |
) |
|
103 |
{ |
|
104 |
ConfigList::const_iterator configIter; |
|
105 |
unsigned int j, k, l; |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
106 |
ec_ioctl_slave_t slave; |
1142 | 107 |
ec_ioctl_config_pdo_t pdo; |
108 |
ec_ioctl_config_pdo_entry_t entry; |
|
109 |
ec_ioctl_config_sdo_t sdo; |
|
110 |
||
111 |
for (configIter = configList.begin(); |
|
112 |
configIter != configList.end(); |
|
113 |
configIter++) { |
|
114 |
||
115 |
cout << "Alias: " |
|
116 |
<< dec << configIter->alias << endl |
|
117 |
<< "Position: " << configIter->position << endl |
|
118 |
<< "Vendor Id: 0x" |
|
119 |
<< hex << setfill('0') |
|
120 |
<< setw(8) << configIter->vendor_id << endl |
|
121 |
<< "Product code: 0x" |
|
122 |
<< setw(8) << configIter->product_code << endl |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
123 |
<< "Attached slave: "; |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
124 |
|
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
125 |
if (configIter->slave_position != -1) { |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
126 |
m.getSlave(&slave, configIter->slave_position); |
1172
74ee632c3b5e
Fixed attached slave position in 'ethercat config' -> decimal.
Florian Pose <fp@igh-essen.com>
parents:
1167
diff
changeset
|
127 |
cout << dec << configIter->slave_position |
1148
1762296870bd
Renamed state field to al_state.
Florian Pose <fp@igh-essen.com>
parents:
1147
diff
changeset
|
128 |
<< " (" << alStateString(slave.al_state) << ")" << endl; |
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
129 |
} else { |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
130 |
cout << "none" << endl; |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
131 |
} |
1142 | 132 |
|
133 |
for (j = 0; j < EC_MAX_SYNC_MANAGERS; j++) { |
|
134 |
if (configIter->syncs[j].pdo_count) { |
|
135 |
cout << "SM" << dec << j << " (" |
|
136 |
<< (configIter->syncs[j].dir == EC_DIR_INPUT |
|
137 |
? "Input" : "Output") << ")" << endl; |
|
138 |
for (k = 0; k < configIter->syncs[j].pdo_count; k++) { |
|
139 |
m.getConfigPdo(&pdo, configIter->config_index, j, k); |
|
140 |
||
1188
3b4e82d9904b
Don't show Pdo (entry) names in configuration output.
Florian Pose <fp@igh-essen.com>
parents:
1172
diff
changeset
|
141 |
cout << " Pdo 0x" << hex << setw(4) << pdo.index << endl; |
1142 | 142 |
|
143 |
for (l = 0; l < pdo.entry_count; l++) { |
|
144 |
m.getConfigPdoEntry(&entry, |
|
145 |
configIter->config_index, j, k, l); |
|
146 |
||
1188
3b4e82d9904b
Don't show Pdo (entry) names in configuration output.
Florian Pose <fp@igh-essen.com>
parents:
1172
diff
changeset
|
147 |
cout << " Pdo entry 0x" << hex << setfill('0') |
1142 | 148 |
<< setw(4) << entry.index << ":" |
149 |
<< setw(2) << (unsigned int) entry.subindex |
|
1188
3b4e82d9904b
Don't show Pdo (entry) names in configuration output.
Florian Pose <fp@igh-essen.com>
parents:
1172
diff
changeset
|
150 |
<< ", " << dec << setfill(' ') |
3b4e82d9904b
Don't show Pdo (entry) names in configuration output.
Florian Pose <fp@igh-essen.com>
parents:
1172
diff
changeset
|
151 |
<< setw(2) << (unsigned int) entry.bit_length |
3b4e82d9904b
Don't show Pdo (entry) names in configuration output.
Florian Pose <fp@igh-essen.com>
parents:
1172
diff
changeset
|
152 |
<< " bit" << endl; |
1142 | 153 |
} |
154 |
} |
|
155 |
} |
|
156 |
} |
|
157 |
||
158 |
cout << "Sdo configuration:" << endl; |
|
159 |
if (configIter->sdo_count) { |
|
160 |
for (j = 0; j < configIter->sdo_count; j++) { |
|
161 |
m.getConfigSdo(&sdo, configIter->config_index, j); |
|
162 |
||
163 |
cout << " 0x" |
|
164 |
<< hex << setfill('0') |
|
165 |
<< setw(4) << sdo.index << ":" |
|
166 |
<< setw(2) << (unsigned int) sdo.subindex |
|
167 |
<< ", " << dec << sdo.size << " byte: " << hex; |
|
168 |
||
169 |
switch (sdo.size) { |
|
170 |
case 1: |
|
171 |
cout << "0x" << setw(2) |
|
172 |
<< (unsigned int) *(uint8_t *) &sdo.data; |
|
173 |
break; |
|
174 |
case 2: |
|
175 |
cout << "0x" << setw(4) |
|
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1188
diff
changeset
|
176 |
<< le16_to_cpup(&sdo.data); |
1142 | 177 |
break; |
178 |
case 4: |
|
179 |
cout << "0x" << setw(8) |
|
1254
c19d273a9e76
Moved byteorder macros to ecrt.h.
Florian Pose <fp@igh-essen.com>
parents:
1188
diff
changeset
|
180 |
<< le32_to_cpup(&sdo.data); |
1142 | 181 |
break; |
182 |
default: |
|
183 |
cout << "???"; |
|
184 |
} |
|
185 |
||
186 |
cout << endl; |
|
187 |
} |
|
188 |
} else { |
|
189 |
cout << " None." << endl; |
|
190 |
} |
|
191 |
||
192 |
cout << endl; |
|
193 |
} |
|
194 |
} |
|
195 |
||
196 |
/*****************************************************************************/ |
|
197 |
||
198 |
/** Lists the bus configuration. |
|
199 |
*/ |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
200 |
void CommandConfig::listConfigs( |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
201 |
MasterDevice &m, |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
202 |
const ConfigList &configList |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
203 |
) |
1142 | 204 |
{ |
205 |
ConfigList::const_iterator configIter; |
|
206 |
stringstream str; |
|
207 |
Info info; |
|
208 |
typedef list<Info> InfoList; |
|
209 |
InfoList list; |
|
210 |
InfoList::const_iterator iter; |
|
211 |
unsigned int maxAliasWidth = 0, maxPosWidth = 0, |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
212 |
maxSlavePosWidth = 0, maxStateWidth = 0; |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
213 |
ec_ioctl_slave_t slave; |
1142 | 214 |
|
215 |
for (configIter = configList.begin(); |
|
216 |
configIter != configList.end(); |
|
217 |
configIter++) { |
|
218 |
||
219 |
str << dec << configIter->alias; |
|
220 |
info.alias = str.str(); |
|
221 |
str.clear(); |
|
222 |
str.str(""); |
|
223 |
||
224 |
str << configIter->position; |
|
225 |
info.pos = str.str(); |
|
226 |
str.clear(); |
|
227 |
str.str(""); |
|
228 |
||
229 |
str << hex << setfill('0') |
|
230 |
<< "0x" << setw(8) << configIter->vendor_id |
|
231 |
<< "/0x" << setw(8) << configIter->product_code; |
|
232 |
info.ident = str.str(); |
|
233 |
str.clear(); |
|
234 |
str.str(""); |
|
235 |
||
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
236 |
if (configIter->slave_position != -1) { |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
237 |
m.getSlave(&slave, configIter->slave_position); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
238 |
|
1172
74ee632c3b5e
Fixed attached slave position in 'ethercat config' -> decimal.
Florian Pose <fp@igh-essen.com>
parents:
1167
diff
changeset
|
239 |
str << dec << configIter->slave_position; |
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
240 |
info.slavePos = str.str(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
241 |
str.clear(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
242 |
str.str(""); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
243 |
|
1148
1762296870bd
Renamed state field to al_state.
Florian Pose <fp@igh-essen.com>
parents:
1147
diff
changeset
|
244 |
str << alStateString(slave.al_state); |
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
245 |
info.state = str.str(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
246 |
str.clear(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
247 |
str.str(""); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
248 |
} else { |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
249 |
str << "-"; |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
250 |
info.slavePos = str.str(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
251 |
str.clear(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
252 |
str.str(""); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
253 |
|
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
254 |
str << "-"; |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
255 |
info.state = str.str(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
256 |
str.clear(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
257 |
str.str(""); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
258 |
} |
1142 | 259 |
|
260 |
list.push_back(info); |
|
261 |
||
262 |
if (info.alias.length() > maxAliasWidth) |
|
263 |
maxAliasWidth = info.alias.length(); |
|
264 |
if (info.pos.length() > maxPosWidth) |
|
265 |
maxPosWidth = info.pos.length(); |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
266 |
if (info.slavePos.length() > maxSlavePosWidth) |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
267 |
maxSlavePosWidth = info.slavePos.length(); |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
268 |
if (info.state.length() > maxStateWidth) |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
269 |
maxStateWidth = info.state.length(); |
1142 | 270 |
} |
271 |
||
272 |
for (iter = list.begin(); iter != list.end(); iter++) { |
|
273 |
cout << setfill(' ') << right |
|
274 |
<< setw(maxAliasWidth) << iter->alias |
|
275 |
<< ":" << left |
|
276 |
<< setw(maxPosWidth) << iter->pos |
|
277 |
<< " " |
|
278 |
<< iter->ident |
|
279 |
<< " " |
|
1147
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
280 |
<< setw(maxSlavePosWidth) << iter->slavePos << " " |
0eac1ee8512a
Show attached slave position and state in 'ethercat config'.
Florian Pose <fp@igh-essen.com>
parents:
1144
diff
changeset
|
281 |
<< setw(maxStateWidth) << iter->state << " " |
1142 | 282 |
<< endl; |
283 |
} |
|
284 |
} |
|
285 |
||
286 |
/*****************************************************************************/ |