AP_HAL_AVR: accept a much shorted sync pulse width on RCInput

this should fix issues with OpenLRSng default settings
This commit is contained in:
Andrew Tridgell 2015-02-08 17:09:17 +11:00
parent f2a919c55e
commit 7fb114752c
3 changed files with 10 additions and 2 deletions

View File

@ -8,6 +8,14 @@
#define AVR_RC_INPUT_NUM_CHANNELS 11
#define AVR_RC_INPUT_MIN_CHANNELS 5 // for ppm sum we allow less than 8 channels to make up a valid packet
/*
mininum pulse width in microseconds to signal end of a PPM-SUM
frame. This value is chosen to be smaller than the default 3000 sync
pulse width for OpenLRSng. Note that this is the total pulse with
(typically 300us low followed by a long high pulse)
*/
#define AVR_RC_INPUT_MIN_SYNC_PULSE_WIDTH 2700
class AP_HAL_AVR::APM1RCInput : public AP_HAL::RCInput {
public:
/**

View File

@ -32,7 +32,7 @@ void APM1RCInput::_timer4_capt_cb(void) {
pulse_width = icr4_current - icr4_prev;
}
if (pulse_width > 8000) {
if (pulse_width > AVR_RC_INPUT_MIN_SYNC_PULSE_WIDTH*2) {
// sync pulse detected. Pass through values if at least a minimum number of channels received
if( channel_ctr >= AVR_RC_INPUT_MIN_CHANNELS ) {
_num_channels = channel_ctr;

View File

@ -32,7 +32,7 @@ void APM2RCInput::_timer5_capt_cb(void) {
pulse_width = icr5_current - icr5_prev;
}
if (pulse_width > 8000) {
if (pulse_width > AVR_RC_INPUT_MIN_SYNC_PULSE_WIDTH*2) {
// sync pulse detected. Pass through values if at least a minimum number of channels received
if( channel_ctr >= AVR_RC_INPUT_MIN_CHANNELS ) {
_num_channels = channel_ctr;