Filter: comment on reserved config. cope with notch allocation failure.
This commit is contained in:
parent
a9a7fe3ea5
commit
bc5916ebc9
@ -14,6 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "HarmonicNotchFilter.h"
|
#include "HarmonicNotchFilter.h"
|
||||||
|
#include <GCS_MAVLink/GCS.h>
|
||||||
|
|
||||||
#define HNF_MAX_FILTERS 3
|
#define HNF_MAX_FILTERS 3
|
||||||
#define HNF_MAX_HARMONICS 8
|
#define HNF_MAX_HARMONICS 8
|
||||||
@ -121,6 +122,11 @@ void HarmonicNotchFilter<T>::allocate_filters(uint8_t harmonics)
|
|||||||
}
|
}
|
||||||
if (_num_filters > 0) {
|
if (_num_filters > 0) {
|
||||||
_filters = new NotchFilter<T>[_num_filters];
|
_filters = new NotchFilter<T>[_num_filters];
|
||||||
|
if (_filters == nullptr) {
|
||||||
|
gcs().send_text(MAV_SEVERITY_WARNING, "Failed to allocate %lu bytes for HarmonicNotchFilter", _num_filters * sizeof(NotchFilter<T>));
|
||||||
|
_num_filters = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_harmonics = harmonics;
|
_harmonics = harmonics;
|
||||||
}
|
}
|
||||||
|
@ -90,6 +90,8 @@ const AP_Param::GroupInfo NotchFilterParams::var_info[] = {
|
|||||||
// @User: Advanced
|
// @User: Advanced
|
||||||
AP_GROUPINFO_FLAGS("ENABLE", 1, NotchFilterParams, _enable, 0, AP_PARAM_FLAG_ENABLE),
|
AP_GROUPINFO_FLAGS("ENABLE", 1, NotchFilterParams, _enable, 0, AP_PARAM_FLAG_ENABLE),
|
||||||
|
|
||||||
|
// Slots 2 and 3 are reserved - they were integer versions of FREQ and BW which have since been converted to float
|
||||||
|
|
||||||
// @Param: ATT
|
// @Param: ATT
|
||||||
// @DisplayName: Attenuation
|
// @DisplayName: Attenuation
|
||||||
// @Description: Notch attenuation in dB
|
// @Description: Notch attenuation in dB
|
||||||
|
Loading…
Reference in New Issue
Block a user