Print certain warnings only at debug_level.
--- a/include/ecrt.h Fri Oct 27 13:58:14 2006 +0000
+++ b/include/ecrt.h Fri Oct 27 13:59:49 2006 +0000
@@ -161,7 +161,7 @@
uint8_t sdo_subindex, uint32_t value);
int ecrt_slave_pdo_size(ec_slave_t *slave, uint16_t pdo_index,
- uint8_t pdo_subindex, size_t size);
+ uint8_t pdo_subindex, size_t size); // deprecated
/******************************************************************************
* Bitwise read/write macros
--- a/master/fsm.c Fri Oct 27 13:58:14 2006 +0000
+++ b/master/fsm.c Fri Oct 27 13:59:49 2006 +0000
@@ -492,7 +492,7 @@
if (datagram->working_counter != 1) {
if (slave->online) {
slave->online = 0;
- if (master->debug_level)
+ if (slave->master->debug_level)
EC_DBG("Slave %i: offline.\n", slave->ring_position);
}
ec_fsm_master_action_next_slave_state(fsm);
@@ -505,7 +505,7 @@
slave->online = 1;
slave->error_flag = 0; // clear error flag
slave->current_state = new_state;
- if (master->debug_level) {
+ if (slave->master->debug_level) {
char cur_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->current_state, cur_state);
EC_DBG("Slave %i: online (%s).\n",
@@ -513,7 +513,7 @@
}
}
else if (new_state != slave->current_state) {
- if (master->debug_level) {
+ if (slave->master->debug_level) {
char old_state[EC_STATE_STRING_SIZE],
cur_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->current_state, old_state);
@@ -1188,8 +1188,9 @@
goto end;
break;
default:
- EC_WARN("Unknown category type 0x%04X in slave %i.\n",
- cat_type, slave->ring_position);
+ if (fsm->master->debug_level)
+ EC_WARN("Unknown category type 0x%04X in slave %i.\n",
+ cat_type, slave->ring_position);
}
cat_word += cat_size + 2;
--- a/master/fsm_coe.c Fri Oct 27 13:58:14 2006 +0000
+++ b/master/fsm_coe.c Fri Oct 27 13:59:49 2006 +0000
@@ -395,8 +395,9 @@
for (i = 0; i < sdo_count; i++) {
sdo_index = EC_READ_U16(data + 8 + i * 2);
if (!sdo_index) {
- EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n",
- slave->ring_position);
+ if (slave->master->debug_level)
+ EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n",
+ slave->ring_position);
continue;
}
@@ -1191,7 +1192,8 @@
expedited = EC_READ_U8(data + 2) & 0x02;
if (expedited) {
- EC_WARN("Received expedited response upon normal request!\n");
+ if (master->debug_level)
+ EC_WARN("Received expedited response upon normal request!\n");
size_specified = EC_READ_U8(data + 2) & 0x01;
if (size_specified) {
--- a/master/master.c Fri Oct 27 13:58:14 2006 +0000
+++ b/master/master.c Fri Oct 27 13:59:49 2006 +0000
@@ -1031,8 +1031,10 @@
}
if (!found) {
- EC_WARN("No EoE handler for slave %i!\n", slave->ring_position);
- ec_slave_request_state(slave, EC_SLAVE_STATE_INIT);
+ if (master->debug_level)
+ EC_WARN("No EoE handler for slave %i!\n",
+ slave->ring_position);
+ ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);
}
}
--- a/master/slave.c Fri Oct 27 13:58:14 2006 +0000
+++ b/master/slave.c Fri Oct 27 13:59:49 2006 +0000
@@ -496,7 +496,9 @@
return 0;
}
- EC_WARN("String %i not found in slave %i.\n", index, slave->ring_position);
+ if (slave->master->debug_level)
+ EC_WARN("String %i not found in slave %i.\n",
+ index, slave->ring_position);
err_string = "(string not found)";