From bc2f5fa33b37ffd65ce4aaa9bcff3b43238fa362 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 11 May 2019 18:18:21 +1000 Subject: [PATCH] ArduCopter: use EXPECT_DELAY() macro --- ArduCopter/compassmot.cpp | 6 ++---- ArduCopter/motor_test.cpp | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ArduCopter/compassmot.cpp b/ArduCopter/compassmot.cpp index e9d3913862..428ea3dfef 100644 --- a/ArduCopter/compassmot.cpp +++ b/ArduCopter/compassmot.cpp @@ -124,7 +124,7 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) interference_pct[i] = 0.0f; } - hal.scheduler->expect_delay_ms(5000); + EXPECT_DELAY(hal, 5000); // enable motors and pass through throttle init_rc_out(); @@ -137,7 +137,7 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) // main run while there is no user input and the compass is healthy while (command_ack_start == command_ack_counter && compass.healthy() && motors->armed()) { - hal.scheduler->expect_delay_ms(5000); + EXPECT_DELAY(hal, 5000); // 50hz loop if (millis() - last_run_time < 20) { @@ -230,8 +230,6 @@ MAV_RESULT Copter::mavlink_compassmot(mavlink_channel_t chan) } } - hal.scheduler->expect_delay_ms(0); - // stop motors motors->output_min(); motors->armed(false); diff --git a/ArduCopter/motor_test.cpp b/ArduCopter/motor_test.cpp index a0138a0e18..6b0e573125 100644 --- a/ArduCopter/motor_test.cpp +++ b/ArduCopter/motor_test.cpp @@ -25,6 +25,8 @@ void Copter::motor_test_output() return; } + EXPECT_DELAY(hal, 2000); + // check for test timeout uint32_t now = AP_HAL::millis(); if ((now - motor_test_start_ms) >= motor_test_timeout_ms) { @@ -146,6 +148,7 @@ MAV_RESULT Copter::mavlink_motor_test_start(mavlink_channel_t chan, uint8_t moto // start test ap.motor_test = true; + EXPECT_DELAY(hal, 3000); // enable and arm motors if (!motors->armed()) { init_rc_out();