mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 12:14:10 -04:00
Plane: improve failsafe notifications
This commit is contained in:
parent
01d8c506d2
commit
7feef72b34
@ -901,6 +901,7 @@ private:
|
||||
void failsafe_short_on_event(enum failsafe_state fstype, mode_reason_t reason);
|
||||
void failsafe_long_on_event(enum failsafe_state fstype, mode_reason_t reason);
|
||||
void failsafe_short_off_event(mode_reason_t reason);
|
||||
void failsafe_long_off_event(mode_reason_t reason);
|
||||
void low_battery_event(void);
|
||||
void update_events(void);
|
||||
uint8_t max_fencepoints(void);
|
||||
|
@ -5,7 +5,7 @@ void Plane::failsafe_short_on_event(enum failsafe_state fstype, mode_reason_t re
|
||||
// This is how to handle a short loss of control signal failsafe.
|
||||
failsafe.state = fstype;
|
||||
failsafe.ch3_timer_ms = millis();
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Short event on, ");
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Short event on: type=%u/reason=%u", fstype, reason);
|
||||
switch(control_mode)
|
||||
{
|
||||
case MANUAL:
|
||||
@ -61,7 +61,7 @@ void Plane::failsafe_short_on_event(enum failsafe_state fstype, mode_reason_t re
|
||||
void Plane::failsafe_long_on_event(enum failsafe_state fstype, mode_reason_t reason)
|
||||
{
|
||||
// This is how to handle a long loss of control signal failsafe.
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Long event on, ");
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Long event on: type=%u/reason=%u", fstype, reason);
|
||||
// If the GCS is locked up we allow control to revert to RC
|
||||
hal.rcin->clear_overrides();
|
||||
failsafe.state = fstype;
|
||||
@ -123,7 +123,7 @@ void Plane::failsafe_long_on_event(enum failsafe_state fstype, mode_reason_t rea
|
||||
void Plane::failsafe_short_off_event(mode_reason_t reason)
|
||||
{
|
||||
// We're back in radio contact
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Short event off");
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Short event off: reason=%u", reason);
|
||||
failsafe.state = FAILSAFE_NONE;
|
||||
|
||||
// re-read the switch so we can return to our preferred mode
|
||||
@ -134,6 +134,13 @@ void Plane::failsafe_short_off_event(mode_reason_t reason)
|
||||
}
|
||||
}
|
||||
|
||||
void Plane::failsafe_long_off_event(mode_reason_t reason)
|
||||
{
|
||||
// We're back in radio contact
|
||||
gcs().send_text(MAV_SEVERITY_WARNING, "Failsafe. Long event off: reason=%u", reason);
|
||||
failsafe.state = FAILSAFE_NONE;
|
||||
}
|
||||
|
||||
void Plane::low_battery_event(void)
|
||||
{
|
||||
if (failsafe.low_battery) {
|
||||
|
@ -509,10 +509,10 @@ void Plane::check_long_failsafe()
|
||||
// We do not change state but allow for user to change mode
|
||||
if (failsafe.state == FAILSAFE_GCS &&
|
||||
(tnow - failsafe.last_heartbeat_ms) < timeout_seconds*1000) {
|
||||
failsafe.state = FAILSAFE_NONE;
|
||||
failsafe_long_off_event(MODE_REASON_GCS_FAILSAFE);
|
||||
} else if (failsafe.state == FAILSAFE_LONG &&
|
||||
!failsafe.ch3_failsafe) {
|
||||
failsafe.state = FAILSAFE_NONE;
|
||||
failsafe_long_off_event(MODE_REASON_RADIO_FAILSAFE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user