Skip to content

Commit 74b699c

Browse files
committed
Addressed PoE watchdog ping issues
1 parent ffe017a commit 74b699c

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cmake/Depthai/DepthaiDeviceSideConfig.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")
33

44
# "full commit hash of device side binary"
5-
set(DEPTHAI_DEVICE_SIDE_COMMIT "154e46b348850ede50402af4bd2b99e39b47a003")
5+
set(DEPTHAI_DEVICE_SIDE_COMMIT "2470bb3fb3855de1808cf3cc94509ee771bae7d5")
66

77
# "version if applicable"
88
set(DEPTHAI_DEVICE_SIDE_VERSION "")

src/device/DeviceBase.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)