summaryrefslogtreecommitdiff
path: root/altoslib/AltosTelemetrySatellite.java
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-23 14:53:55 -0700
committerKeith Packard <keithp@keithp.com>2017-05-23 15:15:21 -0700
commit7600116a191b3ac252a0f716d200d0e0b3500987 (patch)
treec9cc6c418244d3e2fb5b5c1b9ab961f8a3f5ab30 /altoslib/AltosTelemetrySatellite.java
parentabcedc4b49ce77607ef95abf69479dc1d2c1b76d (diff)
altoslib: Don't store computed telemetry fields
These values are only needed once, so there's no reason to save them. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosTelemetrySatellite.java')
-rw-r--r--altoslib/AltosTelemetrySatellite.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/altoslib/AltosTelemetrySatellite.java b/altoslib/AltosTelemetrySatellite.java
index 6897f0e6..ce12d32d 100644
--- a/altoslib/AltosTelemetrySatellite.java
+++ b/altoslib/AltosTelemetrySatellite.java
@@ -19,13 +19,12 @@
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)
@@ -38,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) {
@@ -45,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();
}
}