diff --git a/src/drivers/optical_flow/paa3905/PAA3905.cpp b/src/drivers/optical_flow/paa3905/PAA3905.cpp index 23cdee2f13..be4ae70655 100644 --- a/src/drivers/optical_flow/paa3905/PAA3905.cpp +++ b/src/drivers/optical_flow/paa3905/PAA3905.cpp @@ -234,7 +234,7 @@ void PAA3905::RunImpl() } // push backup schedule back - ScheduleDelayed(1_s); + ScheduleDelayed(kBackupScheduleIntervalUs); } struct TransferBuffer { @@ -415,7 +415,7 @@ void PAA3905::RunImpl() } // only publish when there's motion or at least every second - if (motion_reported || (hrt_elapsed_time(&_last_publish) >= 1_s)) { + if (motion_reported || (hrt_elapsed_time(&_last_publish) >= kBackupScheduleIntervalUs)) { sensor_optical_flow.timestamp = hrt_absolute_time(); _sensor_optical_flow_pub.publish(sensor_optical_flow); diff --git a/src/drivers/optical_flow/paa3905/PAA3905.hpp b/src/drivers/optical_flow/paa3905/PAA3905.hpp index a6d8b4afbf..e27bdf0fb6 100644 --- a/src/drivers/optical_flow/paa3905/PAA3905.hpp +++ b/src/drivers/optical_flow/paa3905/PAA3905.hpp @@ -121,6 +121,7 @@ private: bool _data_ready_interrupt_enabled{false}; uint32_t _scheduled_interval_us{SAMPLE_INTERVAL_MODE_0 / 2}; + static constexpr uint32_t kBackupScheduleIntervalUs{200_ms}; Mode _mode{Mode::LowLight}; diff --git a/src/drivers/optical_flow/paw3902/PAW3902.cpp b/src/drivers/optical_flow/paw3902/PAW3902.cpp index dabf34d6bf..9b30e7efcf 100644 --- a/src/drivers/optical_flow/paw3902/PAW3902.cpp +++ b/src/drivers/optical_flow/paw3902/PAW3902.cpp @@ -239,7 +239,7 @@ void PAW3902::RunImpl() } // push backup schedule back - ScheduleDelayed(1_s); + ScheduleDelayed(kBackupScheduleIntervalUs); } struct TransferBuffer { @@ -418,7 +418,7 @@ void PAW3902::RunImpl() } // only publish when there's motion or at least every second - if (motion_reported || (hrt_elapsed_time(&_last_publish) >= 1_s)) { + if (motion_reported || (hrt_elapsed_time(&_last_publish) >= kBackupScheduleIntervalUs)) { sensor_optical_flow.timestamp = hrt_absolute_time(); _sensor_optical_flow_pub.publish(sensor_optical_flow); diff --git a/src/drivers/optical_flow/paw3902/PAW3902.hpp b/src/drivers/optical_flow/paw3902/PAW3902.hpp index 44e1479753..f5c624e856 100644 --- a/src/drivers/optical_flow/paw3902/PAW3902.hpp +++ b/src/drivers/optical_flow/paw3902/PAW3902.hpp @@ -121,6 +121,7 @@ private: bool _data_ready_interrupt_enabled{false}; uint32_t _scheduled_interval_us{SAMPLE_INTERVAL_MODE_0 / 2}; + static constexpr uint32_t kBackupScheduleIntervalUs{200_ms}; Mode _mode{Mode::LowLight};