From 911a99b79e4187dae518c6be5e4a067d28419399 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 15 May 2019 14:09:13 +1000 Subject: [PATCH] AP_HAL: removed hal argument to EXPECT_DELAY_MS() --- libraries/AP_HAL/Scheduler.cpp | 8 +++++--- libraries/AP_HAL/Scheduler.h | 11 ++++------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libraries/AP_HAL/Scheduler.cpp b/libraries/AP_HAL/Scheduler.cpp index b8c85dc372..2c65c63065 100644 --- a/libraries/AP_HAL/Scheduler.cpp +++ b/libraries/AP_HAL/Scheduler.cpp @@ -3,6 +3,8 @@ using namespace AP_HAL; +extern const AP_HAL::HAL& hal; + void Scheduler::register_delay_callback(AP_HAL::Proc proc, uint16_t min_time_ms) { @@ -24,12 +26,12 @@ void Scheduler::call_delay_cb() _in_delay_callback = false; } -ExpectDelay::ExpectDelay(const AP_HAL::HAL &hal, uint32_t ms) : _hal(hal) +ExpectDelay::ExpectDelay(uint32_t ms) { - _hal.scheduler->expect_delay_ms(ms); + hal.scheduler->expect_delay_ms(ms); } ExpectDelay::~ExpectDelay() { - _hal.scheduler->expect_delay_ms(0); + hal.scheduler->expect_delay_ms(0); } diff --git a/libraries/AP_HAL/Scheduler.h b/libraries/AP_HAL/Scheduler.h index 4dbddea325..f66ea91921 100644 --- a/libraries/AP_HAL/Scheduler.h +++ b/libraries/AP_HAL/Scheduler.h @@ -127,13 +127,10 @@ private: */ class ExpectDelay { public: - ExpectDelay(const AP_HAL::HAL &hal, uint32_t ms); + ExpectDelay(uint32_t ms); ~ExpectDelay(); - -private: - const AP_HAL::HAL &_hal; }; -#define EXPECT_DELAY(hal, ms) DELAY_JOIN( hal, ms, __COUNTER__ ) -#define DELAY_JOIN( hal, ms, counter) _DO_DELAY_JOIN( hal, ms, counter ) -#define _DO_DELAY_JOIN( hal, ms, counter ) ExpectDelay _getdelay ## counter(hal, ms) +#define EXPECT_DELAY_MS(ms) DELAY_JOIN( ms, __COUNTER__ ) +#define DELAY_JOIN( ms, counter) _DO_DELAY_JOIN( ms, counter ) +#define _DO_DELAY_JOIN( ms, counter ) ExpectDelay _getdelay ## counter(ms)