From e1b998f011215de4e184b54379f4493e93a080a3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 13 Mar 2015 22:40:06 +1100 Subject: [PATCH] Rover: disable CLI on APM2 by default saves lots of flash. This is also consistent with plane and copter --- APMrover2/Log.pde | 21 ++++++++++++++------- APMrover2/config.h | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/APMrover2/Log.pde b/APMrover2/Log.pde index 325ea55b52..c4b53c0ed2 100644 --- a/APMrover2/Log.pde +++ b/APMrover2/Log.pde @@ -2,6 +2,8 @@ #if LOGGING_ENABLED == ENABLED +#if CLI_ENABLED == ENABLED + // Code to Write and Read packets from DataFlash log memory // Code to interact with the user to dump or erase logs @@ -93,13 +95,6 @@ dump_log(uint8_t argc, const Menu::arg *argv) } -static void do_erase_logs(void) -{ - cliSerial->printf_P(PSTR("\nErasing log...\n")); - DataFlash.EraseAll(); - cliSerial->printf_P(PSTR("\nLog erased.\n")); -} - static int8_t erase_logs(uint8_t argc, const Menu::arg *argv) { @@ -163,6 +158,16 @@ process_logs(uint8_t argc, const Menu::arg *argv) return 0; } +#endif // CLI_ENABLED == ENABLED + +static void do_erase_logs(void) +{ + cliSerial->printf_P(PSTR("\nErasing log...\n")); + DataFlash.EraseAll(); + cliSerial->printf_P(PSTR("\nLog erased.\n")); +} + + struct PACKED log_Performance { LOG_PACKET_HEADER; uint32_t time_ms; @@ -386,6 +391,7 @@ static const struct LogStructure log_structure[] PROGMEM = { }; +#if CLI_ENABLED == ENABLED // Read the DataFlash log memory : Packet Parser static void Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page) { @@ -399,6 +405,7 @@ static void Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page) print_mode, cliSerial); } +#endif // CLI_ENABLED // start a new log static void start_logging() diff --git a/APMrover2/config.h b/APMrover2/config.h index c8c94189fa..5643ec3bbd 100644 --- a/APMrover2/config.h +++ b/APMrover2/config.h @@ -324,7 +324,11 @@ // use this to completely disable the CLI #ifndef CLI_ENABLED +#if HAL_CPU_CLASS > HAL_CPU_CLASS_16 # define CLI_ENABLED ENABLED +#else +# define CLI_ENABLED DISABLED +#endif #endif // if RESET_SWITCH_CH is not zero, then this is the PWM value on