diff -r 5460eba6c5e0 -r 8e6e6364087e etherlab/EthercatCFileGenerator.py --- a/etherlab/EthercatCFileGenerator.py Fri Apr 05 00:14:00 2013 +0200 +++ b/etherlab/EthercatCFileGenerator.py Thu Apr 11 10:32:58 2013 +0200 @@ -25,13 +25,13 @@ SLAVE_CONFIGURATION_TEMPLATE = """ if (!(slave%(slave)d = ecrt_master_slave_config(master, %(alias)d, %(position)d, 0x%(vendor).8x, 0x%(product_code).8x))) { - SLOGF(LOG_CRITICAL, "Failed to get slave %(device_type)s configuration at alias %(alias)d and position %(position)d.\\n"); + SLOGF(LOG_CRITICAL, "EtherCAT failed to get slave %(device_type)s configuration at alias %(alias)d and position %(position)d."); return -1; } if (ecrt_slave_config_pdos(slave%(slave)d, EC_END, slave_%(slave)d_syncs)) { - SLOGF(LOG_CRITICAL, "Failed to configure PDOs for slave %(device_type)s at alias %(alias)d and position %(position)d.\\n"); - return -1; + SLOGF(LOG_CRITICAL, "EtherCAT failed to configure PDOs for slave %(device_type)s at alias %(alias)d and position %(position)d."); + goto ecat_failed; } """ @@ -40,8 +40,8 @@ uint8_t value[%(data_size)d]; EC_WRITE_%(data_type)s((uint8_t *)value, %(data)s); if (ecrt_master_sdo_download(master, %(slave)d, 0x%(index).4x, 0x%(subindex).2x, (uint8_t *)value, %(data_size)d, &abort_code)) { - SLOGF(LOG_CRITICAL, "Failed to initialize slave %(device_type)s at alias %(alias)d and position %(position)d.\\nError: %%d\\n", abort_code); - return -1; + SLOGF(LOG_CRITICAL, "EtherCAT Failed to initialize slave %(device_type)s at alias %(alias)d and position %(position)d. Error: %%d", abort_code); + goto ecat_failed; } } """ @@ -50,8 +50,8 @@ { uint8_t value[%(data_size)d]; if (ecrt_master_sdo_upload(master, %(slave)d, 0x%(index).4x, 0x%(subindex).2x, (uint8_t *)value, %(data_size)d, &result_size, &abort_code)) { - SLOGF(LOG_CRITICAL, "Failed to get default value for output PDO in slave %(device_type)s at alias %(alias)d and position %(position)d.\\nError: %%ud\\n", abort_code); - return -1; + SLOGF(LOG_CRITICAL, "EtherCAT failed to get default value for output PDO in slave %(device_type)s at alias %(alias)d and position %(position)d. Error: %%ud", abort_code); + goto ecat_failed; } %(real_var)s = EC_READ_%(data_type)s((uint8_t *)value); }