diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp index 7edff8e..015c2f4 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp @@ -11,15 +11,17 @@ namespace free_rtos { namespace telegram { -const char EcatTelegramStatus::SuccessString[] = "Success !"; -const char EcatTelegramStatus::BusyString[] = "Busy. Transfer in progress..."; -const char EcatTelegramStatus::WarningString[] = "Warning ! Check error counters"; -const char EcatTelegramStatus::FatalErrorString[] = "Fatal error ! Transfer attempts exceeded"; +const char EcatTelegramStatus::SuccessString[] = "Success !"; +const char EcatTelegramStatus::BusyString[] = "Busy. Transfer in progress..."; +const char EcatTelegramStatus::WarningTransferErrorString[] = "Warning ! Transfer error. Check error counters"; +const char EcatTelegramStatus::WarningWkcErrorString[] = "Warning ! WKC error. Check error counters"; +const char EcatTelegramStatus::FatalErrorString[] = "Fatal error ! Transfer attempts exceeded"; const EcatDescription EcatTelegramStatus::descriptions[] = { {EcatTelegramStatus::SuccessString, sizeof(EcatTelegramStatus::SuccessString)}, {EcatTelegramStatus::BusyString, sizeof(EcatTelegramStatus::BusyString)}, - {EcatTelegramStatus::WarningString, sizeof(EcatTelegramStatus::WarningString)}, + {EcatTelegramStatus::WarningTransferErrorString, sizeof(EcatTelegramStatus::WarningTransferErrorString)}, + {EcatTelegramStatus::WarningWkcErrorString, sizeof(EcatTelegramStatus::WarningWkcErrorString)}, {EcatTelegramStatus::FatalErrorString, sizeof(EcatTelegramStatus::FatalErrorString)} }; @@ -103,10 +105,13 @@ bool EcatTelegram::transfer() { transfer_attempts++; if(transfer_attempts > max_transfer_attempts_) { + DebugP_log((char*)"%s\r\n", status_.get_description().string); + status_.attempts_exceeded_errors++; status_.result = EcatTelegramResult::FATAL_ERROR; - DebugP_log((char*)"Transfer attempts exceeded !\r\n"); + DebugP_log((char*)"%s\r\n", status_.get_description().string); + break; } @@ -115,7 +120,7 @@ bool EcatTelegram::transfer() { if(stat == false) { status_.transfer_errors++; - status_.result = EcatTelegramResult::WARNING; + status_.result = EcatTelegramResult::WARNING_TRANSFER_ERROR; continue; } @@ -126,7 +131,7 @@ bool EcatTelegram::transfer() { if(as_expected == false) { status_.expected_wkc_errors++; - status_.result = EcatTelegramResult::WARNING; + status_.result = EcatTelegramResult::WARNING_WKC_ERROR; continue; } diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp index eb7e21d..5677638 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp @@ -19,7 +19,8 @@ namespace telegram { enum class EcatTelegramResult : uint16_t { SUCCESS = 0, BUSY, - WARNING, + WARNING_TRANSFER_ERROR, + WARNING_WKC_ERROR, FATAL_ERROR }; @@ -41,7 +42,8 @@ struct EcatTelegramStatus { private: static const char SuccessString[]; static const char BusyString[]; - static const char WarningString[]; + static const char WarningTransferErrorString[]; + static const char WarningWkcErrorString[]; static const char FatalErrorString[]; static const EcatDescription descriptions[];