Пример #1
0
void GCS_MAVLINK::send_scaled_pressure(AP_Baro &barometer)
{
    uint32_t now = hal.scheduler->millis();
    float pressure = barometer.get_pressure(0);
    mavlink_msg_scaled_pressure_send(
        chan,
        now,
        pressure*0.01f, // hectopascal
        (pressure - barometer.get_ground_pressure(0))*0.01f, // hectopascal
        barometer.get_temperature(0)*100); // 0.01 degrees C
#if BARO_MAX_INSTANCES > 1
    if (barometer.num_instances() > 1) {
        pressure = barometer.get_pressure(1);
        mavlink_msg_scaled_pressure2_send(
            chan,
            now,
            pressure*0.01f, // hectopascal
            (pressure - barometer.get_ground_pressure(1))*0.01f, // hectopascal
            barometer.get_temperature(1)*100); // 0.01 degrees C        
    }
#endif
#if BARO_MAX_INSTANCES > 2
    if (barometer.num_instances() > 2) {
        pressure = barometer.get_pressure(2);
        mavlink_msg_scaled_pressure3_send(
            chan,
            now,
            pressure*0.01f, // hectopascal
            (pressure - barometer.get_ground_pressure(2))*0.01f, // hectopascal
            barometer.get_temperature(2)*100); // 0.01 degrees C        
    }
#endif
}
Пример #2
0
void GCS_MAVLINK::send_scaled_pressure(AP_Baro &barometer)
{
    uint32_t now = AP_HAL::millis();
    float pressure = barometer.get_pressure(0);
    mavlink_msg_scaled_pressure_send(
        chan,
        now,
        pressure*0.01f, // hectopascal
        (pressure - barometer.get_ground_pressure(0))*0.01f, // hectopascal
        barometer.get_temperature(0)*100); // 0.01 degrees C

    if (barometer.num_instances() > 1) {
        pressure = barometer.get_pressure(1);
        mavlink_msg_scaled_pressure2_send(
            chan,
            now,
            pressure*0.01f, // hectopascal
            (pressure - barometer.get_ground_pressure(1))*0.01f, // hectopascal
            barometer.get_temperature(1)*100); // 0.01 degrees C
    }

    if (barometer.num_instances() > 2) {
        pressure = barometer.get_pressure(2);
        mavlink_msg_scaled_pressure3_send(
            chan,
            now,
            pressure*0.01f, // hectopascal
            (pressure - barometer.get_ground_pressure(2))*0.01f, // hectopascal
            barometer.get_temperature(2)*100); // 0.01 degrees C
    }
}
Пример #3
0
// Work around to get temperature sensor data out
void GCS_MAVLINK_Sub::send_scaled_pressure3()
{
    if (!sub.celsius.healthy()) {
        return;
    }
    mavlink_msg_scaled_pressure3_send(
        chan,
        AP_HAL::millis(),
        0,
        0,
        sub.celsius.temperature() * 100);
}