Пример #1
0
void AP_OSD_Screen::draw_aspd2(uint8_t x, uint8_t y)
{
    AP_Airspeed *airspeed = AP_Airspeed::get_singleton();
    if (!airspeed) {
        return;
    }
    float asp2 = airspeed->get_airspeed(1);
    if (airspeed != nullptr && airspeed->healthy(1)) {
        backend->write(x, y, false, "%c%4d%c", SYM_ASPD, (int)u_scale(SPEED, asp2), u_icon(SPEED));
    } else {
        backend->write(x, y, false, "%c ---%c", SYM_ASPD, u_icon(SPEED));
    }
}
Пример #2
0
void loop(void)
{
    static uint32_t timer;
    if ((AP_HAL::millis() - timer) > 100) {
        timer = AP_HAL::millis();
        airspeed.read();
        airspeed.get_temperature(temperature);

        hal.console->printf("airspeed %5.2f temperature %6.2f healthy = %u\n",
                            airspeed.get_airspeed(), temperature, airspeed.healthy());
    }
    hal.scheduler->delay(1);
}
Пример #3
0
void setup()
{
    hal.console->println("ArduPilot Airspeed library test");

    set_object_value(&airspeed, airspeed.var_info, "PIN", 65);
    set_object_value(&airspeed, airspeed.var_info, "ENABLE", 1);
    set_object_value(&airspeed, airspeed.var_info, "USE", 1);

    AP_BoardConfig{}.init();

    airspeed.init();
    airspeed.calibrate(false);
}
Пример #4
0
void AP_OSD_Screen::draw_atemp(uint8_t x, uint8_t y)
{
    AP_Airspeed *airspeed = AP_Airspeed::get_singleton();
    if (!airspeed) {
        return;
    }
    float temperature = 0;
    airspeed->get_temperature(temperature);
    if (airspeed->healthy()) {
        backend->write(x, y, false, "%3d%c", (int)u_scale(TEMPERATURE, temperature), u_icon(TEMPERATURE));
    } else {
        backend->write(x, y, false, "--%c", u_icon(TEMPERATURE));
    }
}