diff --git a/libraries/AP_AHRS/AP_AHRS.cpp b/libraries/AP_AHRS/AP_AHRS.cpp index 8f16ba4613..cab5d17b7d 100644 --- a/libraries/AP_AHRS/AP_AHRS.cpp +++ b/libraries/AP_AHRS/AP_AHRS.cpp @@ -39,6 +39,12 @@ #include #include #include + +#include +#if AP_MISSION_ENABLED +#include +#endif + #if CONFIG_HAL_BOARD == HAL_BOARD_SITL #include #endif @@ -2985,6 +2991,14 @@ bool AP_AHRS::set_home(const Location &loc) pd.home_lon = loc.lng; pd.home_alt_cm = loc.alt; +#if AP_MISSION_ENABLED + // Save home to mission + AP_Mission *mission = AP::mission(); + if (mission != nullptr) { + mission->write_home_to_storage(); + } +#endif + return true; }