mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 11:59:17 +08:00
Merge pull request #325 from sjwilks/airspeed
Don't zero out the reported airspeed when below 15km/h
This commit is contained in:
@@ -84,8 +84,9 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The Eagle Tree Airspeed V3 cannot provide accurate reading below speeds of 15km/h.
|
* The Eagle Tree Airspeed V3 cannot provide accurate reading below speeds of 15km/h.
|
||||||
|
* You can set this value to 12 if you want a zero reading below 15km/h.
|
||||||
*/
|
*/
|
||||||
#define MIN_ACCURATE_DIFF_PRES_PA 12
|
#define MIN_ACCURATE_DIFF_PRES_PA 0
|
||||||
|
|
||||||
/* Measurement rate is 100Hz */
|
/* Measurement rate is 100Hz */
|
||||||
#define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */
|
#define CONVERSION_INTERVAL (1000000 / 100) /* microseconds */
|
||||||
@@ -463,8 +464,8 @@ ETSAirspeed::collect()
|
|||||||
|
|
||||||
uint16_t diff_pres_pa = val[1] << 8 | val[0];
|
uint16_t diff_pres_pa = val[1] << 8 | val[0];
|
||||||
|
|
||||||
|
// XXX move the parameter read out of the driver.
|
||||||
param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset);
|
param_get(param_find("SENS_DPRES_OFF"), &_diff_pres_offset);
|
||||||
|
|
||||||
if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) {
|
if (diff_pres_pa < _diff_pres_offset + MIN_ACCURATE_DIFF_PRES_PA) {
|
||||||
diff_pres_pa = 0;
|
diff_pres_pa = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ build_eam_response(uint8_t *buffer, size_t *size)
|
|||||||
memset(&airspeed, 0, sizeof(airspeed));
|
memset(&airspeed, 0, sizeof(airspeed));
|
||||||
orb_copy(ORB_ID(airspeed), airspeed_sub, &airspeed);
|
orb_copy(ORB_ID(airspeed), airspeed_sub, &airspeed);
|
||||||
|
|
||||||
uint16_t speed = (uint16_t)(airspeed.indicated_airspeed_m_s);
|
uint16_t speed = (uint16_t)(airspeed.indicated_airspeed_m_s * 3.6f);
|
||||||
msg.speed_L = (uint8_t)speed & 0xff;
|
msg.speed_L = (uint8_t)speed & 0xff;
|
||||||
msg.speed_H = (uint8_t)(speed >> 8) & 0xff;
|
msg.speed_H = (uint8_t)(speed >> 8) & 0xff;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user