altos: Make sure pa to altitude conversion is done with 32 bits
[fw/altos] / src / core / ao_sample.h
index fb0e69e87e23c998fee745464e0ad33fb6d9f403..9336bdf9c8bfda847a2e0cfbe9166ed96baccedf 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef _AO_SAMPLE_H_
 #define _AO_SAMPLE_H_
 
+#include <ao_data.h>
+
 /*
  * ao_sample.c
  */
 /*
  * Above this height, the baro sensor doesn't work
  */
+#if HAS_MS5607
+#define AO_MAX_BARO_HEIGHT     30000
+#else
 #define AO_MAX_BARO_HEIGHT     12000
+#endif
 
 /*
  * Above this speed, baro measurements are unreliable
 #define AO_MSS_TO_ACCEL(mss)   ((int16_t) ((mss) * 16))
 
 extern __pdata uint16_t        ao_sample_tick;         /* time of last data */
-extern __pdata int16_t ao_sample_pres;         /* most recent pressure sensor reading */
-extern __pdata int16_t ao_sample_alt;          /* MSL of ao_sample_pres */
-extern __pdata int16_t ao_sample_height;       /* AGL of ao_sample_pres */
 extern __data uint8_t  ao_sample_adc;          /* Ring position of last processed sample */
-
-#if HAS_ACCEL
-extern __pdata int16_t ao_sample_accel;        /* most recent accel sensor reading */
+extern __data uint8_t  ao_sample_data;         /* Ring position of last processed sample */
+
+#if HAS_BARO
+extern __pdata pres_t  ao_sample_pres;         /* most recent pressure sensor reading */
+extern __pdata alt_t   ao_sample_alt;          /* MSL of ao_sample_pres */
+extern __pdata alt_t   ao_sample_height;       /* AGL of ao_sample_pres */
+extern __pdata pres_t  ao_ground_pres;         /* startup pressure */
+extern __pdata alt_t   ao_ground_height;       /* MSL of ao_ground_pres */
 #endif
 
-extern __pdata int16_t ao_ground_pres;         /* startup pressure */
-extern __pdata int16_t ao_ground_height;       /* MSL of ao_ground_pres */
-
 #if HAS_ACCEL
-extern __pdata int16_t ao_ground_accel;        /* startup acceleration */
-extern __pdata int16_t         ao_accel_2g;            /* factory accel calibration */
+extern __pdata accel_t ao_sample_accel;        /* most recent accel sensor reading */
+extern __pdata accel_t ao_ground_accel;        /* startup acceleration */
+extern __pdata accel_t         ao_accel_2g;            /* factory accel calibration */
 extern __pdata int32_t ao_accel_scale;         /* sensor to m/s² conversion */
 #endif