mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 19:23:34 +08:00
PX4Magnetometer: add external() getter and default temperature to NAN
This commit is contained in:
@@ -45,6 +45,7 @@ PX4Magnetometer::PX4Magnetometer(uint32_t device_id, uint8_t priority, enum Rota
|
||||
|
||||
_sensor_mag_pub.get().device_id = device_id;
|
||||
_sensor_mag_pub.get().scaling = 1.0f;
|
||||
_sensor_mag_pub.get().temperature = NAN;
|
||||
}
|
||||
|
||||
PX4Magnetometer::~PX4Magnetometer()
|
||||
@@ -82,6 +83,9 @@ int PX4Magnetometer::ioctl(cdev::file_t *filp, int cmd, unsigned long arg)
|
||||
|
||||
return 0;
|
||||
|
||||
case MAGIOCGEXTERNAL:
|
||||
return _sensor_mag_pub.get().is_external;
|
||||
|
||||
case DEVIOCGDEVICEID:
|
||||
return _sensor_mag_pub.get().device_id;
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ public:
|
||||
|
||||
int ioctl(cdev::file_t *filp, int cmd, unsigned long arg) override;
|
||||
|
||||
bool external() { return _sensor_mag_pub.get().is_external; }
|
||||
|
||||
void set_device_type(uint8_t devtype);
|
||||
void set_error_count(uint64_t error_count) { _sensor_mag_pub.get().error_count = error_count; }
|
||||
void increase_error_count() { _sensor_mag_pub.get().error_count++; }
|
||||
|
||||
Reference in New Issue
Block a user