Merge remote-tracking branch 'mjb/master'
[fw/altos] / src / core / ao_config.c
index ced8b1f28f7f0f0389cc4b334d969d32621b3d86..f19dd9cd8d198b6f0724119afa5bdeebfb0b882d 100644 (file)
 
 #include "ao.h"
 #include "ao_log.h"
+#include <ao_storage.h>
+#if HAS_FLIGHT
 #include <ao_sample.h>
 #include <ao_data.h>
+#endif
 
 __xdata struct ao_config ao_config;
 __pdata uint8_t ao_config_loaded;
@@ -131,6 +134,10 @@ _ao_config_get(void)
                        ao_config.frequency = 434550;
                if (minor < 11)
                        ao_config.apogee_lockout = 0;
+#if AO_PYRO_NUM
+               if (minor < 12)
+                       memset(&ao_config.pyro, '\0', sizeof (ao_config.pyro));
+#endif
                ao_config.minor = AO_CONFIG_MINOR;
                ao_config_dirty = 1;
        }
@@ -144,14 +151,14 @@ _ao_config_get(void)
        ao_config_loaded = 1;
 }
 
-static void
+void
 _ao_config_edit_start(void)
 {
        ao_mutex_get(&ao_config_mutex);
        _ao_config_get();
 }
 
-static void
+void
 _ao_config_edit_finish(void)
 {
        ao_config_dirty = 1;
@@ -537,6 +544,10 @@ __code struct ao_config_var ao_config_vars[] = {
 #if HAS_AES
        { "k <32 hex digits>\0Set AES encryption key",
          ao_config_key_set, ao_config_key_show },
+#endif
+#if AO_PYRO_NUM
+       { "P <n,?>\0Configure pyro channels",
+         ao_pyro_set, ao_pyro_show },
 #endif
        { "s\0Show",
          ao_config_show,               0 },
@@ -554,12 +565,10 @@ ao_config_set(void)
 {
        char    c;
        uint8_t cmd;
-       void (*__xdata func)(void) __reentrant;
 
        ao_cmd_white();
        c = ao_cmd_lex_c;
        ao_cmd_lex();
-       func = 0;
        for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
                if (ao_config_vars[cmd].str[0] == c) {
                        (*ao_config_vars[cmd].set)();