AP_RPM: Add Minimum Quality Parameter

This commit is contained in:
Robert Lefebvre 2015-11-20 19:18:12 -05:00 committed by Andrew Tridgell
parent 1f8b90e876
commit fd106b20c7
2 changed files with 13 additions and 0 deletions

View File

@ -46,6 +46,12 @@ const AP_Param::GroupInfo AP_RPM::var_info[] = {
// @Increment: 1
AP_GROUPINFO("_MIN", 3, AP_RPM, _minimum[0], 0),
// @Param: _MIN_QUAL
// @DisplayName: Minimum Quality
// @Description: Minimum data quality to be used
// @Increment: 0.1
AP_GROUPINFO("_MIN_QUAL", 4, AP_RPM, _quality_min[0], 0.5),
#if RPM_MAX_INSTANCES > 1
// @Param: 2_TYPE
// @DisplayName: Second RPM type
@ -133,6 +139,12 @@ bool AP_RPM::healthy(uint8_t instance) const
if (AP_HAL::millis() - state[instance].last_reading_ms > 1000) {
return false;
}
// check that data quality is above minimum required
if (state[instance].signal_quality < _quality_min[0]) {
return false;
}
return true;
}

View File

@ -53,6 +53,7 @@ public:
AP_Float _scaling[RPM_MAX_INSTANCES];
AP_Float _maximum[RPM_MAX_INSTANCES];
AP_Float _minimum[RPM_MAX_INSTANCES];
AP_Float _quality_min[RPM_MAX_INSTANCES];
static const struct AP_Param::GroupInfo var_info[];