#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;
ao_xmemset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN),
sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
+ ao_config._legacy_radio_channel = 0;
}
minor = ao_config.minor;
if (minor != AO_CONFIG_MINOR) {
if (minor < 9)
ao_xmemset(&ao_config.aes_key, '\0', AO_AES_LEN);
if (minor < 10)
- ao_config.frequency = 434550;
+ ao_config.frequency = 434550 + ao_config._legacy_radio_channel * 100;
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;
}
#if HAS_RADIO
#if HAS_FORCE_FREQ
- if (ao_force_freq)
+ if (ao_force_freq) {
ao_config.frequency = 434550;
+ ao_config.radio_cal = ao_radio_cal;
+ ao_xmemcpy(&ao_config.callsign, CODE_TO_XDATA(AO_CONFIG_DEFAULT_CALLSIGN),
+ sizeof(AO_CONFIG_DEFAULT_CALLSIGN) - 1);
+ }
#endif
ao_config_set_radio();
#endif
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;
#endif /* HAS_RADIO */
#if HAS_AES
+
+__xdata uint8_t ao_config_aes_seq = 1;
+
void
ao_config_key_show(void) __reentrant
{
break;
ao_config.aes_key[i] = ao_cmd_lex_i;
}
+ ++ao_config_aes_seq;
_ao_config_edit_finish();
}
#endif
#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 },
{
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)();