diff --git a/libraries/APM_RC/APM_RC.cpp b/libraries/APM_RC/APM_RC.cpp index 5ff4e093b6..c62b68db77 100644 --- a/libraries/APM_RC/APM_RC.cpp +++ b/libraries/APM_RC/APM_RC.cpp @@ -150,6 +150,10 @@ uint16_t APM_RC_Class::InputCh(unsigned char ch) uint16_t result; uint16_t result2; + if (_HIL_override[ch] != 0) { + return _HIL_override[ch]; + } + // Because servo pulse variables are 16 bits and the interrupts are running values could be corrupted. // We dont want to stop interrupts to read radio channels so we have to do two readings to be sure that the value is correct... result = PWM_RAW[ch]>>1; // Because timer runs at 0.5us we need to do value/2 @@ -188,6 +192,19 @@ void APM_RC_Class::Force_Out6_Out7(void) TCNT3=39990; } +// allow HIL override of RC values +// A value of -1 means no change +// A value of 0 means no override, use the real RC values +void APM_RC_Class::setHIL(int16_t v[NUM_CHANNELS]) +{ + for (unsigned char i=0; i