@ -25,8 +25,7 @@ extern const AP_HAL::HAL& hal;
@@ -25,8 +25,7 @@ extern const AP_HAL::HAL& hal;
using namespace Linux ;
RCInput : : RCInput ( ) :
new_rc_input ( false )
RCInput : : RCInput ( )
{
ppm_state . _channel_counter = - 1 ;
}
@ -37,7 +36,11 @@ void RCInput::init()
@@ -37,7 +36,11 @@ void RCInput::init()
bool RCInput : : new_input ( )
{
return new_rc_input ;
bool ret = rc_input_count ! = last_rc_input_count ;
if ( ret ) {
last_rc_input_count = rc_input_count ;
}
return ret ;
}
uint8_t RCInput : : num_channels ( )
@ -47,7 +50,6 @@ uint8_t RCInput::num_channels()
@@ -47,7 +50,6 @@ uint8_t RCInput::num_channels()
uint16_t RCInput : : read ( uint8_t ch )
{
new_rc_input = false ;
if ( _override [ ch ] ) {
return _override [ ch ] ;
}
@ -84,7 +86,7 @@ bool RCInput::set_override(uint8_t channel, int16_t override)
@@ -84,7 +86,7 @@ bool RCInput::set_override(uint8_t channel, int16_t override)
if ( channel < LINUX_RC_INPUT_NUM_CHANNELS ) {
_override [ channel ] = override ;
if ( override ! = 0 ) {
new_rc_input = true ;
rc_input_count + + ;
return true ;
}
}
@ -112,7 +114,7 @@ void RCInput::_process_ppmsum_pulse(uint16_t width_usec)
@@ -112,7 +114,7 @@ void RCInput::_process_ppmsum_pulse(uint16_t width_usec)
_pwm_values [ i ] = ppm_state . _pulse_capt [ i ] ;
}
_num_channels = ppm_state . _channel_counter ;
new_rc_input = true ;
rc_input_count + + ;
}
ppm_state . _channel_counter = 0 ;
return ;
@ -143,7 +145,7 @@ void RCInput::_process_ppmsum_pulse(uint16_t width_usec)
@@ -143,7 +145,7 @@ void RCInput::_process_ppmsum_pulse(uint16_t width_usec)
_pwm_values [ i ] = ppm_state . _pulse_capt [ i ] ;
}
_num_channels = ppm_state . _channel_counter ;
new_rc_input = true ;
rc_input_count + + ;
ppm_state . _channel_counter = - 1 ;
}
}
@ -221,7 +223,7 @@ void RCInput::_process_sbus_pulse(uint16_t width_s0, uint16_t width_s1)
@@ -221,7 +223,7 @@ void RCInput::_process_sbus_pulse(uint16_t width_s0, uint16_t width_s1)
}
_num_channels = num_values ;
if ( ! sbus_failsafe ) {
new_rc_input = true ;
rc_input_count + + ;
}
}
goto reset ;
@ -291,7 +293,7 @@ void RCInput::_process_dsm_pulse(uint16_t width_s0, uint16_t width_s1)
@@ -291,7 +293,7 @@ void RCInput::_process_dsm_pulse(uint16_t width_s0, uint16_t width_s1)
_pwm_values [ i ] = values [ i ] ;
}
_num_channels = num_values ;
new_rc_input = true ;
rc_input_count + + ;
}
}
memset ( & dsm_state , 0 , sizeof ( dsm_state ) ) ;
@ -349,7 +351,7 @@ void RCInput::_update_periods(uint16_t *periods, uint8_t len)
@@ -349,7 +351,7 @@ void RCInput::_update_periods(uint16_t *periods, uint8_t len)
_pwm_values [ i ] = periods [ i ] ;
}
_num_channels = len ;
new_rc_input = true ;
rc_input_count + + ;
}
@ -408,7 +410,7 @@ bool RCInput::add_dsm_input(const uint8_t *bytes, size_t nbytes)
@@ -408,7 +410,7 @@ bool RCInput::add_dsm_input(const uint8_t *bytes, size_t nbytes)
if ( num_values > _num_channels ) {
_num_channels = num_values ;
}
new_rc_input = true ;
rc_input_count + + ;
#if 0
printf ( " Decoded DSM %u channels %u %u %u %u %u %u %u %u \n " ,
( unsigned ) num_values ,
@ -444,7 +446,7 @@ bool RCInput::add_sumd_input(const uint8_t *bytes, size_t nbytes)
@@ -444,7 +446,7 @@ bool RCInput::add_sumd_input(const uint8_t *bytes, size_t nbytes)
}
}
_num_channels = channel_count ;
new_rc_input = true ;
rc_input_count + + ;
ret = true ;
}
nbytes - - ;
@ -474,7 +476,7 @@ bool RCInput::add_st24_input(const uint8_t *bytes, size_t nbytes)
@@ -474,7 +476,7 @@ bool RCInput::add_st24_input(const uint8_t *bytes, size_t nbytes)
}
}
_num_channels = channel_count ;
new_rc_input = true ;
rc_input_count + + ;
ret = true ;
}
nbytes - - ;
@ -503,7 +505,7 @@ bool RCInput::add_srxl_input(const uint8_t *bytes, size_t nbytes)
@@ -503,7 +505,7 @@ bool RCInput::add_srxl_input(const uint8_t *bytes, size_t nbytes)
}
_num_channels = channel_count ;
if ( failsafe_state = = false ) {
new_rc_input = true ;
rc_input_count + + ;
}
ret = true ;
}
@ -564,7 +566,7 @@ void RCInput::add_sbus_input(const uint8_t *bytes, size_t nbytes)
@@ -564,7 +566,7 @@ void RCInput::add_sbus_input(const uint8_t *bytes, size_t nbytes)
_num_channels = num_values ;
}
if ( ! sbus_failsafe ) {
new_rc_input = true ;
rc_input_count + + ;
}
#if 0
printf ( " Decoded SBUS %u channels %u %u %u %u %u %u %u %u %s \n " ,