summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-08-13 21:09:19 -0700
committerKeith Packard <keithp@keithp.com>2011-08-13 21:09:19 -0700
commitdcd15032eec45f3fdd003050710ebd5b85052662 (patch)
tree774e50fc8fc1e5205adbf2fbba22dda808693ee6
parent3ba7b6196f68078f4ed4538c4e7fe30699dfe908 (diff)
altosui: Eliminate inter-chunk flush_input calls
Once the serial line is nicely synchronized, we don't need to flush input between chunks. This speeds up eeprom downloading quite a bit. Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--altosui/AltosEepromChunk.java5
-rw-r--r--altosui/AltosEepromDownload.java2
-rw-r--r--altosui/AltosEepromLog.java2
3 files changed, 5 insertions, 4 deletions
diff --git a/altosui/AltosEepromChunk.java b/altosui/AltosEepromChunk.java
index fb632a3f..59767c2a 100644
--- a/altosui/AltosEepromChunk.java
+++ b/altosui/AltosEepromChunk.java
@@ -59,14 +59,15 @@ public class AltosEepromChunk {
return true;
}
- public AltosEepromChunk(AltosSerial serial_line, int block)
+ public AltosEepromChunk(AltosSerial serial_line, int block, boolean flush)
throws TimeoutException, InterruptedException {
int offset;
data = new int[chunk_size];
address = block * chunk_size;
- serial_line.flush_input();
+ if (flush)
+ serial_line.flush_input();
serial_line.printf("e %x\n", block);
for (offset = 0; offset < chunk_size; offset += per_line) {
diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java
index 6112a3b1..b44a1451 100644
--- a/altosui/AltosEepromDownload.java
+++ b/altosui/AltosEepromDownload.java
@@ -275,7 +275,7 @@ public class AltosEepromDownload implements Runnable {
for (block = log.start_block; !done && block < log.end_block; block++) {
monitor.set_value(Altos.state_to_string[state], state, block - state_block);
- AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block);
+ AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block, block == log.start_block);
/*
* Guess what kind of data is there if the device
diff --git a/altosui/AltosEepromLog.java b/altosui/AltosEepromLog.java
index be2549cb..ee77e5c8 100644
--- a/altosui/AltosEepromLog.java
+++ b/altosui/AltosEepromLog.java
@@ -82,7 +82,7 @@ public class AltosEepromLog {
in_end_block = in_start_block + 2;
for (block = in_start_block; block < in_end_block; block++) {
- AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block);
+ AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block, block == in_start_block);
for (int i = 0; i < eechunk.chunk_size; i += AltosEepromRecord.record_length) {
try {