projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altos: Make sure pa to altitude conversion is done with 32 bits
[fw/altos]
/
src
/
core
/
ao_config.c
diff --git
a/src/core/ao_config.c
b/src/core/ao_config.c
index e0dabcd9cc60120ac9dfa153bc80c3a9ca433626..e85ddcb4d74d9a53dbb0b2ed9630d4be0f667cfe 100644
(file)
--- a/
src/core/ao_config.c
+++ b/
src/core/ao_config.c
@@
-17,8
+17,11
@@
#include "ao.h"
#include "ao_log.h"
#include "ao.h"
#include "ao_log.h"
+#include <ao_storage.h>
+#if HAS_FLIGHT
#include <ao_sample.h>
#include <ao_data.h>
#include <ao_sample.h>
#include <ao_data.h>
+#endif
__xdata struct ao_config ao_config;
__pdata uint8_t ao_config_loaded;
__xdata struct ao_config ao_config;
__pdata uint8_t ao_config_loaded;
@@
-99,6
+102,7
@@
_ao_config_get(void)
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_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) {
}
minor = ao_config.minor;
if (minor != AO_CONFIG_MINOR) {
@@
-128,26
+132,38
@@
_ao_config_get(void)
if (minor < 9)
ao_xmemset(&ao_config.aes_key, '\0', AO_AES_LEN);
if (minor < 10)
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 (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
ao_config.minor = AO_CONFIG_MINOR;
ao_config_dirty = 1;
}
#if HAS_RADIO
+#if HAS_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;
}
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();
}
_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;
_ao_config_edit_finish(void)
{
ao_config_dirty = 1;
@@
-452,6
+468,9
@@
ao_config_radio_enable_set(void) __reentrant
#endif /* HAS_RADIO */
#if HAS_AES
#endif /* HAS_RADIO */
#if HAS_AES
+
+__xdata uint8_t ao_config_aes_seq = 1;
+
void
ao_config_key_show(void) __reentrant
{
void
ao_config_key_show(void) __reentrant
{
@@
-474,6
+493,7
@@
ao_config_key_set(void) __reentrant
break;
ao_config.aes_key[i] = ao_cmd_lex_i;
}
break;
ao_config.aes_key[i] = ao_cmd_lex_i;
}
+ ++ao_config_aes_seq;
_ao_config_edit_finish();
}
#endif
_ao_config_edit_finish();
}
#endif
@@
-533,6
+553,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 },
#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 },
#endif
{ "s\0Show",
ao_config_show, 0 },
@@
-550,12
+574,10
@@
ao_config_set(void)
{
char c;
uint8_t cmd;
{
char c;
uint8_t cmd;
- void (*__xdata func)(void) __reentrant;
ao_cmd_white();
c = ao_cmd_lex_c;
ao_cmd_lex();
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)();
for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
if (ao_config_vars[cmd].str[0] == c) {
(*ao_config_vars[cmd].set)();