X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altosui%2FAltosEepromChunk.java;h=fb632a3f50fd6f8b9b8964ae3cefb33221d47eef;hp=8eec407df395e4aa3ea3f4265f2a14ce6f7ffa1a;hb=5a3e96bef31959a287b8696778d7d8cf911a7dc4;hpb=011615d40b3cb1d1c0ab9fa41e139e263a6a51e7 diff --git a/altosui/AltosEepromChunk.java b/altosui/AltosEepromChunk.java index 8eec407d..fb632a3f 100644 --- a/altosui/AltosEepromChunk.java +++ b/altosui/AltosEepromChunk.java @@ -52,6 +52,13 @@ public class AltosEepromChunk { return data[offset] | (data[offset + 1] << 8); } + boolean erased(int start, int len) { + for (int i = 0; i < len; i++) + if (data[start+i] != 0xff) + return false; + return true; + } + public AltosEepromChunk(AltosSerial serial_line, int block) throws TimeoutException, InterruptedException { @@ -59,6 +66,7 @@ public class AltosEepromChunk { data = new int[chunk_size]; address = block * chunk_size; + serial_line.flush_input(); serial_line.printf("e %x\n", block); for (offset = 0; offset < chunk_size; offset += per_line) {