altoslib: Don't store computed telemetry fields
[fw/altos] / altoslib / AltosTelemetrySatellite.java
index d88e6cac941310e395606f0813dfcd5aa20a99a0..ce12d32dd197233e1e2c4f9bada1fdc5d4bfa456 100644 (file)
@@ -3,7 +3,8 @@
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
 package org.altusmetrum.altoslib_11;
 
 public class AltosTelemetrySatellite extends AltosTelemetryStandard {
-       int             channels;
-       AltosGPSSat[]   sats;
+       int             channels() { return uint8(5); }
 
-       public AltosTelemetrySatellite(int[] bytes) {
-               super(bytes);
+       AltosGPSSat[]   sats() {
+               int             channels = channels();
+               AltosGPSSat[]   sats = null;
 
-               channels = uint8(5);
                if (channels > 12)
                        channels = 12;
                if (channels == 0)
@@ -37,6 +37,11 @@ public class AltosTelemetrySatellite extends AltosTelemetryStandard {
                                sats[i] = new AltosGPSSat(svid, c_n_1);
                        }
                }
+               return sats;
+       }
+
+       public AltosTelemetrySatellite(int[] bytes) throws AltosCRCException {
+               super(bytes);
        }
 
        public void update_state(AltosState state) {
@@ -44,7 +49,7 @@ public class AltosTelemetrySatellite extends AltosTelemetryStandard {
 
                AltosGPS        gps = state.make_temp_gps(true);
 
-               gps.cc_gps_sat = sats;
+               gps.cc_gps_sat = sats();
                state.set_temp_gps();
        }
 }