int16_t RC_Channel::get_control_in_zero_dz(void) { if (type_in == RC_CHANNEL_TYPE_RANGE) { return pwm_to_range_dz(0); } return pwm_to_angle_dz(0); }
// recompute control values with no deadzone // When done this way the control_in value can be used as servo_out // to give the same output as input void RC_Channel::recompute_pwm_no_deadzone() { if (type_in == RC_CHANNEL_TYPE_RANGE) { control_in = pwm_to_range_dz(0); } else { //RC_CHANNEL_ANGLE control_in = pwm_to_angle_dz(0); } }
int16_t RC_Channel::getScaled() { if (_type == RC_CHANNEL_TYPE_ANGLE) { return get_pwm_to_angle(); } else { return pwm_to_range_dz(); } }
// read input from APM_RC - create a control_in value, but use a // zero value for the dead zone. When done this way the control_in // value can be used as servo_out to give the same output as input void RC_Channel::set_pwm_no_deadzone(int16_t pwm) { radio_in = pwm; if (_type == RC_CHANNEL_TYPE_RANGE) { control_in = pwm_to_range_dz(0); } else { //RC_CHANNEL_ANGLE, RC_CHANNEL_ANGLE_RAW control_in = pwm_to_angle_dz(0); } }
/* convert a pulse width modulation value to a value in the configured range */ int16_t RC_Channel::pwm_to_range() { return pwm_to_range_dz(_dead_zone); }
/* convert a pulse width modulation value to a value in the configured range */ int16_t RC_Channel::pwm_to_range() const { return pwm_to_range_dz(dead_zone); }