1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 03:50:02 +03:00

Renamed things to make them more understandable.

This commit is contained in:
mikeller 2019-07-22 00:46:59 +12:00
parent 2c8d197ccb
commit 35e075098d
6 changed files with 29 additions and 23 deletions

View file

@ -225,8 +225,10 @@ static bool processingCustomDefaults = false;
static char cliBufferTemp[CLI_IN_BUFFER_SIZE];
#endif
#if defined(USE_CUSTOM_DEFAULTS_ADDRESS)
static char __attribute__ ((section(".custom_defaults_address"))) *customDefaultsStart = CUSTOM_DEFAULTS_START;
static char __attribute__ ((section(".custom_defaults_address"))) *customDefaultsEnd = CUSTOM_DEFAULTS_END;
#endif
#ifndef USE_QUAD_MIXER_ONLY
// sync this with mixerMode_e
@ -4186,7 +4188,7 @@ static void cliDefaults(char *cmdline)
bool saveConfigs = true;
#if defined(USE_CUSTOM_DEFAULTS)
bool useCustomDefaults = true;
#else
#elif defined(USE_CUSTOM_DEFAULTS_ADDRESS)
// Required to keep the linker from eliminating these
if (customDefaultsStart != customDefaultsEnd) {
delay(0);
@ -4200,14 +4202,14 @@ static void cliDefaults(char *cmdline)
} else if (strncasecmp(cmdline, "bare", 4) == 0) {
useCustomDefaults = false;
} else if (strncasecmp(cmdline, "show", 4) == 0) {
char *ptr = customDefaultsStart;
if (isDefaults(ptr)) {
while (*ptr && ptr < customDefaultsEnd) {
if (*ptr != '\n') {
cliPrintf("%c", *ptr++);
char *customDefaultsPtr = customDefaultsStart;
if (isDefaults(customDefaultsPtr)) {
while (*customDefaultsPtr && *customDefaultsPtr != 0xFF && customDefaultsPtr < customDefaultsEnd) {
if (*customDefaultsPtr != '\n') {
cliPrintf("%c", *customDefaultsPtr++);
} else {
cliPrintLinefeed();
ptr++;
customDefaultsPtr++;
}
}
} else {
@ -6316,7 +6318,7 @@ static void cliHelp(char *cmdline)
}
}
static void processCommandCharacter(const char c)
static void processCharacter(const char c)
{
if (bufferIndex && (c == '\n' || c == '\r')) {
// enter pressed
@ -6375,7 +6377,7 @@ static void processCommandCharacter(const char c)
}
}
static void processCharacter(const char c)
static void processCharacterInteractive(const char c)
{
if (c == '\t' || c == '?') {
// do tab completion
@ -6429,7 +6431,7 @@ static void processCharacter(const char c)
cliPrint("\010 \010");
}
} else {
processCommandCharacter(c);
processCharacter(c);
}
}
@ -6445,7 +6447,7 @@ void cliProcess(void)
while (serialRxBytesWaiting(cliPort)) {
uint8_t c = serialRead(cliPort);
processCharacter(c);
processCharacterInteractive(c);
}
}
@ -6456,8 +6458,8 @@ void cliProcessCustomDefaults(void)
return;
}
char *ptr = customDefaultsStart;
if (isDefaults(ptr)) {
char *customDefaultsPtr = customDefaultsStart;
if (isDefaults(customDefaultsPtr)) {
#if !defined(DEBUG_CUSTOM_DEFAULTS)
bufWriter_t *cliWriterTemp = cliWriter;
cliWriter = NULL;
@ -6467,8 +6469,8 @@ void cliProcessCustomDefaults(void)
bufferIndex = 0;
processingCustomDefaults = true;
while (*ptr && *ptr != 0xFF && ptr < customDefaultsEnd) {
processCommandCharacter(*ptr++);
while (*customDefaultsPtr && *customDefaultsPtr != 0xFF && customDefaultsPtr < customDefaultsEnd) {
processCharacter(*customDefaultsPtr++);
}
processingCustomDefaults = false;