From 856a947d52756f505de8c34684d44f8795c85e5a Mon Sep 17 00:00:00 2001 From: Christoph Hellmann Santos Date: Fri, 13 Oct 2023 21:28:47 +0200 Subject: [PATCH] Add boot timeout (1s) Signed-off-by: Christoph Hellmann Santos --- canopen_base_driver/src/lely_driver_bridge.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/canopen_base_driver/src/lely_driver_bridge.cpp b/canopen_base_driver/src/lely_driver_bridge.cpp index 3e2923033..182eae8fb 100644 --- a/canopen_base_driver/src/lely_driver_bridge.cpp +++ b/canopen_base_driver/src/lely_driver_bridge.cpp @@ -71,6 +71,8 @@ std::string LelyBridgeErrCategory::message(int ev) const case LelyBridgeErrc::SerialNumberDifference: return "Value of object 1018:04 from CANopen device is different to value in object 1F88 " "(Serial number)."; + case LelyBridgeErrc::TimedOut: + return "The boot configure process timed out (took more than 1 second)."; default: return "(unrecognized error)"; } @@ -112,6 +114,18 @@ void LelyDriverBridge::OnBoot(canopen::NmtState st, char es, const ::std::string boot_cond.notify_all(); } +void LelyDriverBridge::OnConfig(::std::function res) noexcept +{ + std::cout << "OnConfig" << std::endl; + this->SubmitWait( + std::chrono::seconds(10), + [this, res](std::error_code ec) + { + std::cout << "OnConfig" << std::endl; + FiberDriver::OnConfig(res); + }); +} + void LelyDriverBridge::OnRpdoWrite(uint16_t idx, uint8_t subidx) noexcept { lely::COSub * sub = this->dictionary_->find(idx, subidx);