projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altoslib: Don't store computed telemetry fields
[fw/altos]
/
altoslib
/
AltosTelemetryMetrumSensor.java
diff --git
a/altoslib/AltosTelemetryMetrumSensor.java
b/altoslib/AltosTelemetryMetrumSensor.java
index 3769c129146cf34cfe1cff7b54d1131b5fdc2d34..e666f4ec29939c85c2d2e948e53636df5c9e56fc 100644
(file)
--- a/
altoslib/AltosTelemetryMetrumSensor.java
+++ b/
altoslib/AltosTelemetryMetrumSensor.java
@@
-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
*
* 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
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
@@
-15,56
+16,43
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_
9
;
+package org.altusmetrum.altoslib_
11
;
public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard {
public class AltosTelemetryMetrumSensor extends AltosTelemetryStandard {
- int state
;
+ int state
() { return uint8(5); }
- int accel
;
- int pres
;
- int temp
;
+ int accel
() { return int16(6); }
+ int pres
() { return int32(8); }
+ int temp
() { return int16(12); }
- int acceleration
;
- int speed
;
- int height_16
;
+ int acceleration
() { return int16(14); }
+ int speed
() { return int16(16); }
+ int height_16
() { return int16(18); }
- int v_batt
;
- int sense_a
;
- int sense_m
;
+ int v_batt
() { return int16(20); }
+ int sense_a
() { return int16(22); }
+ int sense_m
() { return int16(24); }
- public AltosTelemetryMetrumSensor(int[] bytes) {
+ public AltosTelemetryMetrumSensor(int[] bytes)
throws AltosCRCException
{
super(bytes);
super(bytes);
-
- state = int8(5);
- accel = int16(6);
- pres = int32(8);
- temp = int16(12);
-
- acceleration = int16(14);
- speed = int16(16);
- height_16 = int16(18);
-
- v_batt = int16(20);
- sense_a = int16(22);
- sense_m = int16(24);
}
public void update_state(AltosState state) {
super.update_state(state);
}
public void update_state(AltosState state) {
super.update_state(state);
- state.set_state(
this.state
);
+ state.set_state(
state()
);
- state.set_accel(accel);
- state.set_pressure(pres);
- state.set_temperature(temp/100.0);
+ state.set_accel(accel
()
);
+ state.set_pressure(pres
()
);
+ state.set_temperature(temp
()
/100.0);
- state.set_kalman(extend_height(state, height_16),
- speed
/16.0, acceleration
/16.0);
+ state.set_kalman(extend_height(state, height_16
()
),
+ speed
()/16.0, acceleration()
/16.0);
- state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt));
+ state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt
()
));
- state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sense_a));
- state.set_main_voltage(AltosConvert.mega_pyro_voltage(sense_m));
+ state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sense_a
()
));
+ state.set_main_voltage(AltosConvert.mega_pyro_voltage(sense_m
()
));
}
}
}
}