parameter_update use uORB::Subscription consistently

This commit is contained in:
Daniel Agar
2019-07-28 11:55:52 -04:00
parent bbb96cbd0c
commit c8e59c4e39
47 changed files with 274 additions and 259 deletions
+6 -10
View File
@@ -77,17 +77,13 @@ void Simulator::write_gps_data(void *buf)
void Simulator::parameters_update(bool force)
{
bool updated;
struct parameter_update_s param_upd;
// check for parameter updates
if (_parameter_update_sub.updated() || force) {
// clear update
parameter_update_s pupdate;
_parameter_update_sub.copy(&pupdate);
orb_check(_param_sub, &updated);
if (updated) {
orb_copy(ORB_ID(parameter_update), _param_sub, &param_upd);
}
if (updated || force) {
// update C++ param system
// update parameters from storage
updateParams();
}
}
+2 -6
View File
@@ -53,6 +53,7 @@
#include <perf/perf_counter.h>
#include <px4_module_params.h>
#include <px4_posix.h>
#include <uORB/Subscription.hpp>
#include <uORB/topics/actuator_outputs.h>
#include <uORB/topics/battery_status.h>
#include <uORB/topics/differential_pressure.h>
@@ -181,8 +182,6 @@ private:
_gps.writeData(&gps_data);
_param_sub = orb_subscribe(ORB_ID(parameter_update));
_battery_status.timestamp = hrt_absolute_time();
_px4_accel.set_sample_rate(250);
@@ -191,9 +190,6 @@ private:
~Simulator()
{
// Unsubscribe from uORB topics.
orb_unsubscribe(_param_sub);
// free perf counters
perf_free(_perf_gps);
perf_free(_perf_sim_delay);
@@ -230,7 +226,7 @@ private:
orb_advert_t _irlock_report_pub{nullptr};
orb_advert_t _visual_odometry_pub{nullptr};
int _param_sub{-1};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
unsigned int _port{14560};