From e2b746e1a69eb672c02b63bb549bb2f8ece5b8e9 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Mon, 2 Jan 2012 22:13:38 -0800 Subject: [PATCH] altosui: Move AltosState.java to altoslib Signed-off-by: Keith Packard --- altosui/AltosFlightDisplay.java | 2 + altosui/Makefile.am | 1 - altosui/altoslib/Makefile.am | 1 + .../org/altusmetrum/AltosLib}/AltosState.java | 88 +++++++++---------- 4 files changed, 46 insertions(+), 46 deletions(-) rename altosui/{ => altoslib/src/org/altusmetrum/AltosLib}/AltosState.java (74%) diff --git a/altosui/AltosFlightDisplay.java b/altosui/AltosFlightDisplay.java index f633c8e6..826f9522 100644 --- a/altosui/AltosFlightDisplay.java +++ b/altosui/AltosFlightDisplay.java @@ -17,6 +17,8 @@ package altosui; +import org.altusmetrum.AltosLib.*; + public interface AltosFlightDisplay { void reset(); diff --git a/altosui/Makefile.am b/altosui/Makefile.am index 343f5b02..cac75111 100644 --- a/altosui/Makefile.am +++ b/altosui/Makefile.am @@ -78,7 +78,6 @@ altosui_JAVA = \ AltosSiteMapPreload.java \ AltosSiteMapCache.java \ AltosSiteMapTile.java \ - AltosState.java \ AltosTelemetryReader.java \ AltosUI.java \ AltosUIListener.java \ diff --git a/altosui/altoslib/Makefile.am b/altosui/altoslib/Makefile.am index e0647bd4..40ec3af8 100644 --- a/altosui/altoslib/Makefile.am +++ b/altosui/altoslib/Makefile.am @@ -30,6 +30,7 @@ AltosLib_JAVA = \ $(SRC)/AltosRecordCompanion.java \ $(SRC)/AltosRecordIterable.java \ $(SRC)/AltosRecord.java \ + $(SRC)/AltosState.java \ $(SRC)/AltosTelemetry.java \ $(SRC)/AltosTelemetryIterable.java \ $(SRC)/AltosTelemetryMap.java \ diff --git a/altosui/AltosState.java b/altosui/altoslib/src/org/altusmetrum/AltosLib/AltosState.java similarity index 74% rename from altosui/AltosState.java rename to altosui/altoslib/src/org/altusmetrum/AltosLib/AltosState.java index 6a560a06..893e19a9 100644 --- a/altosui/AltosState.java +++ b/altosui/altoslib/src/org/altusmetrum/AltosLib/AltosState.java @@ -19,64 +19,62 @@ * Track flight state from telemetry or eeprom data stream */ -package altosui; - -import org.altusmetrum.AltosLib.*; +package org.altusmetrum.AltosLib; public class AltosState { - AltosRecord data; + public AltosRecord data; /* derived data */ - long report_time; + public long report_time; - double time; - double time_change; - int tick; + public double time; + public double time_change; + public int tick; - int state; - boolean landed; - boolean ascent; /* going up? */ - boolean boost; /* under power */ + public int state; + public boolean landed; + public boolean ascent; /* going up? */ + public boolean boost; /* under power */ - double ground_altitude; - double height; - double speed; - double acceleration; - double battery; - double temperature; - double main_sense; - double drogue_sense; - double baro_speed; + public double ground_altitude; + public double height; + public double speed; + public double acceleration; + public double battery; + public double temperature; + public double main_sense; + public double drogue_sense; + public double baro_speed; - double max_height; - double max_acceleration; - double max_speed; - double max_baro_speed; + public double max_height; + public double max_acceleration; + public double max_speed; + public double max_baro_speed; - AltosGPS gps; + public AltosGPS gps; - double pad_lat; - double pad_lon; - double pad_alt; + public double pad_lat; + public double pad_lon; + public double pad_alt; - static final int MIN_PAD_SAMPLES = 10; + public static final int MIN_PAD_SAMPLES = 10; - int npad; - int ngps; - int gps_waiting; - boolean gps_ready; + public int npad; + public int ngps; + public int gps_waiting; + public boolean gps_ready; - AltosGreatCircle from_pad; - double elevation; /* from pad */ - double range; /* total distance */ + public AltosGreatCircle from_pad; + public double elevation; /* from pad */ + public double range; /* total distance */ - double gps_height; + public double gps_height; - int speak_tick; - double speak_altitude; + public int speak_tick; + public double speak_altitude; - void init (AltosRecord cur, AltosState prev_state) { + public void init (AltosRecord cur, AltosState prev_state) { int i; AltosRecord prev; @@ -137,7 +135,7 @@ public class AltosState { time = tick / 100.0; - if (cur.new_gps && (state == Altos.ao_flight_pad || state == Altos.ao_flight_idle)) { + if (cur.new_gps && (state == AltosLib.ao_flight_pad || state == AltosLib.ao_flight_idle)) { /* Track consecutive 'good' gps reports, waiting for 10 of them */ if (data.gps != null && data.gps.locked && data.gps.nsat >= 4) @@ -167,9 +165,9 @@ public class AltosState { gps_ready = gps_waiting == 0; - ascent = (Altos.ao_flight_boost <= state && - state <= Altos.ao_flight_coast); - boost = (Altos.ao_flight_boost == state); + ascent = (AltosLib.ao_flight_boost <= state && + state <= AltosLib.ao_flight_coast); + boost = (AltosLib.ao_flight_boost == state); /* Only look at accelerometer data under boost */ if (boost && acceleration > max_acceleration) -- 2.30.2