1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 04:45:24 +03:00

Added 'CLI_MINIMAL_VERBOSITY' option for reduced image size. Reenabled LED_STRIP for CC3D.

This commit is contained in:
mikeller 2016-08-13 21:24:16 +12:00 committed by Michael Keller
parent 14bdd9bacd
commit 287d398b13
3 changed files with 64 additions and 13 deletions

View file

@ -146,7 +146,7 @@ static void cliTasks(char *cmdline);
#endif #endif
static void cliVersion(char *cmdline); static void cliVersion(char *cmdline);
static void cliRxRange(char *cmdline); static void cliRxRange(char *cmdline);
#if (FLASH_SIZE > 64) #if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY)
static void cliResource(char *cmdline); static void cliResource(char *cmdline);
#endif #endif
#ifdef GPS #ifdef GPS
@ -231,7 +231,7 @@ static const rxFailsafeChannelMode_e rxFailsafeModesTable[RX_FAILSAFE_TYPE_COUNT
{ RX_FAILSAFE_MODE_INVALID, RX_FAILSAFE_MODE_HOLD, RX_FAILSAFE_MODE_SET } { RX_FAILSAFE_MODE_INVALID, RX_FAILSAFE_MODE_HOLD, RX_FAILSAFE_MODE_SET }
}; };
#if (FLASH_SIZE > 64) #if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY)
// sync this with sensors_e // sync this with sensors_e
static const char * const sensorTypeNames[] = { static const char * const sensorTypeNames[] = {
"GYRO", "ACC", "BARO", "MAG", "SONAR", "GPS", "GPS+MAG", NULL "GYRO", "ACC", "BARO", "MAG", "SONAR", "GPS", "GPS+MAG", NULL
@ -322,7 +322,7 @@ const clicmd_t cmdTable[] = {
CLI_COMMAND_DEF("profile", "change profile", CLI_COMMAND_DEF("profile", "change profile",
"[<index>]", cliProfile), "[<index>]", cliProfile),
CLI_COMMAND_DEF("rateprofile", "change rate profile", "[<index>]", cliRateProfile), CLI_COMMAND_DEF("rateprofile", "change rate profile", "[<index>]", cliRateProfile),
#if (FLASH_SIZE > 64) #if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY)
CLI_COMMAND_DEF("resource", "view currently used resources", NULL, cliResource), CLI_COMMAND_DEF("resource", "view currently used resources", NULL, cliResource),
#endif #endif
CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange), CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange),
@ -1446,7 +1446,9 @@ static void cliMotorMix(char *cmdline)
char *ptr; char *ptr;
if (isEmpty(cmdline)) { if (isEmpty(cmdline)) {
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("Motor\tThr\tRoll\tPitch\tYaw\r\n"); cliPrint("Motor\tThr\tRoll\tPitch\tYaw\r\n");
#endif
for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) { for (i = 0; i < MAX_SUPPORTED_MOTORS; i++) {
if (masterConfig.customMotorMixer[i].throttle == 0.0f) if (masterConfig.customMotorMixer[i].throttle == 0.0f)
break; break;
@ -1831,7 +1833,9 @@ static void cliServoMix(char *cmdline)
if (len == 0) { if (len == 0) {
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("Rule\tServo\tSource\tRate\tSpeed\tMin\tMax\tBox\r\n"); cliPrint("Rule\tServo\tSource\tRate\tSpeed\tMin\tMax\tBox\r\n");
#endif
for (i = 0; i < MAX_SERVO_RULES; i++) { for (i = 0; i < MAX_SERVO_RULES; i++) {
if (masterConfig.customServoMixer[i].rate == 0) if (masterConfig.customServoMixer[i].rate == 0)
@ -2320,18 +2324,24 @@ static void printConfig(char *cmdline, bool doDiff)
} }
if ((dumpMask & DUMP_MASTER) || (dumpMask & DUMP_ALL)) { if ((dumpMask & DUMP_MASTER) || (dumpMask & DUMP_ALL)) {
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# version\r\n"); cliPrint("\r\n# version\r\n");
#endif
cliVersion(NULL); cliVersion(NULL);
#ifndef CLI_MINIMAL_VERBOSITY
if ((dumpMask & (DUMP_ALL | DO_DIFF)) == (DUMP_ALL | DO_DIFF)) { if ((dumpMask & (DUMP_ALL | DO_DIFF)) == (DUMP_ALL | DO_DIFF)) {
cliPrint("\r\n# reset configuration to default settings\r\ndefaults\r\n"); cliPrint("\r\n# reset configuration to default settings\r\ndefaults\r\n");
} }
cliPrint("\r\n# name\r\n"); cliPrint("\r\n# name\r\n");
#endif
printName(dumpMask); printName(dumpMask);
cliPrint("\r\n# mixer\r\n");
#ifndef USE_QUAD_MIXER_ONLY #ifndef USE_QUAD_MIXER_ONLY
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# mixer\r\n");
#endif
cliDumpPrintf(dumpMask, COMPARE_CONFIG(mixerMode), "mixer %s\r\n", mixerNames[masterConfig.mixerMode - 1]); cliDumpPrintf(dumpMask, COMPARE_CONFIG(mixerMode), "mixer %s\r\n", mixerNames[masterConfig.mixerMode - 1]);
cliDumpPrintf(dumpMask, masterConfig.customMotorMixer[0].throttle == 0.0f, "mmix reset\r\n"); cliDumpPrintf(dumpMask, masterConfig.customMotorMixer[0].throttle == 0.0f, "mmix reset\r\n");
@ -2396,7 +2406,9 @@ static void printConfig(char *cmdline, bool doDiff)
#endif #endif
#endif #endif
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# feature\r\n"); cliPrint("\r\n# feature\r\n");
#endif
mask = featureMask(); mask = featureMask();
defaultMask = defaultConfig.enabledFeatures; defaultMask = defaultConfig.enabledFeatures;
@ -2413,7 +2425,9 @@ static void printConfig(char *cmdline, bool doDiff)
} }
#ifdef BEEPER #ifdef BEEPER
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# beeper\r\n"); cliPrint("\r\n# beeper\r\n");
#endif
uint8_t beeperCount = beeperTableEntryCount(); uint8_t beeperCount = beeperTableEntryCount();
mask = getBeeperOffMask(); mask = getBeeperOffMask();
defaultMask = defaultConfig.beeper_off_flags; defaultMask = defaultConfig.beeper_off_flags;
@ -2425,7 +2439,9 @@ static void printConfig(char *cmdline, bool doDiff)
} }
#endif #endif
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# map\r\n"); cliPrint("\r\n# map\r\n");
#endif
equalsDefault = true; equalsDefault = true;
for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) { for (i = 0; i < MAX_MAPPABLE_RX_INPUTS; i++) {
buf[masterConfig.rxConfig.rcmap[i]] = rcChannelLetters[i]; buf[masterConfig.rxConfig.rcmap[i]] = rcChannelLetters[i];
@ -2434,43 +2450,65 @@ static void printConfig(char *cmdline, bool doDiff)
buf[i] = '\0'; buf[i] = '\0';
cliDumpPrintf(dumpMask, equalsDefault, "map %s\r\n", buf); cliDumpPrintf(dumpMask, equalsDefault, "map %s\r\n", buf);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# serial\r\n"); cliPrint("\r\n# serial\r\n");
#endif
printSerial(dumpMask, &defaultConfig); printSerial(dumpMask, &defaultConfig);
#ifdef LED_STRIP #ifdef LED_STRIP
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# led\r\n"); cliPrint("\r\n# led\r\n");
#endif
printLed(dumpMask, &defaultConfig); printLed(dumpMask, &defaultConfig);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# color\r\n"); cliPrint("\r\n# color\r\n");
#endif
printColor(dumpMask, &defaultConfig); printColor(dumpMask, &defaultConfig);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# mode_color\r\n"); cliPrint("\r\n# mode_color\r\n");
#endif
printModeColor(dumpMask, &defaultConfig); printModeColor(dumpMask, &defaultConfig);
#endif #endif
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# aux\r\n"); cliPrint("\r\n# aux\r\n");
#endif
printAux(dumpMask, &defaultConfig); printAux(dumpMask, &defaultConfig);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# adjrange\r\n"); cliPrint("\r\n# adjrange\r\n");
#endif
printAdjustmentRange(dumpMask, &defaultConfig); printAdjustmentRange(dumpMask, &defaultConfig);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# rxrange\r\n"); cliPrint("\r\n# rxrange\r\n");
#endif
printRxRange(dumpMask, &defaultConfig); printRxRange(dumpMask, &defaultConfig);
#ifdef USE_SERVOS #ifdef USE_SERVOS
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# servo\r\n"); cliPrint("\r\n# servo\r\n");
#endif
printServo(dumpMask, &defaultConfig); printServo(dumpMask, &defaultConfig);
#endif #endif
#ifdef VTX #ifdef VTX
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# vtx\r\n"); cliPrint("\r\n# vtx\r\n");
#endif
printVtx(dumpMask, &defaultConfig); printVtx(dumpMask, &defaultConfig);
#endif #endif
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# rxfail\r\n"); cliPrint("\r\n# rxfail\r\n");
#endif
printRxFail(dumpMask, &defaultConfig); printRxFail(dumpMask, &defaultConfig);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# master\r\n"); cliPrint("\r\n# master\r\n");
#endif
dumpValues(MASTER_VALUE, dumpMask, &defaultConfig); dumpValues(MASTER_VALUE, dumpMask, &defaultConfig);
if (dumpMask & DUMP_ALL) { if (dumpMask & DUMP_ALL) {
@ -2484,16 +2522,20 @@ static void printConfig(char *cmdline, bool doDiff)
for (rateCount=0; rateCount<MAX_RATEPROFILES; rateCount++) for (rateCount=0; rateCount<MAX_RATEPROFILES; rateCount++)
cliDumpRateProfile(rateCount, dumpMask, &defaultConfig); cliDumpRateProfile(rateCount, dumpMask, &defaultConfig);
cliPrint("\r\n# restore original rateprofile selection\r\n");
changeControlRateProfile(currentRateIndex); changeControlRateProfile(currentRateIndex);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# restore original rateprofile selection\r\n");
cliRateProfile(""); cliRateProfile("");
#endif
} }
cliPrint("\r\n# restore original profile selection\r\n");
changeProfile(activeProfile); changeProfile(activeProfile);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# restore original profile selection\r\n");
cliProfile(""); cliProfile("");
cliPrint("\r\n# save configuration\r\nsave\r\n"); cliPrint("\r\n# save configuration\r\nsave\r\n");
#endif
} else { } else {
cliDumpProfile(masterConfig.current_profile_index, dumpMask, &defaultConfig); cliDumpProfile(masterConfig.current_profile_index, dumpMask, &defaultConfig);
cliDumpRateProfile(currentProfile->activeRateProfile, dumpMask, &defaultConfig); cliDumpRateProfile(currentProfile->activeRateProfile, dumpMask, &defaultConfig);
@ -2514,7 +2556,9 @@ static void cliDumpProfile(uint8_t profileIndex, uint8_t dumpMask, master_t *def
if (profileIndex >= MAX_PROFILE_COUNT) // Faulty values if (profileIndex >= MAX_PROFILE_COUNT) // Faulty values
return; return;
changeProfile(profileIndex); changeProfile(profileIndex);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# profile\r\n"); cliPrint("\r\n# profile\r\n");
#endif
cliProfile(""); cliProfile("");
dumpValues(PROFILE_VALUE, dumpMask, defaultConfig); dumpValues(PROFILE_VALUE, dumpMask, defaultConfig);
} }
@ -2524,7 +2568,9 @@ static void cliDumpRateProfile(uint8_t rateProfileIndex, uint8_t dumpMask, maste
if (rateProfileIndex >= MAX_RATEPROFILES) // Faulty values if (rateProfileIndex >= MAX_RATEPROFILES) // Faulty values
return; return;
changeControlRateProfile(rateProfileIndex); changeControlRateProfile(rateProfileIndex);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\n# rateprofile\r\n"); cliPrint("\r\n# rateprofile\r\n");
#endif
cliRateProfile(""); cliRateProfile("");
dumpValues(PROFILE_RATE_VALUE, dumpMask, defaultConfig); dumpValues(PROFILE_RATE_VALUE, dumpMask, defaultConfig);
} }
@ -2537,7 +2583,9 @@ void cliEnter(serialPort_t *serialPort)
cliWriter = bufWriterInit(cliWriteBuffer, sizeof(cliWriteBuffer), cliWriter = bufWriterInit(cliWriteBuffer, sizeof(cliWriteBuffer),
(bufWrite_t)serialWriteBufShim, serialPort); (bufWrite_t)serialWriteBufShim, serialPort);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\nEntering CLI Mode, type 'exit' to return, or 'help'\r\n"); cliPrint("\r\nEntering CLI Mode, type 'exit' to return, or 'help'\r\n");
#endif
cliPrompt(); cliPrompt();
ENABLE_ARMING_FLAG(PREVENT_ARMING); ENABLE_ARMING_FLAG(PREVENT_ARMING);
} }
@ -2546,7 +2594,9 @@ static void cliExit(char *cmdline)
{ {
UNUSED(cmdline); UNUSED(cmdline);
#ifndef CLI_MINIMAL_VERBOSITY
cliPrint("\r\nLeaving CLI mode, unsaved changes lost.\r\n"); cliPrint("\r\nLeaving CLI mode, unsaved changes lost.\r\n");
#endif
bufWriterFlush(cliWriter); bufWriterFlush(cliWriter);
*cliBuffer = '\0'; *cliBuffer = '\0';
@ -2842,7 +2892,7 @@ static void cliMotor(char *cmdline)
static void cliPlaySound(char *cmdline) static void cliPlaySound(char *cmdline)
{ {
#if FLASH_SIZE <= 64 #if (FLASH_SIZE <= 64) && !defined(CLI_MINIMAL_VERBOSITY)
UNUSED(cmdline); UNUSED(cmdline);
#else #else
int i; int i;
@ -2934,7 +2984,6 @@ static void cliSave(char *cmdline)
UNUSED(cmdline); UNUSED(cmdline);
cliPrint("Saving"); cliPrint("Saving");
//copyCurrentProfileToProfileSlot(masterConfig.current_profile_index);
writeEEPROM(); writeEEPROM();
cliReboot(); cliReboot();
} }
@ -3241,7 +3290,7 @@ static void cliStatus(char *cmdline)
cliPrintf("CPU Clock=%dMHz", (SystemCoreClock / 1000000)); cliPrintf("CPU Clock=%dMHz", (SystemCoreClock / 1000000));
#if (FLASH_SIZE > 64) #if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY)
uint8_t i; uint8_t i;
uint32_t mask; uint32_t mask;
uint32_t detectedSensorsMask = sensorsMask(); uint32_t detectedSensorsMask = sensorsMask();
@ -3287,7 +3336,9 @@ static void cliTasks(char *cmdline)
int maxLoadSum = 0; int maxLoadSum = 0;
int averageLoadSum = 0; int averageLoadSum = 0;
#ifndef CLI_MINIMAL_VERBOSITY
cliPrintf("Task list rate/hz max/us avg/us maxload avgload total/ms\r\n"); cliPrintf("Task list rate/hz max/us avg/us maxload avgload total/ms\r\n");
#endif
for (cfTaskId_e taskId = 0; taskId < TASK_COUNT; taskId++) { for (cfTaskId_e taskId = 0; taskId < TASK_COUNT; taskId++) {
cfTaskInfo_t taskInfo; cfTaskInfo_t taskInfo;
getTaskInfo(taskId, &taskInfo); getTaskInfo(taskId, &taskInfo);
@ -3448,7 +3499,7 @@ void cliProcess(void)
} }
} }
#if (FLASH_SIZE > 64) #if (FLASH_SIZE > 64) && !defined(CLI_MINIMAL_VERBOSITY)
static void cliResource(char *cmdline) static void cliResource(char *cmdline)
{ {
UNUSED(cmdline); UNUSED(cmdline);

View file

@ -91,7 +91,7 @@
#define VBAT_ADC_PIN PA0 #define VBAT_ADC_PIN PA0
#define RSSI_ADC_PIN PB0 #define RSSI_ADC_PIN PB0
//#define LED_STRIP #define LED_STRIP
#define WS2811_PIN PB4 #define WS2811_PIN PB4
#define WS2811_TIMER TIM3 #define WS2811_TIMER TIM3
#define WS2811_DMA_TC_FLAG DMA1_FLAG_TC6 #define WS2811_DMA_TC_FLAG DMA1_FLAG_TC6
@ -108,15 +108,16 @@
//#define SONAR_TRIGGER_PIN PB5 //#define SONAR_TRIGGER_PIN PB5
#undef GPS #undef GPS
#define CLI_MINIMAL_VERBOSITY
#ifdef CC3D_OPBL #ifdef CC3D_OPBL
#undef LED_STRIP
#define SKIP_CLI_COMMAND_HELP #define SKIP_CLI_COMMAND_HELP
#define SKIP_PID_FLOAT #define SKIP_PID_FLOAT
#undef BARO #undef BARO
#undef MAG #undef MAG
#undef SONAR #undef SONAR
#undef USE_SOFTSERIAL1 #undef USE_SOFTSERIAL1
#undef LED_STRIP
#endif #endif
#define DEFAULT_RX_FEATURE FEATURE_RX_PPM #define DEFAULT_RX_FEATURE FEATURE_RX_PPM

View file

@ -143,7 +143,6 @@
#define RSSI_ADC_PIN PA1 #define RSSI_ADC_PIN PA1
#define EXTERNAL1_ADC_PIN PA5 #define EXTERNAL1_ADC_PIN PA5
#define LED_STRIP #define LED_STRIP
#define WS2811_TIMER TIM3 #define WS2811_TIMER TIM3
#define WS2811_PIN PA6 #define WS2811_PIN PA6