diff options
author | Keith Packard <keithp@keithp.com> | 2014-10-04 00:11:13 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2014-10-04 00:11:13 -0700 |
commit | 00ae706dab6e8fddef4c5730a17c433a022228b7 (patch) | |
tree | fae976ad891d1776f6e52c078d9eceb35d96a845 /altoslib/AltosConfigData.java | |
parent | a757fd5af53f5721a949181372548afa4757d6c9 (diff) |
altoslib: Compute tilt angle from eeprom data
This copies the computation of tilt angle from the firmware so that
post-flight analysis can also show the data.
This change also renames all of the imu values to make them easier to
understand:
accel gyro axis
along roll length of the board
across pitch across the board
through yaw through the board.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosConfigData.java')
-rw-r--r-- | altoslib/AltosConfigData.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/altoslib/AltosConfigData.java b/altoslib/AltosConfigData.java index fc1f2442..a9e863c7 100644 --- a/altoslib/AltosConfigData.java +++ b/altoslib/AltosConfigData.java @@ -90,6 +90,9 @@ public class AltosConfigData implements Iterable<String> { public int tracker_motion; public int tracker_interval; + /* HAS_GYRO */ + public int accel_zero_along, accel_zero_across, accel_zero_through; + public static String get_string(String line, String label) throws ParseException { if (line.startsWith(label)) { String quoted = line.substring(label.length()).trim(); @@ -266,6 +269,10 @@ public class AltosConfigData implements Iterable<String> { storage_size = -1; storage_erase_unit = -1; stored_flight = 0; + + accel_zero_along = -1; + accel_zero_across = -1; + accel_zero_through = -1; } public void parse_line(String line) { @@ -361,6 +368,18 @@ public class AltosConfigData implements Iterable<String> { /* Log listing replies */ try { get_int(line, "flight"); stored_flight++; } catch (Exception e) {} + + /* HAS_GYRO */ + try { + if (line.startsWith("IMU call along")) { + String[] bits = line.split("\\s+"); + if (bits.length >= 8) { + accel_zero_along = Integer.parseInt(bits[3]); + accel_zero_across = Integer.parseInt(bits[5]); + accel_zero_through = Integer.parseInt(bits[7]); + } + } + } catch (Exception e) {} } public AltosConfigData() { @@ -637,6 +656,9 @@ public class AltosConfigData implements Iterable<String> { if (tracker_motion >= 0 && tracker_interval >= 0) link.printf("c t %d %d\n", tracker_motion, tracker_interval); + /* HAS_GYRO */ + /* UI doesn't support accel cal */ + link.printf("c w\n"); link.flush_output(); } |