blob: 395d8f3fcf81b431344751dd3932270b1c45eb7f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
/*
* Copyright © 2017 Keith Packard <keithp@keithp.com>
*
* 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, 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*/
package org.altusmetrum.altoslib_11;
public abstract class AltosFlightListener {
public int flight;
public int serial;
public int tick;
public int boost_tick;
public int state;
public double accel_plus_g;
public double accel_minus_g;
public double accel;
public double ground_pressure;
public double ground_altitude;
AltosGPS temp_gps;
int temp_gps_sat_tick;
int gps_sequence;
/* AltosEepromRecord */
public void set_boost_tick(int boost_tick) {
if (boost_tick != AltosLib.MISSING)
this.boost_tick = boost_tick;
}
public void set_tick(int tick) {
if (tick != AltosLib.MISSING)
this.tick = tick;
}
public double time() {
if (tick == AltosLib.MISSING)
return AltosLib.MISSING;
if (boost_tick != AltosLib.MISSING)
return (tick - boost_tick) / 100.0;
else
return tick / 100.0;
}
public double boost_time() {
if (boost_tick == AltosLib.MISSING)
return AltosLib.MISSING;
return boost_tick / 100.0;
}
public abstract void set_rssi(int rssi, int status);
public abstract void set_received_time(long received_time);
/* AltosEepromRecordFull */
public void set_serial(int serial) {
if (serial != AltosLib.MISSING)
this.serial = serial;
}
public void set_state(int state) {
if (state != AltosLib.MISSING)
this.state = state;
}
public int state() { return state; }
public abstract void set_ground_accel(double ground_accel);
public void set_flight(int flight) {
if (flight != AltosLib.MISSING)
this.flight = flight;
}
public int flight() {
return flight;
}
public abstract void set_accel(double accel);
public abstract void set_acceleration(double accel);
public abstract void set_accel_g(double accel_plus_g, double accel_minus_g);
public abstract void set_pressure(double pa);
public abstract void set_thrust(double N);
public abstract void set_temperature(double deg_c);
public abstract void set_battery_voltage(double volts);
public abstract void set_apogee_voltage(double volts);
public abstract void set_main_voltage(double volts);
public void set_temp_gps() {
temp_gps = null;
}
public boolean gps_pending() {
return temp_gps != null;
}
public AltosGPS make_temp_gps(boolean sats) {
if (temp_gps == null) {
temp_gps = new AltosGPS();
}
if (sats) {
if (tick != temp_gps_sat_tick)
temp_gps.cc_gps_sat = null;
temp_gps_sat_tick = tick;
}
return temp_gps;
}
public void set_ground_pressure(double ground_pressure) {
if (ground_pressure != AltosLib.MISSING) {
this.ground_pressure = ground_pressure;
this.ground_altitude = AltosConvert.pressure_to_altitude(ground_pressure);
}
}
public abstract void set_accel_ground(double along, double across, double through);
public abstract void set_gyro_zero(double roll, double pitch, double yaw);
public abstract void check_imu_wrap(AltosIMU imu);
public abstract void set_imu(AltosIMU imu);
public abstract void set_mag(AltosMag mag);
public abstract void set_pyro_voltage(double volts);
public abstract void set_igniter_voltage(double[] voltage);
public abstract void set_pyro_fired(int pyro_mask);
public void copy(AltosFlightListener old) {
flight = old.flight;
serial = old.serial;
tick = old.tick;
boost_tick = old.boost_tick;
accel_plus_g = old.accel_plus_g;
accel_minus_g = old.accel_minus_g;
ground_pressure = old.ground_pressure;
ground_altitude = old.ground_altitude;
temp_gps = old.temp_gps;
temp_gps_sat_tick = old.temp_gps_sat_tick;
}
public void init() {
flight = AltosLib.MISSING;
serial = AltosLib.MISSING;
tick = AltosLib.MISSING;
boost_tick = AltosLib.MISSING;
accel_plus_g = AltosLib.MISSING;
accel_minus_g = AltosLib.MISSING;
accel = AltosLib.MISSING;
ground_pressure = AltosLib.MISSING;
ground_altitude = AltosLib.MISSING;
temp_gps = null;
temp_gps_sat_tick = AltosLib.MISSING;
}
}
|