From 3fa30f91db123877dc1f91a6b67633bda7172b19 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 1 Aug 2014 15:57:15 +1000 Subject: [PATCH] DataFlash: avoid CLI functions on APM2 for copter --- libraries/DataFlash/DataFlash.h | 8 ++++++++ libraries/DataFlash/DataFlash_Block.h | 4 +++- libraries/DataFlash/LogFile.cpp | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libraries/DataFlash/DataFlash.h b/libraries/DataFlash/DataFlash.h index 769fa9e1da..454c52c0ae 100644 --- a/libraries/DataFlash/DataFlash.h +++ b/libraries/DataFlash/DataFlash.h @@ -14,6 +14,12 @@ #include #include +#if HAL_CPU_CLASS < HAL_CPU_CLASS_75 && defined(APM_BUILD_DIRECTORY) + #if (APM_BUILD_TYPE(APM_BUILD_ArduCopter) || defined(__AVR_ATmega1280__)) + #define DATAFLASH_NO_CLI + #endif +#endif + class DataFlash_Class { public: @@ -34,6 +40,7 @@ public: virtual void get_log_info(uint16_t log_num, uint32_t &size, uint32_t &time_utc) = 0; virtual int16_t get_log_data(uint16_t log_num, uint16_t page, uint32_t offset, uint16_t len, uint8_t *data) = 0; virtual uint16_t get_num_logs(void) = 0; +#ifndef DATAFLASH_NO_CLI virtual void LogReadProcess(uint16_t log_num, uint16_t start_page, uint16_t end_page, void (*printMode)(AP_HAL::BetterStream *port, uint8_t mode), @@ -41,6 +48,7 @@ public: virtual void DumpPageInfo(AP_HAL::BetterStream *port) = 0; virtual void ShowDeviceInfo(AP_HAL::BetterStream *port) = 0; virtual void ListAvailableLogs(AP_HAL::BetterStream *port) = 0; +#endif // DATAFLASH_NO_CLI /* logging methods common to all vehicles */ uint16_t StartNewLog(void); diff --git a/libraries/DataFlash/DataFlash_Block.h b/libraries/DataFlash/DataFlash_Block.h index 8a40f5f441..9378dd14ff 100644 --- a/libraries/DataFlash/DataFlash_Block.h +++ b/libraries/DataFlash/DataFlash_Block.h @@ -31,13 +31,15 @@ public: int16_t get_log_data(uint16_t log_num, uint16_t page, uint32_t offset, uint16_t len, uint8_t *data); uint16_t get_num_logs(void); uint16_t start_new_log(void); +#ifndef DATAFLASH_NO_CLI void LogReadProcess(uint16_t log_num, uint16_t start_page, uint16_t end_page, void (*print_mode)(AP_HAL::BetterStream *port, uint8_t mode), AP_HAL::BetterStream *port); void DumpPageInfo(AP_HAL::BetterStream *port); void ShowDeviceInfo(AP_HAL::BetterStream *port); - void ListAvailableLogs(AP_HAL::BetterStream *port); + void ListAvailableLogs(AP_HAL::BetterStream *port) +#endif private: struct PageHeader { diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index 6dc0d0e901..96500451fd 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -274,6 +274,7 @@ uint16_t DataFlash_Block::find_last_page_of_log(uint16_t log_number) #define PGM_UINT8(addr) pgm_read_byte((const prog_char *)addr) +#ifndef DATAFLASH_NO_CLI /* read and print a log entry using the format strings from the given structure */ @@ -556,6 +557,7 @@ void DataFlash_Block::ListAvailableLogs(AP_HAL::BetterStream *port) } port->println(); } +#endif // DATAFLASH_NO_CLI // This function starts a new log file in the DataFlash, and writes // the format of supported messages in the log, plus all parameters