mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
Copter: make sure motors go through GROUND_IDLE at startup even when in air mode
This commit is contained in:
parent
2cc9f1463e
commit
fce1fa6752
@ -7,7 +7,6 @@
|
|||||||
/*
|
/*
|
||||||
* Init and run calls for acro flight mode
|
* Init and run calls for acro flight mode
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ModeAcro::run()
|
void ModeAcro::run()
|
||||||
{
|
{
|
||||||
// convert the input to the desired body frame rate
|
// convert the input to the desired body frame rate
|
||||||
@ -17,8 +16,13 @@ void ModeAcro::run()
|
|||||||
if (!motors->armed()) {
|
if (!motors->armed()) {
|
||||||
// Motors should be Stopped
|
// Motors should be Stopped
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::SHUT_DOWN);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::SHUT_DOWN);
|
||||||
} else if (copter.ap.throttle_zero && copter.air_mode != AirMode::AIRMODE_ENABLED) {
|
} else if (copter.ap.throttle_zero
|
||||||
// Attempting to Land, if airmode is enabled only an actual landing will spool down the motors
|
|| (copter.air_mode == AirMode::AIRMODE_ENABLED && motors->get_spool_state() == AP_Motors::SpoolState::SHUT_DOWN)) {
|
||||||
|
// throttle_zero is never true in air mode, but the motors should be allowed to go through ground idle
|
||||||
|
// in order to facilitate the spoolup block
|
||||||
|
|
||||||
|
// Attempting to Land or motors not yet spinning
|
||||||
|
// if airmode is enabled only an actual landing will spool down the motors
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::GROUND_IDLE);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::GROUND_IDLE);
|
||||||
} else {
|
} else {
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::THROTTLE_UNLIMITED);
|
||||||
|
@ -21,7 +21,11 @@ void ModeStabilize::run()
|
|||||||
if (!motors->armed()) {
|
if (!motors->armed()) {
|
||||||
// Motors should be Stopped
|
// Motors should be Stopped
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::SHUT_DOWN);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::SHUT_DOWN);
|
||||||
} else if (copter.ap.throttle_zero) {
|
} else if (copter.ap.throttle_zero
|
||||||
|
|| (copter.air_mode == AirMode::AIRMODE_ENABLED && motors->get_spool_state() == AP_Motors::SpoolState::SHUT_DOWN)) {
|
||||||
|
// throttle_zero is never true in air mode, but the motors should be allowed to go through ground idle
|
||||||
|
// in order to facilitate the spoolup block
|
||||||
|
|
||||||
// Attempting to Land
|
// Attempting to Land
|
||||||
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::GROUND_IDLE);
|
motors->set_desired_spool_state(AP_Motors::DesiredSpoolState::GROUND_IDLE);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user