1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

committed (untested) GPS support by sbaron;

fix for channel map cli stuff by simonk.
reindented some code, so changes are large.

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@127 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop 2012-03-24 09:27:40 +00:00
parent 0534444b2d
commit 007e033364
10 changed files with 3046 additions and 2475 deletions

View file

@ -35,7 +35,7 @@ const char *mixerNames[] = {
// sync this with AvailableFeatures enum from board.h
const char *featureNames[] = {
"PPM", "VBAT", "INFLIGHT_ACC_CAL", "DIGITAL_SERVO", "MOTOR_STOP",
"SERVO_TILT", "CAMTRIG", "GYRO_SMOOTHING", "LED_RING",
"SERVO_TILT", "CAMTRIG", "GYRO_SMOOTHING", "LED_RING", "GPS",
NULL
};
@ -51,7 +51,7 @@ const clicmd_t cmdTable[] = {
{ "exit", "", cliExit },
{ "feature", "list or -val or val", cliFeature },
{ "help", "", cliHelp },
{ "map", "mapping of first 4 channels", cliMap },
{ "map", "mapping of rc channel order", cliMap },
{ "mixer", "mixer name or list", cliMixer },
{ "save", "save and reboot", cliSave },
{ "set", "name=value or blank for list", cliSet },
@ -113,6 +113,8 @@ const clivalue_t valueTable[] = {
static void cliSetVar(const clivalue_t *var, const int32_t value);
static void cliPrintVar(const clivalue_t *var);
#ifndef HAVE_ITOA_FUNCTION
/*
** The following two functions together make up an itoa()
** implementation. Function i2a() is a 'private' function
@ -147,6 +149,8 @@ char *itoa(int i, char *a, int r)
return a;
}
#endif
static void cliPrompt(void)
{
uartPrint("\r\n# ");
@ -255,35 +259,27 @@ static void cliMap(char *cmdline)
uint8_t len;
uint8_t i;
char out[9];
len = strlen(cmdline);
if (len == 0 || len != 8) {
uartPrint("Current assignment: ");
for (i = 0; i < 8; i++)
out[cfg.rcmap[i]] = rcChannelLetters[i];
out[i] = '\0';
uartPrint(out);
uartPrint("\r\n");
return;
} else {
bool fail = false;
if (len == 8) {
// uppercase it
for (i = 0; i < 8; i++) {
for (i = 0; i < 8; i++)
cmdline[i] = toupper(cmdline[i]);
if (!strchr(rcChannelLetters, cmdline[i])) {
fail = true;
break;
}
}
if (fail)
for (i = 0; i < 8; i++) {
if (strchr(rcChannelLetters, cmdline[i]) && !strchr(cmdline + i + 1, cmdline[i]))
continue;
uartPrint("Must be any order of AETR1234\r\n");
else {
parseRcChannels(cmdline);
cliMap("");
return;
}
parseRcChannels(cmdline);
}
uartPrint("Current assignment: ");
for (i = 0; i < 8; i++)
out[cfg.rcmap[i]] = rcChannelLetters[i];
out[i] = '\0';
uartPrint(out);
uartPrint("\r\n");
}
static void cliMixer(char *cmdline)