refactor commander: remove unused argument is_armed in Report class

This commit is contained in:
Beat Küng
2024-11-20 14:37:35 +01:00
committed by Matthias Grob
parent be300b767d
commit 8ccd43dc1b
4 changed files with 15 additions and 15 deletions
@@ -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;
@@ -337,12 +337,12 @@ private:
*/
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;
@@ -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();
}
@@ -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<uint8_t>(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) {