diff --git a/src/modules/commander/HealthAndArmingChecks/Common.cpp b/src/modules/commander/HealthAndArmingChecks/Common.cpp index f8d3982c5be9..fb5639087ea1 100644 --- a/src/modules/commander/HealthAndArmingChecks/Common.cpp +++ b/src/modules/commander/HealthAndArmingChecks/Common.cpp @@ -219,7 +219,7 @@ bool Report::finalize() return _results_changed; } -bool Report::report(bool is_armed, bool force) +bool Report::report(bool force) { const hrt_abstime now = hrt_absolute_time(); const bool has_difference = _had_unreported_difference || _results_changed; @@ -318,10 +318,10 @@ bool Report::report(bool is_armed, bool force) return true; } -bool Report::reportIfUnreportedDifferences(bool is_armed) +bool Report::reportIfUnreportedDifferences() { if (_had_unreported_difference) { - return report(is_armed, true); + return report(true); } return false; diff --git a/src/modules/commander/HealthAndArmingChecks/Common.hpp b/src/modules/commander/HealthAndArmingChecks/Common.hpp index 3e6a06248d7e..826aa7629c0e 100644 --- a/src/modules/commander/HealthAndArmingChecks/Common.hpp +++ b/src/modules/commander/HealthAndArmingChecks/Common.hpp @@ -337,12 +337,12 @@ class Report */ bool finalize(); - bool report(bool is_armed, bool force); + bool report(bool force); /** * Send out any unreported changes if there are any */ - bool reportIfUnreportedDifferences(bool is_armed); + bool reportIfUnreportedDifferences(); const hrt_abstime _min_reporting_interval; diff --git a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp index 2ab153ad8a05..f4f91d045057 100644 --- a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp +++ b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecks.cpp @@ -67,7 +67,7 @@ bool HealthAndArmingChecks::update(bool force_reporting, bool is_arming_request) } const bool results_changed = _reporter.finalize(); - const bool reported = _reporter.report(_context.isArmed(), force_reporting); + const bool reported = _reporter.report(force_reporting); if (reported) { @@ -89,7 +89,7 @@ bool HealthAndArmingChecks::update(bool force_reporting, bool is_arming_request) } _reporter.finalize(); - _reporter.report(_context.isArmed(), false); + _reporter.report(false); _reporter._mavlink_log_pub = nullptr; // LEGACY end @@ -123,5 +123,5 @@ void HealthAndArmingChecks::updateParams() bool HealthAndArmingChecks::reportIfUnreportedDifferences() { - return _reporter.reportIfUnreportedDifferences(_context.isArmed()); + return _reporter.reportIfUnreportedDifferences(); } diff --git a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecksTest.cpp b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecksTest.cpp index c06886320563..4bd7749ce435 100644 --- a/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecksTest.cpp +++ b/src/modules/commander/HealthAndArmingChecks/HealthAndArmingChecksTest.cpp @@ -69,7 +69,7 @@ TEST_F(ReporterTest, basic_no_checks) reporter.reset(); reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_TRUE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION)); ASSERT_EQ((uint8_t)reporter.armingCheckResults().can_arm, 0xff); @@ -92,7 +92,7 @@ TEST_F(ReporterTest, basic_fail_all_modes) reporter.armingCheckFailure(NavModes::All, health_component_t::remote_control, events::ID("arming_test_basic_fail_all_modes_fail1"), events::Log::Info, ""); reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_FALSE(reporter.canArm(nav_state)); ASSERT_TRUE(reporter.canRun(nav_state)); @@ -113,7 +113,7 @@ TEST_F(ReporterTest, arming_checks_mode_category) events::ID("arming_test_arming_checks_mode_category_fail2"), events::Log::Info, ""); reporter.setIsPresent(health_component_t::battery); reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_TRUE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION)); ASSERT_TRUE(reporter.canRun(vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION)); @@ -138,7 +138,7 @@ TEST_F(ReporterTest, arming_checks_mode_category2) reporter.healthFailure(NavModes::Mission, health_component_t::remote_control, events::ID("arming_test_arming_checks_mode_category2_fail1"), events::Log::Warning, ""); reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_FALSE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_AUTO_MISSION)); @@ -178,7 +178,7 @@ TEST_F(ReporterTest, reporting) } reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_FALSE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_POSCTL)); if (i == 0) { @@ -219,7 +219,7 @@ TEST_F(ReporterTest, reporting) } reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_FALSE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_POSCTL)); if (i == 0) { @@ -265,7 +265,7 @@ TEST_F(ReporterTest, reporting_multiple) reporter.armingCheckFailure(NavModes::All, health_component_t::remote_control, events::ID("arming_test_reporting_multiple_fail3"), events::Log::Warning, "", 55); reporter.finalize(); - reporter.report(false, false); + reporter.report(false); ASSERT_FALSE(reporter.canArm(vehicle_status_s::NAVIGATION_STATE_POSCTL)); if (i == 0) {