2016-01-14 15:30:56 -04:00
|
|
|
#include "Sub.h"
|
2015-12-30 18:57:56 -04:00
|
|
|
|
|
|
|
// set_home_state - update home state
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::set_home_state(enum HomeState new_home_state)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
// if no change, exit immediately
|
2017-02-03 17:33:27 -04:00
|
|
|
if (ap.home_state == new_home_state) {
|
2015-12-30 18:57:56 -04:00
|
|
|
return;
|
2017-02-03 17:33:27 -04:00
|
|
|
}
|
2015-12-30 18:57:56 -04:00
|
|
|
|
|
|
|
// update state
|
|
|
|
ap.home_state = new_home_state;
|
|
|
|
|
|
|
|
// log if home has been set
|
|
|
|
if (new_home_state == HOME_SET_NOT_LOCKED || new_home_state == HOME_SET_AND_LOCKED) {
|
|
|
|
Log_Write_Event(DATA_SET_HOME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// home_is_set - returns true if home positions has been set (to GPS location, armed location or EKF origin)
|
2016-01-14 15:30:56 -04:00
|
|
|
bool Sub::home_is_set()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
return (ap.home_state == HOME_SET_NOT_LOCKED || ap.home_state == HOME_SET_AND_LOCKED);
|
|
|
|
}
|