From 74b699cb78d5f166fad45152311d471b4f52f701 Mon Sep 17 00:00:00 2001 From: TheMarpe Date: Mon, 5 Sep 2022 19:53:33 +0200 Subject: [PATCH] Addressed PoE watchdog ping issues --- cmake/Depthai/DepthaiDeviceSideConfig.cmake | 2 +- shared/depthai-shared | 2 +- src/device/DeviceBase.cpp | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/Depthai/DepthaiDeviceSideConfig.cmake b/cmake/Depthai/DepthaiDeviceSideConfig.cmake index c7a9436d7..847ae7856 100644 --- a/cmake/Depthai/DepthaiDeviceSideConfig.cmake +++ b/cmake/Depthai/DepthaiDeviceSideConfig.cmake @@ -2,7 +2,7 @@ set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot") # "full commit hash of device side binary" -set(DEPTHAI_DEVICE_SIDE_COMMIT "154e46b348850ede50402af4bd2b99e39b47a003") +set(DEPTHAI_DEVICE_SIDE_COMMIT "2470bb3fb3855de1808cf3cc94509ee771bae7d5") # "version if applicable" set(DEPTHAI_DEVICE_SIDE_VERSION "") diff --git a/shared/depthai-shared b/shared/depthai-shared index b7eaf536f..385a6bc88 160000 --- a/shared/depthai-shared +++ b/shared/depthai-shared @@ -1 +1 @@ -Subproject commit b7eaf536f212eec9cb39bd6d3ac5a80f6f6d8851 +Subproject commit 385a6bc880a28f06ce5d0b4080567e925f657f7c diff --git a/src/device/DeviceBase.cpp b/src/device/DeviceBase.cpp index 88e14e8ca..cbc6179cd 100644 --- a/src/device/DeviceBase.cpp +++ b/src/device/DeviceBase.cpp @@ -490,7 +490,10 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optionalsetPattern(fmt::format("[{}] [{}] {}", deviceInfo.mxid, deviceInfo.name, LOG_DEFAULT_PATTERN)); // Check if WD env var is set - std::chrono::milliseconds watchdogTimeout = device::XLINK_WATCHDOG_TIMEOUT; + std::chrono::milliseconds watchdogTimeout = device::XLINK_USB_WATCHDOG_TIMEOUT; + if(deviceInfo.protocol == X_LINK_TCP_IP) { + watchdogTimeout = device::XLINK_TCP_WATCHDOG_TIMEOUT; + } auto watchdogMsStr = utility::getEnv("DEPTHAI_WATCHDOG"); if(!watchdogMsStr.empty()) { // Try parsing the string as a number @@ -637,8 +640,8 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optional lock(lastWatchdogPingTimeMtx); prevPingTime = lastWatchdogPingTime; } - // Recheck if watchdogRunning wasn't already closed - if(watchdogRunning && std::chrono::steady_clock::now() - prevPingTime > watchdogTimeout) { + // Recheck if watchdogRunning wasn't already closed and close if more than twice of WD passed + if(watchdogRunning && std::chrono::steady_clock::now() - prevPingTime > watchdogTimeout * 2) { spdlog::warn("Monitor thread (device: {} [{}]) - ping was missed, closing the device connection", deviceInfo.mxid, deviceInfo.name); // ping was missed, reset the device watchdogRunning = false;