mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 15:33:35 +08:00
Force a parameter update when the sensors thread starts.
This commit is contained in:
@@ -285,7 +285,7 @@ private:
|
||||
/**
|
||||
* Check for changes in parameters.
|
||||
*/
|
||||
void parameter_update_poll();
|
||||
void parameter_update_poll(bool forced = false);
|
||||
|
||||
/**
|
||||
* Poll the ADC and update readings to suit.
|
||||
@@ -735,12 +735,12 @@ Sensors::vehicle_status_poll()
|
||||
}
|
||||
|
||||
void
|
||||
Sensors::parameter_update_poll()
|
||||
Sensors::parameter_update_poll(bool forced)
|
||||
{
|
||||
bool param_updated;
|
||||
/* Check if any parameter has changed */
|
||||
orb_check(_params_sub, ¶m_updated);
|
||||
if (param_updated)
|
||||
if (param_updated || forced)
|
||||
{
|
||||
/* read from param to clear updated flag */
|
||||
struct parameter_update_s update;
|
||||
@@ -969,6 +969,8 @@ Sensors::task_main()
|
||||
mag_poll(raw);
|
||||
baro_poll(raw);
|
||||
|
||||
parameter_update_poll(true /* forced */);
|
||||
|
||||
/* advertise the sensor_combined topic and make the initial publication */
|
||||
_sensor_pub = orb_advertise(ORB_ID(sensor_combined), &raw);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user