HAL_SITL: implement updated new_input() semantics

This commit is contained in:
Andrew Tridgell 2015-02-09 09:56:47 +11:00
parent 5d6f883887
commit 7275d2b804
1 changed files with 7 additions and 4 deletions

View File

@ -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; i<len; i++) {
periods[i] = _override[i]? _override[i] : _sitlState->pwm_input[i];
}
_sitlState->new_rc_input = false;
return 8;
}