Browse Source

HAL_F4Light: fixed non-inverted SBUS parsing

mission-4.1.18
night-ghost 7 years ago committed by Andrew Tridgell
parent
commit
06da94dcea
  1. 6
      libraries/AP_HAL_F4Light/RC_PPM_parser.cpp

6
libraries/AP_HAL_F4Light/RC_PPM_parser.cpp

@ -38,7 +38,7 @@ void PPM_parser::init(uint8_t ch){
last_pulse = {0,0}; last_pulse = {0,0};
_ioc = Scheduler::register_io_completion(FUNCTOR_BIND_MEMBER(&PPM_parser::parse_pulses, void)); _ioc = Scheduler::register_io_completion(FUNCTOR_BIND_MEMBER(&PPM_parser::parse_pulses, void));
// TODO Panic on IOC not allocated // TODO Panic on IOC not allocated ?
// callback is called on each edge so must be as fast as possible // callback is called on each edge so must be as fast as possible
Revo_handler h = { .mp = FUNCTOR_BIND_MEMBER(&PPM_parser::start_ioc, void) }; Revo_handler h = { .mp = FUNCTOR_BIND_MEMBER(&PPM_parser::start_ioc, void) };
@ -77,9 +77,9 @@ void PPM_parser::rxIntRC(uint16_t last_value, uint16_t value, bool state)
_process_ppmsum_pulse( (last_value + value) >>1 ); // process PPM only if no protocols detected _process_ppmsum_pulse( (last_value + value) >>1 ); // process PPM only if no protocols detected
} }
if((_rc_mode &~BOARD_RC_SBUS_NI) == 0){ if((_rc_mode & ~BOARD_RC_SBUS_NI) == 0){
// test for non-inverted SBUS in 2nd memory structures // test for non-inverted SBUS in 2nd memory structures
_process_sbus_pulse(last_value>>1, value>>1, sbus_state[1]); // was 1 so now is length of 1, last is a length of 0 _process_sbus_pulse(value>>1, last_value>>1, sbus_state[1]); // was 1 so now is length of 1, last is a length of 0
} }
} else { // was 0 so rising } else { // was 0 so rising

Loading…
Cancel
Save