altosui: Accept variations in spacing for igniter status reply
authorKeith Packard <keithp@keithp.com>
Wed, 18 Jul 2012 04:04:58 +0000 (21:04 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Jul 2012 04:04:58 +0000 (21:04 -0700)
Megametrum uses different white space; just deal with it here.

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosIgnite.java

index 45d37d167dbff2d23c31d9395b6966159f7cd35c..f84db0b943175c374f4be7ccdaebf20081772e2d 100644 (file)
@@ -110,12 +110,23 @@ public class AltosIgnite {
                                String line = serial.get_reply(5000);
                                if (line == null)
                                        throw new TimeoutException();
-                               if (get_string(line, "Igniter: drogue Status: ", status_name))
+                               String[] items = line.split("\\s+");
+
+                               if (items.length < 4)
+                                       continue;
+
+                               if (!items[0].equals("Igniter:"))
+                                       continue;
+
+                               if (!items[2].equals("Status:"))
+                                       continue;
+
+                               if (items[1].equals("drogue")) {
                                        if (igniter == Apogee)
-                                               status = status(status_name.get());
-                               if (get_string(line, "Igniter:   main Status: ", status_name)) {
+                                               status = status(items[3]);
+                               } else if (items[1].equals("main")) {
                                        if (igniter == Main)
-                                               status = status(status_name.get());
+                                               status = status(items[3]);
                                        break;
                                }
                        }