mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-17 03:23:34 +08:00
sensors: move voting into sensors module
- voting is now at a central place instead of duplicated within the
estimators
-> this also means that estimators that did not do voting so far,
now have voting, like ekf2
- estimators requiring more than that can still subscribe to the raw
sensors
- allows sensors_combined to be 3 times smaller
- reduces logger, memcpy (cache) & RAM overhead
- all modules requiring only 1 or 2 sensor values now automatically get
the voted result
- this also adds voting to baro
This commit is contained in:
@@ -205,7 +205,7 @@ void frsky_send_frame1(int uart)
|
||||
{
|
||||
/* send formatted frame */
|
||||
float acceleration[3];
|
||||
float accel_dt = sensor_combined->accelerometer_integral_dt[0] / 1.e6f;
|
||||
float accel_dt = sensor_combined->accelerometer_integral_dt / 1.e6f;
|
||||
acceleration[0] = sensor_combined->accelerometer_integral_m_s[0] / accel_dt;
|
||||
acceleration[1] = sensor_combined->accelerometer_integral_m_s[1] / accel_dt;
|
||||
acceleration[2] = sensor_combined->accelerometer_integral_m_s[2] / accel_dt;
|
||||
@@ -214,12 +214,12 @@ void frsky_send_frame1(int uart)
|
||||
frsky_send_data(uart, FRSKY_ID_ACCEL_Z, roundf(acceleration[2] * 1000.0f));
|
||||
|
||||
frsky_send_data(uart, FRSKY_ID_BARO_ALT_BP,
|
||||
sensor_combined->baro_alt_meter[0]);
|
||||
sensor_combined->baro_alt_meter);
|
||||
frsky_send_data(uart, FRSKY_ID_BARO_ALT_AP,
|
||||
roundf(frac(sensor_combined->baro_alt_meter[0]) * 100.0f));
|
||||
roundf(frac(sensor_combined->baro_alt_meter) * 100.0f));
|
||||
|
||||
frsky_send_data(uart, FRSKY_ID_TEMP1,
|
||||
roundf(sensor_combined->baro_temp_celcius[0]));
|
||||
roundf(sensor_combined->baro_temp_celcius));
|
||||
|
||||
frsky_send_data(uart, FRSKY_ID_VFAS,
|
||||
roundf(battery_status->voltage_v * 10.0f));
|
||||
|
||||
@@ -236,7 +236,7 @@ void sPort_send_CUR(int uart)
|
||||
void sPort_send_ALT(int uart)
|
||||
{
|
||||
/* send data */
|
||||
uint32_t alt = (int)(100 * sensor_combined->baro_alt_meter[0]);
|
||||
uint32_t alt = (int)(100 * sensor_combined->baro_alt_meter);
|
||||
sPort_send_data(uart, SMARTPORT_ID_ALT, alt);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,12 +149,12 @@ build_eam_response(uint8_t *buffer, size_t *size)
|
||||
msg.eam_sensor_id = EAM_SENSOR_ID;
|
||||
msg.sensor_text_id = EAM_SENSOR_TEXT_ID;
|
||||
|
||||
msg.temperature1 = (uint8_t)(raw.baro_temp_celcius[0] + 20);
|
||||
msg.temperature1 = (uint8_t)(raw.baro_temp_celcius + 20);
|
||||
msg.temperature2 = msg.temperature1 - BOARD_TEMP_OFFSET_DEG;
|
||||
|
||||
msg.main_voltage_L = (uint8_t)(battery.voltage_v * 10);
|
||||
|
||||
uint16_t alt = (uint16_t)(raw.baro_alt_meter[0] + 500);
|
||||
uint16_t alt = (uint16_t)(raw.baro_alt_meter + 500);
|
||||
msg.altitude_L = (uint8_t)alt & 0xff;
|
||||
msg.altitude_H = (uint8_t)(alt >> 8) & 0xff;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user