From 7275d2b804e73d79a46a683fed0691d9db9b863e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 9 Feb 2015 09:56:47 +1100 Subject: [PATCH] HAL_SITL: implement updated new_input() semantics --- libraries/AP_HAL_AVR_SITL/RCInput.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/AP_HAL_AVR_SITL/RCInput.cpp b/libraries/AP_HAL_AVR_SITL/RCInput.cpp index f5cd90ccb6..c9d05e240e 100644 --- a/libraries/AP_HAL_AVR_SITL/RCInput.cpp +++ b/libraries/AP_HAL_AVR_SITL/RCInput.cpp @@ -12,12 +12,16 @@ void SITLRCInput::init(void* machtnichts) clear_overrides(); } -bool SITLRCInput::new_input() { - return _sitlState->new_rc_input; +bool SITLRCInput::new_input() +{ + if (_sitlState->new_rc_input) { + _sitlState->new_rc_input = false; + return true; + } + return false; } uint16_t SITLRCInput::read(uint8_t ch) { - _sitlState->new_rc_input = false; if (ch >= 8) { return 0; } @@ -28,7 +32,6 @@ uint8_t SITLRCInput::read(uint16_t* periods, uint8_t len) { for (uint8_t i=0; ipwm_input[i]; } - _sitlState->new_rc_input = false; return 8; }