Skip to content

Commit

Permalink
Add check_params(true) call to the LandDetector start() method. Break…
Browse files Browse the repository at this point in the history
… out _update_total_flight_time() method in the LandDetector class.
  • Loading branch information
mcsauder authored and bkueng committed Jun 26, 2019
1 parent f783982 commit d7cfebe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modules/land_detector/LandDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ LandDetector::~LandDetector()

void LandDetector::start()
{
_check_params(true);
ScheduleOnInterval(LAND_DETECTOR_UPDATE_INTERVAL);
}

Expand Down Expand Up @@ -154,8 +155,7 @@ void LandDetector::_check_params(const bool force)

if (_param_update_sub.update(&param_update) || force) {
_update_params();
_total_flight_time = static_cast<uint64_t>(_param_total_flight_time_high.get()) << 32;
_total_flight_time |= _param_total_flight_time_low.get();
_update_total_flight_time();
}
}

Expand Down Expand Up @@ -187,4 +187,10 @@ void LandDetector::_update_state()
}
}

void LandDetector::_update_total_flight_time()
{
_total_flight_time = static_cast<uint64_t>(_param_total_flight_time_high.get()) << 32;
_total_flight_time |= _param_total_flight_time_low.get();
}

} // namespace land_detector
2 changes: 2 additions & 0 deletions src/modules/land_detector/LandDetector.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class LandDetector : public ModuleBase<LandDetector>, ModuleParams, px4::Schedul

void _update_state();

void _update_total_flight_time();

bool _previous_armed_state{false}; ///< stores the previous actuator_armed.armed state

uint64_t _total_flight_time{0}; ///< in microseconds
Expand Down

0 comments on commit d7cfebe

Please sign in to comment.