Skip to content

Commit 53d45c6

Browse files
committed
ArduCopter: support option to retract mount when landing
1 parent fa2848a commit 53d45c6

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ArduCopter/Copter.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,11 @@ class Copter : public AP_Vehicle {
597597

598598
bool standby_active;
599599

600+
#if HAL_MOUNT_ENABLED
601+
// true if the last time we checked the flightmode was landing:
602+
bool was_landing;
603+
#endif
604+
600605
static const AP_Scheduler::Task scheduler_tasks[];
601606
static const AP_Param::Info var_info[];
602607
static const struct LogStructure log_structure[];

ArduCopter/mode.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,16 @@ void Copter::update_flight_mode()
422422
surface_tracking.invalidate_for_logging(); // invalidate surface tracking alt, flight mode will set to true if used
423423

424424
flightmode->run();
425+
426+
#if HAL_MOUNT_ENABLED
427+
{
428+
const bool is_landing = flightmode->is_landing();
429+
if (is_landing && !was_landing) {
430+
camera_mount.vehicle_has_started_to_land();
431+
}
432+
was_landing = is_landing;
433+
}
434+
#endif
425435
}
426436

427437
// exit_mode - high level call to organise cleanup as a flight mode is exited

0 commit comments

Comments
 (0)