+ public void set_device_type(int device_type) {
+ this.device_type = device_type;
+ }
+
+ public void set_config(int major, int minor, int apogee_delay, int main_deploy, int flight_log_max) {
+ config_major = major;
+ config_minor = minor;
+ this.apogee_delay = apogee_delay;
+ this.main_deploy = main_deploy;
+ this.flight_log_max = flight_log_max;
+ }
+
+ public void set_callsign(String callsign) {
+ this.callsign = callsign;
+ }
+
+ public void set_firmware_version(String version) {
+ firmware_version = version;
+ }
+
+ public void set_flight(int flight) {
+
+ /* When the flight changes, reset the state */
+ if (flight != AltosRecord.MISSING) {
+ if (this.flight != AltosRecord.MISSING &&
+ this.flight != flight) {
+ init();
+ }
+ this.flight = flight;
+ }
+ }
+
+ public void set_serial(int serial) {
+ /* When the serial changes, reset the state */
+ if (serial != AltosRecord.MISSING) {
+ if (this.serial != AltosRecord.MISSING &&
+ this.serial != serial) {
+ init();
+ }
+ this.serial = serial;
+ }
+ }
+
+ public int rssi() {
+ if (rssi == AltosRecord.MISSING)
+ return 0;
+ return rssi;
+ }
+
+ public void set_rssi(int rssi, int status) {
+ if (rssi != AltosRecord.MISSING) {
+ this.rssi = rssi;
+ this.status = status;
+ }
+ }
+
+ public void set_received_time(long ms) {
+ received_time = ms;
+ }
+
+ public void set_altitude(double altitude) {
+ if (altitude != AltosRecord.MISSING) {
+ this.altitude = altitude;
+ update_vertical_pos();
+ set |= set_position;
+ }
+ }
+
+ public void set_ground_altitude(double ground_altitude) {
+ if (ground_altitude != AltosRecord.MISSING) {
+ this.ground_altitude = ground_altitude;
+ update_vertical_pos();
+ }
+ }
+
+ public void set_ground_pressure (double pressure) {
+ if (pressure != AltosRecord.MISSING) {
+ this.ground_pressure = pressure;
+ set_ground_altitude(AltosConvert.pressure_to_altitude(pressure));
+ update_vertical_pos();
+ }
+ }
+
+ public void set_gps(AltosGPS gps, int sequence) {
+ if (gps != null) {
+ this.gps = gps.clone();
+ gps_sequence = sequence;
+ update_gps();
+ update_vertical_pos();
+ set |= set_gps;
+ }
+ }
+
+ public void set_kalman(double height, double speed, double acceleration) {
+ if (height != AltosRecord.MISSING) {
+ kalman_height = height;
+ kalman_speed = speed;
+ kalman_acceleration = acceleration;
+ update_vertical_pos();
+ update_speed();
+ update_accel();
+ }
+ }
+
+ public void set_pressure(double pressure) {
+ if (pressure != AltosRecord.MISSING) {
+ this.pressure = pressure;
+ set_altitude(AltosConvert.pressure_to_altitude(pressure));
+ }
+ }
+
+ public void make_baro() {
+ if (baro == null)
+ baro = new AltosMs5607();
+ }
+
+ public void set_ms5607(int pres, int temp) {
+ if (baro != null) {
+ baro.set(pres, temp);
+
+ set_pressure(baro.pa);
+ set_temperature(baro.cc / 100.0);
+ }
+ }
+
+ public void make_companion (int nchannels) {
+ if (companion == null)
+ companion = new AltosRecordCompanion(nchannels);
+ }
+
+ public void set_companion(AltosRecordCompanion companion) {
+ this.companion = companion;
+ }
+
+ public void set_accel_g(double accel_plus_g, double accel_minus_g) {
+ if (accel_plus_g != AltosRecord.MISSING) {
+ this.accel_plus_g = accel_plus_g;
+ this.accel_minus_g = accel_minus_g;
+ update_accel();
+ }
+ }
+ public void set_ground_accel(double ground_accel) {
+ if (ground_accel != AltosRecord.MISSING) {
+ this.ground_accel = ground_accel;
+ update_accel();
+ }
+ }
+
+ public void set_accel(double accel) {
+ if (accel != AltosRecord.MISSING) {
+ this.accel = accel;
+ if (state == AltosLib.ao_flight_pad) {
+ if (ground_accel_avg == AltosRecord.MISSING)
+ ground_accel_avg = accel;
+ else
+ ground_accel_avg = (ground_accel_avg * 7 + accel) / 8;