Skip to content

Commit a0d3f51

Browse files
committedJun 26, 2019
Add check_params(true) call to the LandDetector start() method. Break out _update_total_flight_time() method in the LandDetector class.
1 parent bf67344 commit a0d3f51

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
 

‎src/modules/land_detector/LandDetector.cpp

+8-2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ LandDetector::~LandDetector()
7171

7272
void LandDetector::start()
7373
{
74+
_check_params(true);
7475
ScheduleOnInterval(LAND_DETECTOR_UPDATE_INTERVAL);
7576
}
7677

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

155156
if (_param_update_sub.update(&param_update) || force) {
156157
_update_params();
157-
_total_flight_time = static_cast<uint64_t>(_param_total_flight_time_high.get()) << 32;
158-
_total_flight_time |= _param_total_flight_time_low.get();
158+
_update_total_flight_time();
159159
}
160160
}
161161

@@ -187,4 +187,10 @@ void LandDetector::_update_state()
187187
}
188188
}
189189

190+
void LandDetector::_update_total_flight_time()
191+
{
192+
_total_flight_time = static_cast<uint64_t>(_param_total_flight_time_high.get()) << 32;
193+
_total_flight_time |= _param_total_flight_time_low.get();
194+
}
195+
190196
} // namespace land_detector

‎src/modules/land_detector/LandDetector.h

+2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,8 @@ class LandDetector : public ModuleBase<LandDetector>, ModuleParams, px4::Schedul
163163

164164
void _update_state();
165165

166+
void _update_total_flight_time();
167+
166168
bool _previous_armed_state{false}; ///< stores the previous actuator_armed.armed state
167169

168170
uint64_t _total_flight_time{0}; ///< in microseconds

0 commit comments

Comments
 (0)