diff --git a/components/free_rtos/ethernet_industry/eth_ecat.cpp b/components/free_rtos/ethernet_industry/eth_ecat.cpp index 19af952..bc856f0 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat.cpp +++ b/components/free_rtos/ethernet_industry/eth_ecat.cpp @@ -20,7 +20,7 @@ EthEcat::EthEcat(Eth& eth) void EthEcat::Init(TEthMacPorts port_id, uint32_t period_microsec = 250) { port_id_ = port_id; - telegram_.init(port_id); + telegram_.init(port_id, period_microsec, 6); Timer::Settings ecat_tmr_sett = { .input_clk_Hz = 25000000, // 25MHz diff --git a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp index 6694e70..217b035 100644 --- a/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp +++ b/components/free_rtos/ethernet_industry/eth_ecat_telegram.hpp @@ -68,8 +68,11 @@ public: virtual int32_t Process(uint8_t *p_data, uint32_t len) override; virtual uint32_t Sender(uint8_t *p_data, size_t scatter_segment) override; - void init(TEthMacPorts port_id) { + void init(TEthMacPorts port_id, uint32_t period_microsec, uint32_t max_transfer_attempts) { port_id_ = port_id; + period_microsec_ = period_microsec; + counter_timeout_ticks_ = (semaphore_timeout_ticks_*1000)/period_microsec; + max_transfer_attempts_ = max_transfer_attempts; eth_.getEthStackPtr()->Register(ETH_PROT_ECAT_LE, this); } @@ -90,14 +93,16 @@ public: private: static constexpr uint32_t semaphore_timeout_ticks_ = 2; - static constexpr uint32_t counter_timeout_ticks_ = 8; - static constexpr uint32_t max_transfer_attempts_ = 6; Eth& eth_; Timer& ecat_timer_; EthTxFlowIface& tx_flow_; EthStackIface& eth_stack_; + TEthMacPorts port_id_; + uint32_t period_microsec_{250}; + uint32_t counter_timeout_ticks_{8}; + uint32_t max_transfer_attempts_{6}; free_rtos::Semaphore rx_sem_; uint8_t idx_{0x00};