AP_Generator: inhibit maintenance warning based on GEN_OPTIONS bit
This commit is contained in:
parent
bc0befc737
commit
c5f1d1db28
@ -33,6 +33,13 @@ const AP_Param::GroupInfo AP_Generator::var_info[] = {
|
||||
// @RebootRequired: True
|
||||
AP_GROUPINFO_FLAGS("TYPE", 1, AP_Generator, _type, 0, AP_PARAM_FLAG_ENABLE),
|
||||
|
||||
// @Param: OPTIONS
|
||||
// @DisplayName: Generator Options
|
||||
// @Description: Bitmask of options for generators
|
||||
// @Bitmask: 0:Supress Maintenance-Required Warnings
|
||||
// @User: Standard
|
||||
AP_GROUPINFO("OPTIONS", 2, AP_Generator, _options, 0),
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,15 @@ public:
|
||||
// Parameter block
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
|
||||
// bits which can be set in _options to modify generator behaviour:
|
||||
enum class Option {
|
||||
INHIBIT_MAINTENANCE_WARNINGS = 0,
|
||||
};
|
||||
|
||||
bool option_set(Option opt) const {
|
||||
return (_options & 1U<<uint32_t(opt)) != 0;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// Pointer to chosen driver
|
||||
@ -73,6 +82,7 @@ private:
|
||||
|
||||
// Parameters
|
||||
AP_Int8 _type; // Select which generator to use
|
||||
AP_Int32 _options; // Select which generator to use
|
||||
|
||||
enum class Type {
|
||||
GEN_DISABLED = 0,
|
||||
|
@ -201,12 +201,14 @@ void AP_Generator_RichenPower::check_maintenance_required()
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t now = AP_HAL::millis();
|
||||
if (!AP::generator()->option_set(AP_Generator::Option::INHIBIT_MAINTENANCE_WARNINGS)) {
|
||||
const uint32_t now = AP_HAL::millis();
|
||||
|
||||
if (last_reading.errors & (1U<<uint16_t(Errors::MaintenanceRequired))) {
|
||||
if (now - last_maintenance_warning_ms > 60000) {
|
||||
gcs().send_text(MAV_SEVERITY_NOTICE, "Generator: requires maintenance");
|
||||
last_maintenance_warning_ms = now;
|
||||
if (last_reading.errors & (1U<<uint16_t(Errors::MaintenanceRequired))) {
|
||||
if (now - last_maintenance_warning_ms > 60000) {
|
||||
gcs().send_text(MAV_SEVERITY_NOTICE, "Generator: requires maintenance");
|
||||
last_maintenance_warning_ms = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user