Hi, I have been using this library to control CiA401 devices and I found a memory access violation issue if we try to remap pdo after a deleting old device and creating a new one. The issue was related to the residual add_pdo_received_callback entry. The workaround is to remove the residual add_pdo_received_callback while destroying a device.
Device::~Device() {
for (auto& cob_id : cobids)
m_core.pdo.remove_pdo_received_callback(cob_id);
}
void PDO::remove_pdo_received_callback(uint16_t cob_id) {
std::lock_guard scoped_lock(m_receive_callbacks_mutex);
for (auto i = m_receive_callbacks.begin(); i != m_receive_callbacks.end();
i++)
if ((*i).cob_id == cob_id) {
m_receive_callbacks.erase(i);
break;
}
}
I am now trying to write a master side example which handles multiple slave device on the same bus. Any suggestion will really be appreciated.
Hi, I have been using this library to control CiA401 devices and I found a memory access violation issue if we try to remap pdo after a deleting old device and creating a new one. The issue was related to the residual add_pdo_received_callback entry. The workaround is to remove the residual add_pdo_received_callback while destroying a device.
Device::~Device() { for (auto& cob_id : cobids) m_core.pdo.remove_pdo_received_callback(cob_id); }
void PDO::remove_pdo_received_callback(uint16_t cob_id) { std::lock_guard scoped_lock(m_receive_callbacks_mutex);
for (auto i = m_receive_callbacks.begin(); i != m_receive_callbacks.end();
i++)
if ((*i).cob_id == cob_id) {
m_receive_callbacks.erase(i);
break;
}
}
I am now trying to write a master side example which handles multiple slave device on the same bus. Any suggestion will really be appreciated.