mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 22:32:11 +08:00
tfmini: reduce sampling rate from 10kHz to 143Hz
10kHz sampling seems excessive, given that the sensor is expected to output at 100Hz. Also don't reschedule immediately in case we have not received any data.
This commit is contained in:
@@ -168,7 +168,7 @@ TFMINI::collect()
|
||||
|
||||
if (!bytes_available) {
|
||||
perf_end(_sample_perf);
|
||||
return -EAGAIN;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// parse entire buffer
|
||||
@@ -223,8 +223,8 @@ TFMINI::collect()
|
||||
void
|
||||
TFMINI::start()
|
||||
{
|
||||
// schedule a cycle to start things
|
||||
ScheduleOnInterval(100_us);
|
||||
// schedule a cycle to start things (the sensor sends at 100Hz, but we run a bit faster to avoid missing data)
|
||||
ScheduleOnInterval(7_ms);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -246,7 +246,7 @@ TFMINI::Run()
|
||||
if (collect() == -EAGAIN) {
|
||||
// reschedule to grab the missing bits, time to transmit 9 bytes @ 115200 bps
|
||||
ScheduleClear();
|
||||
ScheduleOnInterval(100_us, 87 * 9);
|
||||
ScheduleOnInterval(7_ms, 87 * 9);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user