Skip to content

Commit

Permalink
commander: power check only keep error thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Aug 14, 2024
1 parent 4ed3e9e commit 774853e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/modules/commander/HealthAndArmingChecks/checks/powerCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,9 @@ void PowerChecks::checkAndReport(const Context &context, Report &reporter)
float avionics_power_rail_voltage = system_power.voltage5v_v;

const float low_error_threshold = 4.5f;
const float low_warning_threshold = 4.8f;
const float high_warning_threshold = 5.4f;
const float high_error_threshold = 5.4f;

if (avionics_power_rail_voltage < low_warning_threshold) {
NavModes affected_groups = NavModes::None;

if (avionics_power_rail_voltage < low_error_threshold) {
affected_groups = NavModes::All;
}
if (avionics_power_rail_voltage < low_error_threshold) {

/* EVENT
* @description
Expand All @@ -93,16 +87,16 @@ void PowerChecks::checkAndReport(const Context &context, Report &reporter)
* This check can be configured via <param>CBRK_SUPPLY_CHK</param> parameter.
* </profile>
*/
reporter.healthFailure<float, float>(affected_groups, health_component_t::system,
reporter.healthFailure<float, float>(NavModes::All, health_component_t::system,
events::ID("check_avionics_power_low"),
events::Log::Error, "Avionics Power low: {1:.2} Volt", avionics_power_rail_voltage, low_warning_threshold);
events::Log::Error, "Avionics Power low: {1:.2} Volt", avionics_power_rail_voltage, low_error_threshold);

if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Avionics Power low: %6.2f Volt",
(double)avionics_power_rail_voltage);
}

} else if (avionics_power_rail_voltage > high_warning_threshold) {
} else if (avionics_power_rail_voltage > high_error_threshold) {
/* EVENT
* @description
* Check the voltage supply to the FMU, it must be below {2:.2} Volt.
Expand All @@ -113,7 +107,7 @@ void PowerChecks::checkAndReport(const Context &context, Report &reporter)
*/
reporter.healthFailure<float, float>(NavModes::All, health_component_t::system,
events::ID("check_avionics_power_high"),
events::Log::Error, "Avionics Power high: {1:.2} Volt", avionics_power_rail_voltage, high_warning_threshold);
events::Log::Error, "Avionics Power high: {1:.2} Volt", avionics_power_rail_voltage, high_error_threshold);

if (reporter.mavlink_log_pub()) {
mavlink_log_critical(reporter.mavlink_log_pub(), "Preflight Fail: Avionics Power high: %6.2f Volt",
Expand Down

0 comments on commit 774853e

Please sign in to comment.