Commit 1394b5d 1 parent 19059a8 commit 1394b5d Copy full SHA for 1394b5d
File tree 4 files changed +12
-12
lines changed
modules/sensors/vehicle_air_data
4 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
- uint64 timestamp # time since system start (microseconds)
2
- uint32 device_id # Sensor ID that must be unique for each baro sensor and must not change
1
+ uint64 timestamp # time since system start (microseconds)
2
+ uint64 timestamp_sample
3
3
4
- uint64 error_count
4
+ uint32 device_id # unique device ID for the sensor that does not change between power cycles
5
+
6
+ uint32 error_count
5
7
6
8
float32 pressure # static pressure measurement in millibar
7
9
Original file line number Diff line number Diff line change @@ -55,8 +55,7 @@ PX4Barometer::~PX4Barometer()
55
55
_sensor_baro_pub.unadvertise ();
56
56
}
57
57
58
- void
59
- PX4Barometer::set_device_type (uint8_t devtype)
58
+ void PX4Barometer::set_device_type (uint8_t devtype)
60
59
{
61
60
// current DeviceStructure
62
61
union device::Device::DeviceId device_id;
@@ -69,13 +68,12 @@ PX4Barometer::set_device_type(uint8_t devtype)
69
68
_sensor_baro_pub.get ().device_id = device_id.devid ;
70
69
}
71
70
72
- void
73
- PX4Barometer::update (hrt_abstime timestamp, float pressure)
71
+ void PX4Barometer::update (const hrt_abstime ×tamp_sample, float pressure)
74
72
{
75
73
sensor_baro_s &report = _sensor_baro_pub.get ();
76
74
77
- report.timestamp = timestamp ;
75
+ report.timestamp_sample = timestamp_sample ;
78
76
report.pressure = pressure;
79
-
77
+ report. timestamp = hrt_absolute_time ();
80
78
_sensor_baro_pub.update ();
81
79
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ class PX4Barometer : public cdev::CDev
55
55
56
56
void set_temperature (float temperature) { _sensor_baro_pub.get ().temperature = temperature; }
57
57
58
- void update (hrt_abstime timestamp , float pressure);
58
+ void update (const hrt_abstime ×tamp_sample , float pressure);
59
59
60
60
int get_class_instance () { return _class_device_instance; };
61
61
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ void VehicleAirData::Run()
200
200
201
201
const sensor_baro_s &baro = _last_data[_selected_sensor_sub_index];
202
202
203
- _baro_timestamp_sum += baro.timestamp ;
203
+ _baro_timestamp_sum += baro.timestamp_sample ;
204
204
_baro_sum += baro.pressure ;
205
205
_baro_sum_count++;
206
206
@@ -217,7 +217,7 @@ void VehicleAirData::Run()
217
217
218
218
// populate vehicle_air_data with primary baro and publish
219
219
vehicle_air_data_s out{};
220
- out.timestamp_sample = timestamp_sample; // TODO: baro.timestamp_sample;
220
+ out.timestamp_sample = timestamp_sample;
221
221
out.baro_device_id = baro.device_id ;
222
222
out.baro_temp_celcius = baro.temperature ;
223
223
You can’t perform that action at this time.
0 commit comments