summaryrefslogtreecommitdiff
path: root/src/core/ao_convert_pa.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-10-12 13:57:49 -0700
committerKeith Packard <keithp@keithp.com>2012-10-12 13:57:49 -0700
commit175380a436efa35bbfae2ee5e29e12e9ef86fbde (patch)
tree79a0348efd9ce552c3959ca59ce19de6e976b82a /src/core/ao_convert_pa.c
parentbe0a28ee7a6fbd98fc8113db8501bb791a112fa0 (diff)
altos: Use alt_t for all Pascal-based altitude data
This allows alt_t to be overridden for systems using the MS5607/MS5611 sensors Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/core/ao_convert_pa.c')
-rw-r--r--src/core/ao_convert_pa.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/ao_convert_pa.c b/src/core/ao_convert_pa.c
index 0c93caea..1413681d 100644
--- a/src/core/ao_convert_pa.c
+++ b/src/core/ao_convert_pa.c
@@ -26,7 +26,7 @@ static const int32_t altitude_table[] = {
#define ALT_SCALE (1 << ALT_SHIFT)
#define ALT_MASK (ALT_SCALE - 1)
-int32_t
+alt_t
ao_pa_to_altitude(int32_t pa)
{
int16_t o;
@@ -40,8 +40,8 @@ ao_pa_to_altitude(int32_t pa)
o = pa >> ALT_SHIFT;
part = pa & ALT_MASK;
- low = (int32_t) altitude_table[o] * (ALT_SCALE - part);
- high = (int32_t) altitude_table[o+1] * part + (ALT_SCALE >> 1);
+ low = (alt_t) FETCH_ALT(o) * (ALT_SCALE - part);
+ high = (alt_t) FETCH_ALT(o+1) * part + (ALT_SCALE >> 1);
return (low + high) >> ALT_SHIFT;
}