Print certain warnings only at debug_level.

This commit is contained in:
Florian Pose 2006-10-27 13:59:49 +00:00
parent b53d42b6e3
commit 1f44556083
5 changed files with 19 additions and 12 deletions

View File

@ -161,7 +161,7 @@ int ecrt_slave_conf_sdo32(ec_slave_t *slave, uint16_t sdo_index,
uint8_t sdo_subindex, uint32_t value); uint8_t sdo_subindex, uint32_t value);
int ecrt_slave_pdo_size(ec_slave_t *slave, uint16_t pdo_index, 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 * Bitwise read/write macros

View File

@ -492,7 +492,7 @@ void ec_fsm_master_read_states(ec_fsm_t *fsm /**< finite state machine */)
if (datagram->working_counter != 1) { if (datagram->working_counter != 1) {
if (slave->online) { if (slave->online) {
slave->online = 0; slave->online = 0;
if (master->debug_level) if (slave->master->debug_level)
EC_DBG("Slave %i: offline.\n", slave->ring_position); EC_DBG("Slave %i: offline.\n", slave->ring_position);
} }
ec_fsm_master_action_next_slave_state(fsm); ec_fsm_master_action_next_slave_state(fsm);
@ -505,7 +505,7 @@ void ec_fsm_master_read_states(ec_fsm_t *fsm /**< finite state machine */)
slave->online = 1; slave->online = 1;
slave->error_flag = 0; // clear error flag slave->error_flag = 0; // clear error flag
slave->current_state = new_state; slave->current_state = new_state;
if (master->debug_level) { if (slave->master->debug_level) {
char cur_state[EC_STATE_STRING_SIZE]; char cur_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->current_state, cur_state); ec_state_string(slave->current_state, cur_state);
EC_DBG("Slave %i: online (%s).\n", EC_DBG("Slave %i: online (%s).\n",
@ -513,7 +513,7 @@ void ec_fsm_master_read_states(ec_fsm_t *fsm /**< finite state machine */)
} }
} }
else if (new_state != slave->current_state) { else if (new_state != slave->current_state) {
if (master->debug_level) { if (slave->master->debug_level) {
char old_state[EC_STATE_STRING_SIZE], char old_state[EC_STATE_STRING_SIZE],
cur_state[EC_STATE_STRING_SIZE]; cur_state[EC_STATE_STRING_SIZE];
ec_state_string(slave->current_state, old_state); ec_state_string(slave->current_state, old_state);
@ -1188,8 +1188,9 @@ void ec_fsm_slavescan_eeprom_data(ec_fsm_t *fsm /**< finite state machine */)
goto end; goto end;
break; break;
default: default:
EC_WARN("Unknown category type 0x%04X in slave %i.\n", if (fsm->master->debug_level)
cat_type, slave->ring_position); EC_WARN("Unknown category type 0x%04X in slave %i.\n",
cat_type, slave->ring_position);
} }
cat_word += cat_size + 2; cat_word += cat_size + 2;

View File

@ -395,8 +395,9 @@ void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
for (i = 0; i < sdo_count; i++) { for (i = 0; i < sdo_count; i++) {
sdo_index = EC_READ_U16(data + 8 + i * 2); sdo_index = EC_READ_U16(data + 8 + i * 2);
if (!sdo_index) { if (!sdo_index) {
EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n", if (slave->master->debug_level)
slave->ring_position); EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n",
slave->ring_position);
continue; continue;
} }
@ -1191,7 +1192,8 @@ void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
expedited = EC_READ_U8(data + 2) & 0x02; expedited = EC_READ_U8(data + 2) & 0x02;
if (expedited) { 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; size_specified = EC_READ_U8(data + 2) & 0x01;
if (size_specified) { if (size_specified) {

View File

@ -1031,8 +1031,10 @@ void ec_master_eoe_start(ec_master_t *master /**< EtherCAT master */)
} }
if (!found) { if (!found) {
EC_WARN("No EoE handler for slave %i!\n", slave->ring_position); if (master->debug_level)
ec_slave_request_state(slave, EC_SLAVE_STATE_INIT); EC_WARN("No EoE handler for slave %i!\n",
slave->ring_position);
ec_slave_request_state(slave, EC_SLAVE_STATE_PREOP);
} }
} }

View File

@ -496,7 +496,9 @@ int ec_slave_locate_string(ec_slave_t *slave, /**< EtherCAT slave */
return 0; 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)"; err_string = "(string not found)";