@@ -490,7 +490,10 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optional<co
490490 pimpl->setPattern (fmt::format (" [{}] [{}] {}" , deviceInfo.mxid , deviceInfo.name , LOG_DEFAULT_PATTERN));
491491
492492 // Check if WD env var is set
493- std::chrono::milliseconds watchdogTimeout = device::XLINK_WATCHDOG_TIMEOUT;
493+ std::chrono::milliseconds watchdogTimeout = device::XLINK_USB_WATCHDOG_TIMEOUT;
494+ if (deviceInfo.protocol == X_LINK_TCP_IP) {
495+ watchdogTimeout = device::XLINK_TCP_WATCHDOG_TIMEOUT;
496+ }
494497 auto watchdogMsStr = utility::getEnv (" DEPTHAI_WATCHDOG" );
495498 if (!watchdogMsStr.empty ()) {
496499 // Try parsing the string as a number
@@ -637,8 +640,8 @@ void DeviceBase::init2(Config cfg, const dai::Path& pathToMvcmd, tl::optional<co
637640 std::unique_lock<std::mutex> lock (lastWatchdogPingTimeMtx);
638641 prevPingTime = lastWatchdogPingTime;
639642 }
640- // Recheck if watchdogRunning wasn't already closed
641- if (watchdogRunning && std::chrono::steady_clock::now () - prevPingTime > watchdogTimeout) {
643+ // Recheck if watchdogRunning wasn't already closed and close if more than twice of WD passed
644+ if (watchdogRunning && std::chrono::steady_clock::now () - prevPingTime > watchdogTimeout * 2 ) {
642645 spdlog::warn (" Monitor thread (device: {} [{}]) - ping was missed, closing the device connection" , deviceInfo.mxid , deviceInfo.name );
643646 // ping was missed, reset the device
644647 watchdogRunning = false ;
0 commit comments