diff options
author | Keith Packard <keithp@keithp.com> | 2013-08-27 21:28:07 -0600 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2013-08-29 06:47:37 -0600 |
commit | 04d7d0f829ba953ffeca8ad9887a4b6b2b5d5087 (patch) | |
tree | 5a0c085740c465adb7f52442f34eaf4ee08ce7dc /altoslib/AltosIMU.java | |
parent | dcc51bb18985c24fa35bce0dd42ea3d847b960bf (diff) |
altoslib: Start restructuring AltosState harder
Make per-packet code update state itself rather than having all state
updates done centrally. Will make adding new packet types easier.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosIMU.java')
-rw-r--r-- | altoslib/AltosIMU.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/altoslib/AltosIMU.java b/altoslib/AltosIMU.java index 8f6731fa..46df35bf 100644 --- a/altoslib/AltosIMU.java +++ b/altoslib/AltosIMU.java @@ -17,7 +17,7 @@ package org.altusmetrum.altoslib_1; -public class AltosIMU { +public class AltosIMU implements Cloneable { public int accel_x; public int accel_y; public int accel_z; @@ -25,5 +25,17 @@ public class AltosIMU { public int gyro_x; public int gyro_y; public int gyro_z; + + public AltosIMU clone() { + AltosIMU n = new AltosIMU(); + + n.accel_x = accel_x; + n.accel_y = accel_y; + n.accel_z = accel_z; + + n.gyro_x = gyro_x; + n.gyro_y = gyro_y; + n.gyro_z = gyro_z; + return n; }
\ No newline at end of file |