DataFlash: avoid CLI functions on APM2 for copter

This commit is contained in:
Andrew Tridgell 2014-08-01 15:57:15 +10:00
parent a49d133d2a
commit 3fa30f91db
3 changed files with 13 additions and 1 deletions

View File

@ -14,6 +14,12 @@
#include <AP_AHRS.h>
#include <stdint.h>
#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);

View File

@ -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 {

View File

@ -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