altos: Set default flight log max to 127k on TM v0.1
[fw/altos] / src / core / ao_config.c
index a653bed2cead5d2dd32da3e19541cbd1e94bc950..921a248065a25d130e27c10799e2dc3dc9c3c41e 100644 (file)
@@ -34,11 +34,13 @@ __xdata uint8_t ao_config_mutex;
 #error Please define USE_INTERNAL_FLASH
 #endif
 #endif
+#ifndef AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX
 #if USE_INTERNAL_FLASH
 #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       ao_storage_config
 #else
 #define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX       ((uint32_t) 192 * (uint32_t) 1024)
 #endif
+#endif
 
 #if HAS_EEPROM
 static void
@@ -78,8 +80,8 @@ _ao_config_get(void)
                /* Version 0 stuff */
                ao_config.main_deploy = AO_CONFIG_DEFAULT_MAIN_DEPLOY;
                ao_config.radio_channel = AO_CONFIG_DEFAULT_RADIO_CHANNEL;
-               memset(&ao_config.callsign, '\0', sizeof (ao_config.callsign));
-               memcpy(&ao_config.callsign, AO_CONFIG_DEFAULT_CALLSIGN,
+               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_dirty = 1;
        }
@@ -148,7 +150,7 @@ ao_config_callsign_set(void) __reentrant
        uint8_t c;
        static __xdata char callsign[AO_MAX_CALLSIGN + 1];
 
-       memset(callsign, '\0', sizeof callsign);
+       ao_xmemset(callsign, '\0', sizeof callsign);
        ao_cmd_white();
        c = 0;
        while (ao_cmd_lex_c != '\n') {
@@ -161,7 +163,7 @@ ao_config_callsign_set(void) __reentrant
        if (ao_cmd_status != ao_cmd_success)
                return;
        _ao_config_edit_start();
-       memcpy(&ao_config.callsign, &callsign,
+       ao_xmemcpy(&ao_config.callsign, &callsign,
               AO_MAX_CALLSIGN + 1);
        _ao_config_edit_finish();
 }
@@ -535,7 +537,8 @@ ao_config_help(void) __reentrant
        for (cmd = 0; ao_config_vars[cmd].str != NULL; cmd++)
                printf("%-20s %s\n",
                       ao_config_vars[cmd].str,
-                      ao_config_vars[cmd].str+1+strlen(ao_config_vars[cmd].str));
+                      ao_config_vars[cmd].str+1+
+                      strlen(ao_config_vars[cmd].str));
 }
 
 static void