diff --git a/components/rgbd-sources/src/sources/stereovideo/pylon.cpp b/components/rgbd-sources/src/sources/stereovideo/pylon.cpp index 89bc3381223a0c7e3bfb29e195fd226e481c17a8..3e3945a7205af2cd201bf4a35cf2e1c42f0dbc57 100644 --- a/components/rgbd-sources/src/sources/stereovideo/pylon.cpp +++ b/components/rgbd-sources/src/sources/stereovideo/pylon.cpp @@ -124,15 +124,14 @@ PylonDevice::PylonDevice(nlohmann::json &config) }); monitor_ = true; - temperature_monitor_ = ftl::timer::add(ftl::timer::timerlevel_t::kTimerIdle1, 3.0, [this](int64_t ts) { - for (auto* cam : {lcam_, rcam_}) { - // is this thread safe? - float temperature = cam->DeviceTemperature(); - LOG_IF(WARNING, temperature > 53.0) - << "Camera temperature over 50C (value: " << temperature << ")"; - - // TODO: stop if camera temperature exceeds threshold - } + temperature_monitor_ = ftl::timer::add(ftl::timer::timerlevel_t::kTimerIdle1, 10.0, [this](int64_t ts) { + + float temperature = (rcam_) ? std::max(lcam_->DeviceTemperature(), rcam_->DeviceTemperature()) : lcam_->DeviceTemperature(); + + LOG_IF(WARNING, temperature > 53.0) + << "Camera temperature over 50C (value: " << temperature << ")"; + + // TODO: stop if camera temperature exceeds threshold return true; });