mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
Baro: example sketch to use healthy() function
This commit is contained in:
parent
76634ee8c3
commit
78b1bf8282
@ -77,7 +77,8 @@ void loop()
|
||||
timer = hal.scheduler->micros();
|
||||
barometer.read();
|
||||
uint32_t read_time = hal.scheduler->micros() - timer;
|
||||
if (!barometer.healthy) {
|
||||
float alt = barometer.get_altitude();
|
||||
if (!barometer.healthy()) {
|
||||
hal.console->println("not healthy");
|
||||
return;
|
||||
}
|
||||
@ -86,7 +87,7 @@ void loop()
|
||||
hal.console->print(" Temperature:");
|
||||
hal.console->print(barometer.get_temperature());
|
||||
hal.console->print(" Altitude:");
|
||||
hal.console->print(barometer.get_altitude());
|
||||
hal.console->print(alt);
|
||||
hal.console->printf(" climb=%.2f t=%u samples=%u",
|
||||
barometer.get_climb_rate(),
|
||||
(unsigned)read_time,
|
||||
|
Loading…
Reference in New Issue
Block a user