diff options
author | Keith Packard <keithp@keithp.com> | 2019-07-16 09:57:24 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2019-07-16 09:57:24 -0700 |
commit | a0a109d8c82e7f362253a0f1e52d14843ddec996 (patch) | |
tree | e5162bddc4e69608590909afaa0db6684689443d /ao-tools | |
parent | 0a60b7addddc302c66556c0f25ba1e71d14cf53d (diff) |
ao-tools/ao-eeprom: Add altitude data for baro values
Displays altitude along with pressure and temp for baro sensor data.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools')
-rw-r--r-- | ao-tools/ao-eeprom/Makefile.am | 2 | ||||
-rw-r--r-- | ao-tools/ao-eeprom/ao-eeprom.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ao-tools/ao-eeprom/Makefile.am b/ao-tools/ao-eeprom/Makefile.am index d4aca00f..1e38ebad 100644 --- a/ao-tools/ao-eeprom/Makefile.am +++ b/ao-tools/ao-eeprom/Makefile.am @@ -5,7 +5,7 @@ AO_EEPROM_LIBS=$(top_builddir)/ao-tools/lib/libao-tools.a ao_eeprom_DEPENDENCIES = $(AO_EEPROM_LIBS) -ao_eeprom_LDADD=$(AO_EEPROM_LIBS) -ljson-c +ao_eeprom_LDADD=$(AO_EEPROM_LIBS) -ljson-c -lm ao_eeprom_SOURCES = ao-eeprom.c diff --git a/ao-tools/ao-eeprom/ao-eeprom.c b/ao-tools/ao-eeprom/ao-eeprom.c index 0c0500f9..0a4db823 100644 --- a/ao-tools/ao-eeprom/ao-eeprom.c +++ b/ao-tools/ao-eeprom/ao-eeprom.c @@ -22,6 +22,7 @@ #include <unistd.h> #include <getopt.h> #include <ao-eeprom-read.h> +#include <ao-atmosphere.h> static const struct option options[] = { { .name = "raw", .has_arg = 0, .val = 'r' }, @@ -55,11 +56,12 @@ ao_ms5607(uint32_t pres, uint32_t temp, struct ao_eeprom *eeprom, bool is_ms5611 ao_ms5607_convert(&ms5607_sample, &ms5607_value, &eeprom->ms5607_prom, is_ms5611); - printf(" pres %9u temp %9u (%7.3f kPa %6.2f°C)", + printf(" pres %9u temp %9u (%7.3f kPa %6.2f°C %7.1f m)", pres, temp, ms5607_value.pres / 1000.0, - ms5607_value.temp / 100.0); + ms5607_value.temp / 100.0, + ao_pressure_to_altitude(ms5607_value.pres)); } #define GRAVITY 9.80665 |