altos: Keep telemetry and command output from interleaving
[fw/altos] / src / kernel / ao_cmd.c
index 605a2f205e58c69411b931cd2f273ac5197cdedd..10716afd5e8e0ffe9fab17fb459874a6dfa748d5 100644 (file)
@@ -394,11 +394,17 @@ ao_cmd(void)
                        if (func)
                                break;
                }
+#if HAS_MONITOR
+               ao_mutex_get(&ao_monitoring_mutex);
+#endif
                if (func)
                        (*func)();
                else
                        ao_cmd_status = ao_cmd_syntax_error;
                report();
+#if HAS_MONITOR
+               ao_mutex_put(&ao_monitoring_mutex);
+#endif
        }
 }