From 820e36f22763f9a0dc2fa2de74279e739e0f56f8 Mon Sep 17 00:00:00 2001 From: blckmn Date: Tue, 10 Jan 2017 11:38:16 +1100 Subject: [PATCH] Added define for turning on and off resource management and sensors --- src/main/fc/serial_cli.c | 33 +++++++++++++++------------------ src/main/target/common.h | 4 +++- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/main/fc/serial_cli.c b/src/main/fc/serial_cli.c index ed2b7b64a..426a41354 100755 --- a/src/main/fc/serial_cli.c +++ b/src/main/fc/serial_cli.c @@ -192,7 +192,7 @@ static const char * const lookupTableMagHardware[] = { }; #endif -#if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY) +#if defined(USE_SENSOR_NAMES) // sync this with sensors_e static const char * const sensorTypeNames[] = { "GYRO", "ACC", "BARO", "MAG", "SONAR", "GPS", "GPS+MAG", NULL @@ -206,7 +206,7 @@ static const char * const sensorHardwareNames[4][15] = { { "", "None", "BMP085", "MS5611", "BMP280", NULL }, { "", "None", "HMC5883", "AK8975", "AK8963", NULL } }; -#endif +#endif /* USE_SENSOR_NAMES */ static const char * const lookupTableOffOn[] = { "OFF", "ON" @@ -3186,7 +3186,7 @@ static void cliStatus(char *cmdline) cliPrintf("CPU Clock=%dMHz", (SystemCoreClock / 1000000)); -#if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY) +#if defined(USE_SENSOR_NAMES) const uint32_t detectedSensorsMask = sensorsMask(); for (uint32_t i = 0; ; i++) { if (sensorTypeNames[i] == NULL) { @@ -3202,7 +3202,7 @@ static void cliStatus(char *cmdline) } } } -#endif +#endif /* USE_SENSOR_NAMES */ cliPrint("\r\n"); #ifdef USE_SDCARD @@ -3304,7 +3304,7 @@ static void cliVersion(char *cmdline) ); } -#if (FLASH_SIZE > 64) +#if defined(USE_RESOURCE_MGMT) typedef struct { const uint8_t owner; @@ -3530,7 +3530,7 @@ static void cliResource(char *cmdline) cliShowParseError(); } -#endif +#endif /* USE_RESOURCE_MGMT */ static void printConfig(char *cmdline, bool doDiff) { @@ -3572,8 +3572,10 @@ static void printConfig(char *cmdline, bool doDiff) #endif printName(dumpMask); +#ifdef USE_RESOURCE_MGMT cliPrintHashLine("resources"); printResource(dumpMask, &defaultConfig); +#endif #ifndef USE_QUAD_MIXER_ONLY cliPrintHashLine("mixer"); @@ -3758,28 +3760,23 @@ const clicmd_t cmdTable[] = { #ifdef LED_STRIP CLI_COMMAND_DEF("led", "configure leds", NULL, cliLed), #endif - CLI_COMMAND_DEF("map", "configure rc channel order", - "[]", cliMap), + CLI_COMMAND_DEF("map", "configure rc channel order", "[]", cliMap), #ifndef USE_QUAD_MIXER_ONLY - CLI_COMMAND_DEF("mixer", "configure mixer", "list\r\n" - "\t", cliMixer), + CLI_COMMAND_DEF("mixer", "configure mixer", "list\r\n\t", cliMixer), #endif CLI_COMMAND_DEF("mmix", "custom motor mixer", NULL, cliMotorMix), #ifdef LED_STRIP CLI_COMMAND_DEF("mode_color", "configure mode and special colors", NULL, cliModeColor), #endif - CLI_COMMAND_DEF("motor", "get/set motor", - " []", cliMotor), + CLI_COMMAND_DEF("motor", "get/set motor", " []", cliMotor), CLI_COMMAND_DEF("name", "name of craft", NULL, cliName), #if (FLASH_SIZE > 128) - CLI_COMMAND_DEF("play_sound", NULL, - "[]", cliPlaySound), + CLI_COMMAND_DEF("play_sound", NULL, "[]", cliPlaySound), #endif - CLI_COMMAND_DEF("profile", "change profile", - "[]", cliProfile), + CLI_COMMAND_DEF("profile", "change profile", "[]", cliProfile), CLI_COMMAND_DEF("rateprofile", "change rate profile", "[]", cliRateProfile), -#if (FLASH_SIZE > 64) - CLI_COMMAND_DEF("resource", "view currently used resources", NULL, cliResource), +#if defined(USE_RESOURCE_MGMT) + CLI_COMMAND_DEF("resource", "show/set resources", NULL, cliResource), #endif CLI_COMMAND_DEF("rxfail", "show/set rx failsafe settings", NULL, cliRxFail), CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange), diff --git a/src/main/target/common.h b/src/main/target/common.h index bad1f1aa8..4b4aad256 100644 --- a/src/main/target/common.h +++ b/src/main/target/common.h @@ -59,7 +59,7 @@ #define SERIAL_RX #define USE_SERIALRX_CRSF // Team Black Sheep Crossfire protocol -#define USE_SERIALRX_SPEKTRUM // DSM2 and DSMX protocol +#define USE_SERIALRX_SPEKTRUM // SRXL, DSM2 and DSMX protocol #define USE_SERIALRX_SBUS // Frsky and Futaba receivers #define USE_SERIALRX_IBUS // FlySky and Turnigy receivers #define USE_SERIALRX_SUMD // Graupner Hott protocol @@ -89,6 +89,7 @@ #define TELEMETRY_LTM #define TELEMETRY_SMARTPORT #define USE_SERVOS +#define USE_RESOURCE_MGMT #endif #if (FLASH_SIZE > 128) @@ -104,6 +105,7 @@ #define USE_SERIALRX_JETIEXBUS #define VTX_CONTROL #define VTX_SMARTAUDIO +#define USE_SENSOR_NAMES #else #define SKIP_CLI_COMMAND_HELP #endif