Compare commits

..

2 Commits

3 changed files with 15 additions and 9 deletions

View File

@ -153,7 +153,7 @@ private:
telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram(); telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram();
ecat_buffer::FMMUGlobalProperties& fmmu_global_properties = ecat_buffer_.get_fmmu_global_properties(); ecat_buffer::FMMUGlobalProperties& fmmu_global_properties = ecat_buffer_.get_fmmu_global_properties();
address::Logical logical = fmmu_global_properties.logical_start_address + offset; 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... }; TDatagram datagram{ {{logical}}, expected_wkc, data... };
return telegram.transfer(datagram); return telegram.transfer(datagram);
@ -166,7 +166,7 @@ private:
telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram(); telegram::EcatTelegram& telegram = ecat_buffer_.get_ecat().get_telegram();
ecat_buffer::FMMUGlobalProperties& fmmu_global_properties = ecat_buffer_.get_fmmu_global_properties(); 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; 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... }; TDatagram datagram{ {{logical}}, expected_wkc, data... };
return telegram.transfer(datagram); return telegram.transfer(datagram);

View File

@ -119,7 +119,7 @@ bool EcatTelegram::transfer() {
status_.attempts_exceeded_errors++; status_.attempts_exceeded_errors++;
status_.result = EcatTelegramResult::FATAL_ERROR; 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; break;
} }
@ -131,6 +131,8 @@ bool EcatTelegram::transfer() {
status_.transfer_errors++; status_.transfer_errors++;
status_.result = EcatTelegramResult::WARNING_TRANSFER_ERROR; status_.result = EcatTelegramResult::WARNING_TRANSFER_ERROR;
//DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.transfer_errors);
continue; continue;
} }
@ -138,6 +140,8 @@ bool EcatTelegram::transfer() {
status_.transfer_errors++; status_.transfer_errors++;
status_.result = EcatTelegramResult::WARNING_TIMEOUT_ERROR; status_.result = EcatTelegramResult::WARNING_TIMEOUT_ERROR;
//DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.transfer_errors);
continue; continue;
} }
@ -147,6 +151,8 @@ bool EcatTelegram::transfer() {
status_.expected_wkc_errors++; status_.expected_wkc_errors++;
status_.result = EcatTelegramResult::WARNING_WKC_ERROR; status_.result = EcatTelegramResult::WARNING_WKC_ERROR;
//DebugP_log((char*)"%s: %d\r\n", status_.get_description().string, status_.expected_wkc_errors);
continue; continue;
} }

View File

@ -31,9 +31,9 @@ struct EcatDescription {
}; };
struct EcatTelegramStatus { struct EcatTelegramStatus {
uint16_t transfer_errors; uint16_t transfer_errors{0x0000};
uint16_t expected_wkc_errors; uint16_t expected_wkc_errors{0x0000};
uint16_t attempts_exceeded_errors; uint16_t attempts_exceeded_errors{0x0000};
EcatTelegramResult result = EcatTelegramResult::BUSY; EcatTelegramResult result = EcatTelegramResult::BUSY;
const EcatDescription& get_description() { const EcatDescription& get_description() {
@ -74,8 +74,8 @@ public:
bool transfer(queue::Queue<datagram::IEcatDatagram>& next); bool transfer(queue::Queue<datagram::IEcatDatagram>& next);
private: private:
static constexpr uint32_t connection_timeout_ticks_ = 2; static constexpr uint32_t connection_timeout_ticks_ = 50;
static constexpr uint32_t max_transfer_attempts_ = 3; static constexpr uint32_t max_transfer_attempts_ = 2;
Eth& eth_; Eth& eth_;
EthTxFlowIface& tx_flow_; EthTxFlowIface& tx_flow_;
@ -87,7 +87,7 @@ private:
queue::Queue<datagram::IEcatDatagram> datagram_queue_; queue::Queue<datagram::IEcatDatagram> datagram_queue_;
//datagram::IEcatDatagram *datagram_queue_{nullptr}; //datagram::IEcatDatagram *datagram_queue_{nullptr};
EcatTelegramStatus status_; EcatTelegramStatus status_{0x0000, 0x0000, 0x0000, EcatTelegramResult::BUSY};
bool transfer(); bool transfer();