altosui: Deal with altos bug setting radio channel while monitoring
[fw/altos] / ao-tools / altosui / AltosSerial.java
index c3daf3b93cd8c00188ddff48563995d079b65cf0..c4a7ad76a9437117f25091caf9038ced7df1abd0 100644 (file)
@@ -186,10 +186,14 @@ public class AltosSerial implements Runnable {
 
        public void set_channel(int channel) {
                if (altos != null) {
+                       if (monitor_mode) {
+                               printf("m 0\n");
+                               flush_input();
+                       }
+                       printf("c r %d\n", channel);
                        if (monitor_mode)
-                               printf("m 0\nc r %d\nm 1\n", channel);
-                       else
-                               printf("c r %d\n", channel);
+                               printf("m 1\n");
+                       flush_input();
                }
        }
 
@@ -198,8 +202,10 @@ public class AltosSerial implements Runnable {
                if (altos != null) {
                        if (monitor)
                                printf("m 1\n");
-                       else
+                       else {
                                printf("m 0\n");
+                               flush_input();
+                       }
                }
        }