diff options
author | Keith Packard <keithp@keithp.com> | 2009-04-26 00:11:32 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2009-04-26 00:11:32 -0700 |
commit | 38a0b61b0a0b3c00f064c8d562950a17a6ddff4a (patch) | |
tree | ee099db3cfa30d5fe7a94523fe1e7a46f64d238d /ao_convert.c | |
parent | c65f1a1acd2ca00758833cec5d3f8056d303d3e2 (diff) |
Add configuration support
Current config variables:
Main deploy altitude above launch (in meters)
Acceleration zero g calibration (manual or automatic)
Radio channel (freq = 435.550MHz + channel * 100kHz)
Callsign (max 8 characters)
Supporting this involved shuffling code around so that the
non-telemetrum builds could include only the stuff they needed.
Diffstat (limited to 'ao_convert.c')
-rw-r--r-- | ao_convert.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/ao_convert.c b/ao_convert.c index 2585db54..57ed7370 100644 --- a/ao_convert.c +++ b/ao_convert.c @@ -30,6 +30,17 @@ ao_pres_to_altitude(int16_t pres) __reentrant return altitude_table[pres]; } +int16_t +ao_altitude_to_pres(int16_t alt) __reentrant +{ + int16_t pres; + + for (pres = 0; pres < 2047; pres++) + if (altitude_table[pres] <= alt) + break; + return pres << 4; +} + static __xdata uint8_t ao_temp_mutex; int16_t @@ -42,10 +53,3 @@ ao_temp_to_dC(int16_t temp) __reentrant ao_mutex_put(&ao_temp_mutex); return ret; } - -int16_t -ao_accel_to_cm_per_s2(int16_t accel) __reentrant -{ - /* this is wrong */ - return (998 - (accel >> 4)) * 3300 / 2047; -} |