altos: Support ao_ms5607_dump when no ms5607 task
authorKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 06:43:02 +0000 (23:43 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 18 Jun 2019 06:43:02 +0000 (23:43 -0700)
MicroPeak v2.0 has tasking support, but doesn't have a separate ms5607
task. That means the device isn't getting initialized when not running
the flight code, so in cmd mode we need to make sure it's initialized,
and we also need to actually fetch a value to display.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_ms5607.c

index e2327bf..288d14e 100644 (file)
@@ -255,6 +255,11 @@ ao_ms5607_dump(void)
 {
        struct ao_ms5607_value value;
 
+#if !HAS_MS5607_TASK
+       ao_ms5607_setup();
+       ao_ms5607_info();
+       ao_ms5607_sample(&ao_ms5607_current);
+#endif
        ao_ms5607_convert(&ao_ms5607_current, &value);
        printf ("Pressure:    %8lu %8ld\n", ao_ms5607_current.pres, value.pres);
        printf ("Temperature: %8lu %8ld\n", ao_ms5607_current.temp, value.temp);