summaryrefslogtreecommitdiff
path: root/ao-tools/ao-view/aoview_state.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2009-11-03 00:40:38 -0800
committerKeith Packard <keithp@keithp.com>2009-11-03 00:40:38 -0800
commit1de322b960005c9a16051afa1881fadb00f4bcd6 (patch)
tree7b60481ac08b3f4e0362efdecab5fcefe299cad2 /ao-tools/ao-view/aoview_state.c
parentb529e5e8998702986909111a457f3ce9932e1ccf (diff)
Pass accel calibration over telemetry stream. Telemetry data format change.
This allows the ground station to convert the accelerometer sensor values into acceleration and speed data. This requires a new telemetry data structure, and so TeleMetrum and TeleDongle units must be updated synchronously. ao-view will parse either telemetry stream, and the serial format from TeleDongle now has a version number to allow for future changes. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ao-tools/ao-view/aoview_state.c')
-rw-r--r--ao-tools/ao-view/aoview_state.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ao-tools/ao-view/aoview_state.c b/ao-tools/ao-view/aoview_state.c
index f75066dd..f8f01685 100644
--- a/ao-tools/ao-view/aoview_state.c
+++ b/ao-tools/ao-view/aoview_state.c
@@ -105,6 +105,7 @@ aoview_state_derive(struct aodata *data, struct aostate *state)
double new_height;
double height_change;
double time_change;
+ double accel_counts_per_mss;
int tick_count;
state->report_time = aoview_time();
@@ -123,8 +124,9 @@ aoview_state_derive(struct aodata *data, struct aostate *state)
state->height = new_height;
if (time_change)
state->baro_speed = (state->baro_speed * 3 + (height_change / time_change)) / 4.0;
- state->acceleration = (data->ground_accel - data->flight_accel) / 27.0;
- state->speed = data->flight_vel / 2700.0;
+ accel_counts_per_mss = ((data->accel_minus_g - data->accel_plus_g) / 2.0) / 9.80665;
+ state->acceleration = (data->ground_accel - data->flight_accel) / accel_counts_per_mss;
+ state->speed = data->flight_vel / (accel_counts_per_mss * 100.0);
state->temperature = ((data->temp / 32767.0 * 3.3) - 0.5) / 0.01;
state->drogue_sense = data->drogue / 32767.0 * 15.0;
state->main_sense = data->main / 32767.0 * 15.0;