Browse Source

AP_Generator: inhibit maintenance warning based on GEN_OPTIONS bit

apm_2208
Peter Barker 3 years ago committed by Andrew Tridgell
parent
commit
c5f1d1db28
  1. 7
      libraries/AP_Generator/AP_Generator.cpp
  2. 10
      libraries/AP_Generator/AP_Generator.h
  3. 2
      libraries/AP_Generator/AP_Generator_RichenPower.cpp

7
libraries/AP_Generator/AP_Generator.cpp

@ -33,6 +33,13 @@ const AP_Param::GroupInfo AP_Generator::var_info[] = { @@ -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
};

10
libraries/AP_Generator/AP_Generator.h

@ -66,6 +66,15 @@ public: @@ -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: @@ -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,

2
libraries/AP_Generator/AP_Generator_RichenPower.cpp

@ -201,6 +201,7 @@ void AP_Generator_RichenPower::check_maintenance_required() @@ -201,6 +201,7 @@ void AP_Generator_RichenPower::check_maintenance_required()
return;
}
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))) {
@ -210,6 +211,7 @@ void AP_Generator_RichenPower::check_maintenance_required() @@ -210,6 +211,7 @@ void AP_Generator_RichenPower::check_maintenance_required()
}
}
}
}
/*
update the state of the sensor

Loading…
Cancel
Save