We use replies in debug mode a lot and depend on them matching the
expected parameters. The case which caused trouble was using
TeleMetrum to reprogram TeleDongle -- sending the 'm 0' command (to
disable telemetry monitoring on TeleDongle) to the TeleMetrum caused
it to reply 'Syntax Error' which confused the subsequent flashing
operation. Flushing that reply gets things back in sync.
Signed-off-by: Keith Packard <keithp@keithp.com>
void ensure_debug_mode() {
if (!debug_mode) {
printf("m 0\nD\n");
+ flush_reply();
debug_mode = true;
}
}
LinkedBlockingQueue<String> q = monitors.get(e);
q.put(line);
}
- } else
+ } else {
+// System.out.printf("GOT: %s\n", line);
reply_queue.put(line);
+ }
line = "";
}
} else {
}
public void flush_reply() {
+ libaltos.altos_flush(altos);
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException ie) {
+ }
reply_queue.clear();
}
}
public void print(String data) {
+// System.out.printf("\"%s\" ", data);
for (int i = 0; i < data.length(); i++)
putc(data.charAt(i));
}