Skip to content

Commit

Permalink
AP_AHRS: move load_watchdog_home into correct cpp file
Browse files Browse the repository at this point in the history
NFC, just moving the code out of the DCM backend file
  • Loading branch information
peterbarker authored and tridge committed Sep 19, 2023
1 parent 622b83d commit 9bcd9df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
14 changes: 14 additions & 0 deletions libraries/AP_AHRS/AP_AHRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2682,6 +2682,20 @@ bool AP_AHRS::set_home(const Location &loc)
return true;
}

/* if this was a watchdog reset then get home from backup registers */
void AP_AHRS::load_watchdog_home()
{
const AP_HAL::Util::PersistentData &pd = hal.util->persistent_data;
if (hal.util->was_watchdog_reset() && (pd.home_lat != 0 || pd.home_lon != 0)) {
_home.lat = pd.home_lat;
_home.lng = pd.home_lon;
_home.set_alt_cm(pd.home_alt_cm, Location::AltFrame::ABSOLUTE);
_home_is_set = true;
_home_locked = true;
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Restored watchdog home");
}
}

// get_hgt_ctrl_limit - get maximum height to be observed by the control loops in metres and a validity flag
// this is used to limit height during optical flow navigation
// it will return false when no limiting is required
Expand Down
16 changes: 0 additions & 16 deletions libraries/AP_AHRS/AP_AHRS_DCM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,6 @@ AP_AHRS_DCM::reset_gyro_drift(void)
_omega_I_sum_time = 0;
}


/* if this was a watchdog reset then get home from backup registers */
void AP_AHRS::load_watchdog_home()
{
const AP_HAL::Util::PersistentData &pd = hal.util->persistent_data;
if (hal.util->was_watchdog_reset() && (pd.home_lat != 0 || pd.home_lon != 0)) {
_home.lat = pd.home_lat;
_home.lng = pd.home_lon;
_home.set_alt_cm(pd.home_alt_cm, Location::AltFrame::ABSOLUTE);
_home_is_set = true;
_home_locked = true;
GCS_SEND_TEXT(MAV_SEVERITY_INFO, "Restored watchdog home");
}
}


// run a full DCM update round
void
AP_AHRS_DCM::update()
Expand Down

0 comments on commit 9bcd9df

Please sign in to comment.