RC_Channel: New method to detect if channel is in trim location
This is a new method which will return true if an RC_Channel has a PWM value that is at its TRIM value plus or minus the allowed dead zone around the TRIM.
This commit is contained in:
parent
2d1745ab6a
commit
7edf8c0e0a
@ -511,3 +511,11 @@ uint16_t RC_Channel::get_limit_pwm(LimitValue limit) const
|
||||
// invalid limit value, return trim
|
||||
return radio_trim;
|
||||
}
|
||||
|
||||
/*
|
||||
Return true if the channel is at trim and within the DZ
|
||||
*/
|
||||
bool RC_Channel::in_trim_dz()
|
||||
{
|
||||
return is_bounded(radio_in, radio_trim - _dead_zone, radio_trim + _dead_zone);
|
||||
}
|
||||
|
@ -135,6 +135,8 @@ public:
|
||||
|
||||
static RC_Channel *rc_channel(uint8_t i);
|
||||
|
||||
bool in_trim_dz();
|
||||
|
||||
private:
|
||||
AP_Int8 _reverse;
|
||||
AP_Int16 _dead_zone;
|
||||
|
Loading…
Reference in New Issue
Block a user