projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ao-tools: Use array indexing instead of addition to make gcc-10 happy
[fw/altos]
/
altoslib
/
AltosReplayReader.java
diff --git
a/altoslib/AltosReplayReader.java
b/altoslib/AltosReplayReader.java
index fb8432e7e8049ed0132763d18a27c1520fcb8940..07f62427a3861ac92de1f433b9755e859d3e4f42 100644
(file)
--- a/
altoslib/AltosReplayReader.java
+++ b/
altoslib/AltosReplayReader.java
@@
-16,7
+16,7
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_1
1
;
+package org.altusmetrum.altoslib_1
4
;
import java.io.*;
import java.util.*;
import java.io.*;
import java.util.*;
@@
-31,17
+31,19
@@
class AltosReplay extends AltosDataListener implements Runnable {
AltosState state;
AltosRecordSet record_set;
double last_time = AltosLib.MISSING;
AltosState state;
AltosRecordSet record_set;
double last_time = AltosLib.MISSING;
- Semaphore semaphore = new Semaphore(1);
;
+ Semaphore semaphore = new Semaphore(1);
boolean done = false;
public void set_time(double time) {
boolean done = false;
public void set_time(double time) {
- if (last_time != AltosLib.MISSING) {
- semaphore.release();
- double delay = Math.min(time - last_time,10);
- if (delay > 0) {
- try {
- Thread.sleep((int) (delay * 1000));
- } catch (InterruptedException ie) {
+ if (time > -2) {
+ if (last_time != AltosLib.MISSING) {
+ semaphore.release();
+ double delay = Math.min(time - last_time,10);
+ if (delay > 0) {
+ try {
+ Thread.sleep((int) (delay * 1000));
+ } catch (InterruptedException ie) {
+ }
}
}
}
}
}
}
@@
-70,7
+72,10
@@
class AltosReplay extends AltosDataListener implements Runnable {
public void set_apogee_voltage(double volts) { state.set_apogee_voltage(volts); }
public void set_main_voltage(double volts) { state.set_main_voltage(volts); }
public void set_apogee_voltage(double volts) { state.set_apogee_voltage(volts); }
public void set_main_voltage(double volts) { state.set_main_voltage(volts); }
- public void set_gps(AltosGPS gps) { state.set_gps(gps); }
+ public void set_gps(AltosGPS gps, boolean set_location, boolean set_sats) {
+ super.set_gps(gps, set_location, set_sats);
+ state.set_gps(gps, set_location, set_sats);
+ }
public void set_orient(double orient) { state.set_orient(orient); }
public void set_gyro(double roll, double pitch, double yaw) { state.set_gyro(roll, pitch, yaw); }
public void set_orient(double orient) { state.set_orient(orient); }
public void set_gyro(double roll, double pitch, double yaw) { state.set_gyro(roll, pitch, yaw); }
@@
-83,20
+88,8
@@
class AltosReplay extends AltosDataListener implements Runnable {
public void set_companion(AltosCompanion companion) { state.set_companion(companion); }
public void run () {
public void set_companion(AltosCompanion companion) { state.set_companion(companion); }
public void run () {
- System.out.printf("ReplayReader running\n");
- state = new AltosState(record_set.cal_data());
-
- /* Tell the display that we're in pad mode */
- state.set_state(AltosLib.ao_flight_pad);
- semaphore.release();
- try {
- Thread.sleep(100);
- } catch (InterruptedException ie) {
- }
-
/* Run the flight */
record_set.capture_series(this);
/* Run the flight */
record_set.capture_series(this);
-
/* All done, signal that it's over */
done = true;
semaphore.release();
/* All done, signal that it's over */
done = true;
semaphore.release();
@@
-104,31
+97,35
@@
class AltosReplay extends AltosDataListener implements Runnable {
public AltosReplay(AltosRecordSet record_set) {
super(record_set.cal_data());
public AltosReplay(AltosRecordSet record_set) {
super(record_set.cal_data());
+ state = new AltosState(record_set.cal_data());
+ this.record_set = record_set;
try {
semaphore.acquire();
try {
semaphore.acquire();
- } catch (InterruptedException ie) { }
- this.record_set = record_set;
- Thread t = new Thread(this);
- t.start();
+ } catch (InterruptedException ie) {
+ }
}
}
public class AltosReplayReader extends AltosFlightReader {
File file;
AltosReplay replay;
}
}
public class AltosReplayReader extends AltosFlightReader {
File file;
AltosReplay replay;
+ Thread t;
- public AltosState read() {
-
- /* When done, let the display know */
- if (replay.done)
- return null;
+ public AltosCalData cal_data() {
+ return replay.state.cal_data();
+ }
+ public AltosState read() {
/* Wait for something to change */
try {
replay.semaphore.acquire();
} catch (InterruptedException ie) {
}
/* Wait for something to change */
try {
replay.semaphore.acquire();
} catch (InterruptedException ie) {
}
+ /* When done, let the display know */
+ if (replay.done)
+ return null;
+
/* Fake out the received time */
replay.state.set_received_time(System.currentTimeMillis());
return replay.state;
/* Fake out the received time */
replay.state.set_received_time(System.currentTimeMillis());
return replay.state;
@@
-137,14
+134,13
@@
public class AltosReplayReader extends AltosFlightReader {
public void close (boolean interrupted) {
}
public void close (boolean interrupted) {
}
- public void update(AltosState state) throws InterruptedException {
- }
-
public File backing_file() { return file; }
public AltosReplayReader(AltosRecordSet record_set, File in_file) {
file = in_file;
name = file.getName();
replay = new AltosReplay(record_set);
public File backing_file() { return file; }
public AltosReplayReader(AltosRecordSet record_set, File in_file) {
file = in_file;
name = file.getName();
replay = new AltosReplay(record_set);
+ t = new Thread(replay);
+ t.start();
}
}
}
}