aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-09-11 01:02:35 +0200
committerLorenz Meier <lm@inf.ethz.ch>2014-09-11 01:02:35 +0200
commitbc880a3ff9a297d39c7f53068bbe3ad1be572d44 (patch)
treeb81bb0b5e945035802c442777f5628edf5779019
parentcf601c09bf14ac4141bc66f2f71934fcf65da2a6 (diff)
downloadpx4-firmware-bc880a3ff9a297d39c7f53068bbe3ad1be572d44.tar.gz
px4-firmware-bc880a3ff9a297d39c7f53068bbe3ad1be572d44.tar.bz2
px4-firmware-bc880a3ff9a297d39c7f53068bbe3ad1be572d44.zip
Fix dt calculation which is used to calculate correct drop time.
-rw-r--r--src/modules/bottle_drop/bottle_drop.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/modules/bottle_drop/bottle_drop.cpp b/src/modules/bottle_drop/bottle_drop.cpp
index 0bb65252f..811470308 100644
--- a/src/modules/bottle_drop/bottle_drop.cpp
+++ b/src/modules/bottle_drop/bottle_drop.cpp
@@ -466,7 +466,7 @@ BottleDrop::task_main()
const unsigned sleeptime_us = 50000;
hrt_abstime last_run = hrt_absolute_time();
- float dt_runs = 1e6f / sleeptime_us;
+ float dt_runs = sleeptime_us / 1e6f;
// switch to faster updates during the drop
while (_drop_state > DROP_STATE_INIT) {
@@ -691,7 +691,7 @@ BottleDrop::task_main()
// run at roughly 20 Hz
usleep(sleeptime_us);
- dt_runs = 1e6f / hrt_elapsed_time(&last_run);
+ dt_runs = hrt_elapsed_time(&last_run) / 1e6f;
last_run = hrt_absolute_time();
}
}