navigator: rename update and reset calls to on_active and on_inactive

This commit is contained in:
Julian Oes 2014-06-12 19:37:25 +02:00
parent 59ae8cc054
commit 3b39a8a789
7 changed files with 21 additions and 21 deletions

View File

@ -72,7 +72,7 @@ Mission::Mission(Navigator *navigator, const char *name) :
/* load initial params */ /* load initial params */
updateParams(); updateParams();
/* set initial mission items */ /* set initial mission items */
reset(); on_inactive();
} }
@ -81,7 +81,7 @@ Mission::~Mission()
} }
void void
Mission::reset() Mission::on_inactive()
{ {
_first_run = true; _first_run = true;
@ -100,7 +100,7 @@ Mission::reset()
} }
bool bool
Mission::update(struct position_setpoint_triplet_s *pos_sp_triplet) Mission::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
{ {
bool updated = false; bool updated = false;

View File

@ -78,12 +78,12 @@ public:
/** /**
* This function is called while the mode is inactive * This function is called while the mode is inactive
*/ */
virtual void reset(); virtual void on_inactive();
/** /**
* This function is called while the mode is active * This function is called while the mode is active
*/ */
virtual bool update(struct position_setpoint_triplet_s *pos_sp_triplet); virtual bool on_active(struct position_setpoint_triplet_s *pos_sp_triplet);
private: private:
/** /**

View File

@ -365,21 +365,21 @@ Navigator::task_main()
/* TODO: make list of modes and loop through it */ /* TODO: make list of modes and loop through it */
if (_navigation_mode == &_mission) { if (_navigation_mode == &_mission) {
_update_triplet = _mission.update(&_pos_sp_triplet); _update_triplet = _mission.on_active(&_pos_sp_triplet);
} else { } else {
_mission.reset(); _mission.on_inactive();
} }
if (_navigation_mode == &_rtl) { if (_navigation_mode == &_rtl) {
_update_triplet = _rtl.update(&_pos_sp_triplet); _update_triplet = _rtl.on_active(&_pos_sp_triplet);
} else { } else {
_rtl.reset(); _rtl.on_inactive();
} }
if (_navigation_mode == &_loiter) { if (_navigation_mode == &_loiter) {
_update_triplet = _loiter.update(&_pos_sp_triplet); _update_triplet = _loiter.on_active(&_pos_sp_triplet);
} else { } else {
_loiter.reset(); _loiter.on_inactive();
} }
/* if nothing is running, set position setpoint triplet invalid */ /* if nothing is running, set position setpoint triplet invalid */

View File

@ -48,7 +48,7 @@ NavigatorMode::NavigatorMode(Navigator *navigator, const char *name) :
/* load initial params */ /* load initial params */
updateParams(); updateParams();
/* set initial mission items */ /* set initial mission items */
reset(); on_inactive();
} }
NavigatorMode::~NavigatorMode() NavigatorMode::~NavigatorMode()
@ -56,13 +56,13 @@ NavigatorMode::~NavigatorMode()
} }
void void
NavigatorMode::reset() NavigatorMode::on_inactive()
{ {
_first_run = true; _first_run = true;
} }
bool bool
NavigatorMode::update(struct position_setpoint_triplet_s *pos_sp_triplet) NavigatorMode::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
{ {
pos_sp_triplet->current.valid = false; pos_sp_triplet->current.valid = false;
_first_run = false; _first_run = false;

View File

@ -68,7 +68,7 @@ public:
/** /**
* This function is called while the mode is inactive * This function is called while the mode is inactive
*/ */
virtual void reset(); virtual void on_inactive();
/** /**
* This function is called while the mode is active * This function is called while the mode is active
@ -76,7 +76,7 @@ public:
* @param position setpoint triplet to set * @param position setpoint triplet to set
* @return true if position setpoint triplet has been changed * @return true if position setpoint triplet has been changed
*/ */
virtual bool update(struct position_setpoint_triplet_s *pos_sp_triplet); virtual bool on_active(struct position_setpoint_triplet_s *pos_sp_triplet);
protected: protected:
Navigator *_navigator; Navigator *_navigator;

View File

@ -64,7 +64,7 @@ RTL::RTL(Navigator *navigator, const char *name) :
/* load initial params */ /* load initial params */
updateParams(); updateParams();
/* initial reset */ /* initial reset */
reset(); on_inactive();
} }
RTL::~RTL() RTL::~RTL()
@ -72,14 +72,14 @@ RTL::~RTL()
} }
void void
RTL::reset() RTL::on_inactive()
{ {
_first_run = true; _first_run = true;
_rtl_state = RTL_STATE_NONE; _rtl_state = RTL_STATE_NONE;
} }
bool bool
RTL::update(struct position_setpoint_triplet_s *pos_sp_triplet) RTL::on_active(struct position_setpoint_triplet_s *pos_sp_triplet)
{ {
bool updated = false; bool updated = false;

View File

@ -70,7 +70,7 @@ public:
/** /**
* This function is called while the mode is inactive * This function is called while the mode is inactive
*/ */
void reset(); void on_inactive();
/** /**
* This function is called while the mode is active * This function is called while the mode is active
@ -78,7 +78,7 @@ public:
* @param position setpoint triplet that needs to be set * @param position setpoint triplet that needs to be set
* @return true if updated * @return true if updated
*/ */
bool update(position_setpoint_triplet_s *pos_sp_triplet); bool on_active(position_setpoint_triplet_s *pos_sp_triplet);
private: private: