From 31016aa2af482367bc12b4f0587cce6c95d9a26e Mon Sep 17 00:00:00 2001 From: algin Date: Mon, 18 Sep 2023 10:25:47 +0300 Subject: [PATCH] =?UTF-8?q?fix(SF-33):=20=D0=98=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BD=D0=B0=20=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D0=BD=D0=B4=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ethernet_industry/CoE/eth_ecat_pdo_fmmu.hpp | 4 ++-- .../ethernet_industry/eth_ecat_telegram.cpp | 8 +++++++- .../ethernet_industry/eth_ecat_telegram.hpp | 12 ++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/components/free_rtos/ethernet_industry/CoE/eth_ecat_pdo_fmmu.hpp b/components/free_rtos/ethernet_industry/CoE/eth_ecat_pdo_fmmu.hpp index 416e919..bfc00e8 100644 --- a/components/free_rtos/ethernet_industry/CoE/eth_ecat_pdo_fmmu.hpp +++ b/components/free_rtos/ethernet_industry/CoE/eth_ecat_pdo_fmmu.hpp @@ -153,7 +153,7 @@ private: telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram(); ecat_buffer::FMMUGlobalProperties& fmmu_global_properties = ecat_buffer_.get_fmmu_global_properties(); address::Logical logical = fmmu_global_properties.logical_start_address + offset; - const datagram::TEcatWkc expected_wkc = 1; + const datagram::TEcatWkc expected_wkc = pdo_fmmu_slaves_.size(); TDatagram datagram{ {{logical}}, expected_wkc, data... }; return telegram.transfer(datagram); @@ -166,7 +166,7 @@ private: telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram(); ecat_buffer::FMMUGlobalProperties& fmmu_global_properties = ecat_buffer_.get_fmmu_global_properties(); address::Logical logical = fmmu_global_properties.logical_start_address + fmmu_global_properties.logical_full_length_write + offset; - const datagram::TEcatWkc expected_wkc = 1; + const datagram::TEcatWkc expected_wkc = pdo_fmmu_slaves_.size(); TDatagram datagram{ {{logical}}, expected_wkc, data... }; return telegram.transfer(datagram); diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp index 6725673..f18c9a0 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.cpp @@ -119,7 +119,7 @@ bool EcatTelegram::transfer() { status_.attempts_exceeded_errors++; status_.result = EcatTelegramResult::FATAL_ERROR; - DebugP_log((char*)"%s\r\n", status_.get_description().string); + DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.attempts_exceeded_errors); break; } @@ -131,6 +131,8 @@ bool EcatTelegram::transfer() { status_.transfer_errors++; status_.result = EcatTelegramResult::WARNING_TRANSFER_ERROR; + //DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.transfer_errors); + continue; } @@ -138,6 +140,8 @@ bool EcatTelegram::transfer() { status_.transfer_errors++; status_.result = EcatTelegramResult::WARNING_TIMEOUT_ERROR; + //DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.transfer_errors); + continue; } @@ -147,6 +151,8 @@ bool EcatTelegram::transfer() { status_.expected_wkc_errors++; status_.result = EcatTelegramResult::WARNING_WKC_ERROR; + //DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.expected_wkc_errors); + continue; } diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp index 534ed8e..7f40951 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp @@ -31,9 +31,9 @@ struct EcatDescription { }; struct EcatTelegramStatus { - uint16_t transfer_errors; - uint16_t expected_wkc_errors; - uint16_t attempts_exceeded_errors; + uint16_t transfer_errors{0x0000}; + uint16_t expected_wkc_errors{0x0000}; + uint16_t attempts_exceeded_errors{0x0000}; EcatTelegramResult result = EcatTelegramResult::BUSY; const EcatDescription& get_description() { @@ -74,8 +74,8 @@ public: bool transfer(queue::Queue& next); private: - static constexpr uint32_t connection_timeout_ticks_ = 2; - static constexpr uint32_t max_transfer_attempts_ = 3; + static constexpr uint32_t connection_timeout_ticks_ = 100; + static constexpr uint32_t max_transfer_attempts_ = 2; Eth& eth_; EthTxFlowIface& tx_flow_; @@ -87,7 +87,7 @@ private: queue::Queue datagram_queue_; //datagram::IEcatDatagram *datagram_queue_{nullptr}; - EcatTelegramStatus status_; + EcatTelegramStatus status_{0x0000, 0x0000, 0x0000, EcatTelegramResult::BUSY}; bool transfer();