Skip to content

Commit

Permalink
AP_Vehicle: make bad-mode-number notification consistent across vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker authored and rmackay9 committed Sep 1, 2021
1 parent 96be74b commit 7a06c94
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/AP_Vehicle/AP_Vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@ void AP_Vehicle::update_dynamic_notch_at_specified_rate()
}
}

void AP_Vehicle::notify_no_such_mode(uint8_t mode_number)
{
GCS_SEND_TEXT(MAV_SEVERITY_WARNING,"No such mode %u", mode_number);
AP::logger().Write_Error(LogErrorSubsystem::FLIGHT_MODE, LogErrorCode(mode_number));
}

// reboot the vehicle in an orderly manner, doing various cleanups and
// flashing LEDs as appropriate
void AP_Vehicle::reboot(bool hold_in_bootloader)
Expand Down
6 changes: 6 additions & 0 deletions libraries/AP_Vehicle/AP_Vehicle.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ class AP_Vehicle : public AP_HAL::HAL::Callbacks {
return control_mode_reason;
}

// perform any notifications required to indicate a mode change
// failed due to a bad mode number being supplied. This can
// happen for many reasons - bad mavlink packet and bad mode
// parameters for example.
void notify_no_such_mode(uint8_t mode_number);

/*
common parameters for fixed wing aircraft
*/
Expand Down

0 comments on commit 7a06c94

Please sign in to comment.