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

Rebased on to master

This commit is contained in:
jflyper 2017-05-07 22:26:47 +09:00
commit 4b80bceb1f
288 changed files with 5099 additions and 2801 deletions

View file

@ -189,7 +189,7 @@ static void cliPrint(const char *str)
bufWriterFlush(cliWriter);
}
static void cliPrintBlankLine()
static void cliPrintLinefeed()
{
cliPrint("\r\n");
}
@ -197,7 +197,7 @@ static void cliPrintBlankLine()
static void cliPrintLine(const char *str)
{
cliPrint(str);
cliPrintBlankLine();
cliPrintLinefeed();
}
#ifdef MINIMAL_CLI
@ -235,7 +235,7 @@ static void cliPrintLinefva(const char *format, va_list va)
{
tfp_format(cliWriter, cliPutp, format, va);
bufWriterFlush(cliWriter);
cliPrintBlankLine();
cliPrintLinefeed();
}
static bool cliDumpPrintLinef(uint8_t dumpMask, bool equalsDefault, const char *format, ...)
@ -378,11 +378,11 @@ static void dumpPgValue(const clivalue_t *value, uint8_t dumpMask)
if (dumpMask & SHOW_DEFAULTS && !equalsDefault) {
cliPrintf(defaultFormat, value->name);
printValuePointer(value, (uint8_t*)pg->address + valueOffset, 0);
cliPrintBlankLine();
cliPrintLinefeed();
}
cliPrintf(format, value->name);
printValuePointer(value, (uint8_t*)pg->copy + valueOffset, 0);
cliPrintBlankLine();
cliPrintLinefeed();
}
}
@ -419,7 +419,7 @@ static void cliPrintVarRange(const clivalue_t *var)
cliPrint(",");
cliPrintf(" %s", tableEntry->values[i]);
}
cliPrintBlankLine();
cliPrintLinefeed();
}
break;
}
@ -451,7 +451,7 @@ static void cliRepeat(char ch, uint8_t len)
for (int i = 0; i < len; i++) {
bufWriterAppend(cliWriter, ch);
}
cliPrintBlankLine();
cliPrintLinefeed();
}
#endif
@ -780,30 +780,30 @@ static void cliSerial(char *cmdline)
}
switch(i) {
case 0:
if (baudRateIndex < BAUD_9600 || baudRateIndex > BAUD_1000000) {
continue;
}
portConfig.msp_baudrateIndex = baudRateIndex;
break;
case 1:
if (baudRateIndex < BAUD_9600 || baudRateIndex > BAUD_115200) {
continue;
}
portConfig.gps_baudrateIndex = baudRateIndex;
break;
case 2:
if (baudRateIndex != BAUD_AUTO && baudRateIndex > BAUD_115200) {
continue;
}
portConfig.telemetry_baudrateIndex = baudRateIndex;
break;
case 3:
if (baudRateIndex < BAUD_19200 || baudRateIndex > BAUD_250000) {
continue;
}
portConfig.blackbox_baudrateIndex = baudRateIndex;
break;
case 0:
if (baudRateIndex < BAUD_9600 || baudRateIndex > BAUD_1000000) {
continue;
}
portConfig.msp_baudrateIndex = baudRateIndex;
break;
case 1:
if (baudRateIndex < BAUD_9600 || baudRateIndex > BAUD_115200) {
continue;
}
portConfig.gps_baudrateIndex = baudRateIndex;
break;
case 2:
if (baudRateIndex != BAUD_AUTO && baudRateIndex > BAUD_115200) {
continue;
}
portConfig.telemetry_baudrateIndex = baudRateIndex;
break;
case 3:
if (baudRateIndex < BAUD_19200 || baudRateIndex > BAUD_2470000) {
continue;
}
portConfig.blackbox_baudrateIndex = baudRateIndex;
break;
}
validArgumentCount++;
@ -994,7 +994,7 @@ static void cliAdjustmentRange(char *cmdline)
static void printMotorMix(uint8_t dumpMask, const motorMixer_t *customMotorMixer, const motorMixer_t *defaultCustomMotorMixer)
{
const char *format = "mmix %d %s %s %s %s";
char buf0[8];
char buf0[FTOA_BUFFER_LENGTH];
char buf1[FTOA_BUFFER_LENGTH];
char buf2[FTOA_BUFFER_LENGTH];
char buf3[FTOA_BUFFER_LENGTH];
@ -1485,7 +1485,7 @@ static void printServoMix(uint8_t dumpMask, const servoMixer_t *customServoMixer
);
}
cliPrintBlankLine();
cliPrintLinefeed();
}
static void cliServoMix(char *cmdline)
@ -1527,13 +1527,13 @@ static void cliServoMix(char *cmdline)
cliPrintf("s");
for (uint32_t inputSource = 0; inputSource < INPUT_SOURCE_COUNT; inputSource++)
cliPrintf("\ti%d", inputSource);
cliPrintBlankLine();
cliPrintLinefeed();
for (uint32_t servoIndex = 0; servoIndex < MAX_SUPPORTED_SERVOS; servoIndex++) {
cliPrintf("%d", servoIndex);
for (uint32_t inputSource = 0; inputSource < INPUT_SOURCE_COUNT; inputSource++)
cliPrintf("\t%s ", (servoParams(servoIndex)->reversedSources & (1 << inputSource)) ? "r" : "n");
cliPrintBlankLine();
cliPrintLinefeed();
}
return;
}
@ -1666,7 +1666,7 @@ static void cliSdInfo(char *cmdline)
}
break;
}
cliPrintBlankLine();
cliPrintLinefeed();
}
#endif
@ -1703,7 +1703,7 @@ static void cliFlashErase(char *cmdline)
cliPrintf(".");
if (i++ > 120) {
i=0;
cliPrintBlankLine();
cliPrintLinefeed();
}
bufWriterFlush(cliWriter);
@ -1711,7 +1711,7 @@ static void cliFlashErase(char *cmdline)
delay(100);
}
beeper(BEEPER_BLACKBOX_ERASE);
cliPrintBlankLine();
cliPrintLinefeed();
cliPrintLine("Done.");
}
@ -1762,7 +1762,7 @@ static void cliFlashRead(char *cmdline)
break;
}
}
cliPrintBlankLine();
cliPrintLinefeed();
}
}
@ -1913,7 +1913,7 @@ static void cliFeature(char *cmdline)
if (mask & (1 << i))
cliPrintf("%s ", featureNames[i]);
}
cliPrintBlankLine();
cliPrintLinefeed();
} else if (strncasecmp(cmdline, "list", len) == 0) {
cliPrint("Available:");
for (uint32_t i = 0; ; i++) {
@ -1921,7 +1921,7 @@ static void cliFeature(char *cmdline)
break;
cliPrintf(" %s", featureNames[i]);
}
cliPrintBlankLine();
cliPrintLinefeed();
return;
} else {
bool remove = false;
@ -1998,12 +1998,12 @@ static void cliBeeper(char *cmdline)
if (mask & (1 << i))
cliPrintf(" %s", beeperNameForTableIndex(i));
}
cliPrintBlankLine();
cliPrintLinefeed();
} else if (strncasecmp(cmdline, "list", len) == 0) {
cliPrint("Available:");
for (uint32_t i = 0; i < beeperCount; i++)
cliPrintf(" %s", beeperNameForTableIndex(i));
cliPrintBlankLine();
cliPrintLinefeed();
return;
} else {
bool remove = false;
@ -2308,7 +2308,7 @@ static void cliMixer(char *cmdline)
break;
cliPrintf(" %s", mixerNames[i]);
}
cliPrintBlankLine();
cliPrintLinefeed();
return;
}
@ -2443,7 +2443,7 @@ static void cliDumpPidProfile(uint8_t pidProfileIndex, uint8_t dumpMask)
changePidProfile(pidProfileIndex);
cliPrintHashLine("profile");
cliProfile("");
cliPrintBlankLine();
cliPrintLinefeed();
dumpAllValues(PROFILE_VALUE, dumpMask);
}
@ -2456,7 +2456,7 @@ static void cliDumpRateProfile(uint8_t rateProfileIndex, uint8_t dumpMask)
changeControlRateProfile(rateProfileIndex);
cliPrintHashLine("rateprofile");
cliRateProfile("");
cliPrintBlankLine();
cliPrintLinefeed();
dumpAllValues(PROFILE_RATE_VALUE, dumpMask);
}
@ -2488,9 +2488,9 @@ static void cliGet(char *cmdline)
val = &valueTable[i];
cliPrintf("%s = ", valueTable[i].name);
cliPrintVar(val, 0);
cliPrintBlankLine();
cliPrintLinefeed();
cliPrintVarRange(val);
cliPrintBlankLine();
cliPrintLinefeed();
matchedCommands++;
}
@ -2518,7 +2518,7 @@ static void cliSet(char *cmdline)
val = &valueTable[i];
cliPrintf("%s = ", valueTable[i].name);
cliPrintVar(val, len); // when len is 1 (when * is passed as argument), it will print min/max values as well, for gui
cliPrintBlankLine();
cliPrintLinefeed();
}
} else if ((eqptr = strstr(cmdline, "=")) != NULL) {
// has equals
@ -2612,7 +2612,7 @@ static void cliStatus(char *cmdline)
}
}
#endif /* USE_SENSOR_NAMES */
cliPrintBlankLine();
cliPrintLinefeed();
#ifdef USE_SDCARD
cliSdInfo(NULL);
@ -2776,7 +2776,7 @@ static void printResource(uint8_t dumpMask)
const ioTag_t ioTagDefault = *((const ioTag_t *)defaultConfig + resourceTable[i].offset + index);
bool equalsDefault = ioTag == ioTagDefault;
const char *format = "resource %s %d %c%02dn";
const char *format = "resource %s %d %c%02d";
const char *formatUnassigned = "resource %s %d NONE";
if (!ioTagDefault) {
cliDefaultPrintLinef(dumpMask, equalsDefault, formatUnassigned, owner, RESOURCE_INDEX(index));
@ -2858,15 +2858,15 @@ static void cliResource(char *cmdline)
const char* owner;
owner = ownerNames[ioRecs[i].owner];
cliPrintf("%c%02d: %s ", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner);
cliPrintf("%c%02d: %s", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner);
if (ioRecs[i].index > 0) {
cliPrintf("%d", ioRecs[i].index);
cliPrintf(" %d", ioRecs[i].index);
}
cliPrintLine("\r\n");
cliPrintLinefeed();
}
cliPrintLine("\r\n");
cliPrintLine("\r\n");
cliPrintLinefeed();
#ifdef MINIMAL_CLI
cliPrintLine("DMA:");
#else
@ -3028,7 +3028,7 @@ static void printConfig(char *cmdline, bool doDiff)
if ((dumpMask & (DUMP_ALL | DO_DIFF)) == (DUMP_ALL | DO_DIFF)) {
cliPrintHashLine("reset configuration to default settings");
cliPrint("defaults");
cliPrintBlankLine();
cliPrintLinefeed();
}
cliPrintHashLine("name");
@ -3284,7 +3284,7 @@ static void cliHelp(char *cmdline)
cliPrintf("\r\n\t%s", cmdTable[i].args);
}
#endif
cliPrintBlankLine();
cliPrintLinefeed();
}
}
@ -3344,7 +3344,7 @@ void cliProcess(void)
cliPrompt();
} else if (bufferIndex && (c == '\n' || c == '\r')) {
// enter pressed
cliPrintBlankLine();
cliPrintLinefeed();
// Strip comment starting with # from line
char *p = cliBuffer;