- if (values == null) {
- System.out.printf("invalid line: %s\n", line);
- continue;
- } else if (values[0] != addr) {
- System.out.printf("data address out of sync at 0x%x\n",
- block * 256 + values[0]);
- } else if (checksum(values) != 0) {
- System.out.printf("invalid checksum at 0x%x\n",
- block * 256 + values[0]);
- } else {
- any_valid = true;
- int cmd = values[1];
- int tick = values[3] + (values[4] << 8);
- int a = values[5] + (values[6] << 8);
- int b = values[7] + (values[8] << 8);
-
- if (cmd == Altos.AO_LOG_FLIGHT) {
- flight = b;
- monitor.set_flight(flight);
- }
-
- /* Monitor state transitions to update display */
- if (cmd == Altos.AO_LOG_STATE && a <= Altos.ao_flight_landed) {
- if (a > Altos.ao_flight_pad)
- want_file = true;
- if (a > state)
- state_block = block;
- state = a;
- }
+ AltosEepromBlock eeblock = new AltosEepromBlock(serial_line, block);
+ if (eeblock.has_flight) {
+ flight = eeblock.flight;
+ monitor.set_flight(flight);
+ }
+ if (eeblock.has_date) {
+ year = eeblock.year;
+ month = eeblock.month;
+ day = eeblock.day;
+ want_file = true;
+ }