X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosEepromChunk.java;h=59767c2aa60d1bad4eb355d71bdfda58de8d330f;hb=ca036c5616c3e745c0b878ed90618d4ff710c0e5;hp=1e42077ff01f5168593ca3df415cedf34b12540a;hpb=d41edb3384b6336f3482e61b0c9f9400a8b4f519;p=fw%2Faltos diff --git a/altosui/AltosEepromChunk.java b/altosui/AltosEepromChunk.java index 1e42077f..59767c2a 100644 --- a/altosui/AltosEepromChunk.java +++ b/altosui/AltosEepromChunk.java @@ -52,14 +52,22 @@ public class AltosEepromChunk { return data[offset] | (data[offset + 1] << 8); } - public AltosEepromChunk(AltosSerial serial_line, int block) + 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, 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) {