ina226/voxlpm: make sure parameter sub is reset

The subscription to parameter updates has to get
copied otherwise the change detection will not get
reset for next time.
This commit is contained in:
Matthias Grob 2020-08-25 19:41:07 +02:00 committed by Daniel Agar
parent 165c8b23bf
commit f92c5aa688
4 changed files with 10 additions and 6 deletions

View File

@ -210,9 +210,11 @@ INA226::collect()
{
perf_begin(_sample_perf);
parameter_update_s param_update;
if (_parameter_update_sub.updated()) {
// Read from topic to clear updated flag
parameter_update_s parameter_update;
_parameter_update_sub.copy(&parameter_update);
if (_parameters_sub.copy(&param_update)) {
updateParams();
}

View File

@ -169,7 +169,7 @@ private:
Battery _battery;
uORB::Subscription _actuators_sub{ORB_ID(actuator_controls_0)};
uORB::Subscription _parameters_sub{ORB_ID(parameter_update)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
int read(uint8_t address, int16_t &data);
int write(uint8_t address, uint16_t data);

View File

@ -316,9 +316,11 @@ VOXLPM::measure()
}
}
parameter_update_s update;
if (_parameter_update_sub.updated()) {
// Read from topic to clear updated flag
parameter_update_s parameter_update;
_parameter_update_sub.copy(&parameter_update);
if (_parameter_sub.update(&update)) {
updateParams();
}

View File

@ -253,7 +253,7 @@ private:
perf_counter_t _comms_errors;
uORB::PublicationMulti<power_monitor_s> _pm_pub_topic{ORB_ID(power_monitor)};
uORB::Subscription _parameter_sub{ORB_ID(parameter_update)};
uORB::Subscription _parameter_update_sub{ORB_ID(parameter_update)};
power_monitor_s _pm_status{};