mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-18 06:38:29 -04:00
Plane: use fence enable_configured()
avoid fence breach clearing spam
This commit is contained in:
parent
0288e1e79c
commit
559bd1e252
@ -147,10 +147,10 @@ bool Plane::start_command(const AP_Mission::Mission_Command& cmd)
|
|||||||
case MAV_CMD_DO_FENCE_ENABLE:
|
case MAV_CMD_DO_FENCE_ENABLE:
|
||||||
#if AP_FENCE_ENABLED
|
#if AP_FENCE_ENABLED
|
||||||
if (cmd.p1 == 0) { // disable fence
|
if (cmd.p1 == 0) { // disable fence
|
||||||
plane.fence.enable(false);
|
plane.fence.enable_configured(false);
|
||||||
gcs().send_text(MAV_SEVERITY_INFO, "Fence disabled");
|
gcs().send_text(MAV_SEVERITY_INFO, "Fence disabled");
|
||||||
} else if (cmd.p1 == 1) { // enable fence
|
} else if (cmd.p1 == 1) { // enable fence
|
||||||
plane.fence.enable(true);
|
plane.fence.enable_configured(true);
|
||||||
gcs().send_text(MAV_SEVERITY_INFO, "Fence enabled");
|
gcs().send_text(MAV_SEVERITY_INFO, "Fence enabled");
|
||||||
} else if (cmd.p1 == 2) { // disable fence floor only
|
} else if (cmd.p1 == 2) { // disable fence floor only
|
||||||
plane.fence.disable_floor();
|
plane.fence.disable_floor();
|
||||||
|
@ -115,7 +115,8 @@ void Plane::fence_check()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOGGER_WRITE_ERROR(LogErrorSubsystem::FAILSAFE_FENCE, LogErrorCode(new_breaches));
|
LOGGER_WRITE_ERROR(LogErrorSubsystem::FAILSAFE_FENCE, LogErrorCode(new_breaches));
|
||||||
} else if (orig_breaches) {
|
} else if (orig_breaches && fence.get_breaches() == 0) {
|
||||||
|
GCS_SEND_TEXT(MAV_SEVERITY_NOTICE, "Fence breach cleared");
|
||||||
// record clearing of breach
|
// record clearing of breach
|
||||||
LOGGER_WRITE_ERROR(LogErrorSubsystem::FAILSAFE_FENCE, LogErrorCode::ERROR_RESOLVED);
|
LOGGER_WRITE_ERROR(LogErrorSubsystem::FAILSAFE_FENCE, LogErrorCode::ERROR_RESOLVED);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user