1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 11:29:58 +03:00

removed dependency on sprintf which caused gcc to puke (shock and horror).

uses code from here:
66552ef8b0

git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@119 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
timecop 2012-03-17 15:08:05 +00:00
parent 2fc24b338e
commit c1cb4287b7
3 changed files with 2761 additions and 2777 deletions

View file

@ -161,21 +161,6 @@
<Bp> <Bp>
<Number>0</Number> <Number>0</Number>
<Type>0</Type> <Type>0</Type>
<LineNumber>309</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218890</Address>
<ByteObject>0</ByteObject>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename></Filename>
<ExecCommand></ExecCommand>
<Expression>\\baseflight\src/cli.c\309</Expression>
</Bp>
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>58</LineNumber> <LineNumber>58</LineNumber>
<EnabledFlag>1</EnabledFlag> <EnabledFlag>1</EnabledFlag>
<Address>134242932</Address> <Address>134242932</Address>
@ -188,21 +173,6 @@
<ExecCommand></ExecCommand> <ExecCommand></ExecCommand>
<Expression>\\baseflight\src/drv_mpu6050.c\58</Expression> <Expression>\\baseflight\src/drv_mpu6050.c\58</Expression>
</Bp> </Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>316</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134218956</Address>
<ByteObject>0</ByteObject>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename></Filename>
<ExecCommand></ExecCommand>
<Expression>\\baseflight\src/cli.c\316</Expression>
</Bp>
</Breakpoint> </Breakpoint>
<WatchWindow1> <WatchWindow1>
<Ww> <Ww>
@ -537,8 +507,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>296</TopLine> <TopLine>1</TopLine>
<CurrentLine>314</CurrentLine> <CurrentLine>1</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>.\src\cli.c</PathWithFileName> <PathWithFileName>.\src\cli.c</PathWithFileName>
<FilenameWithoutPath>cli.c</FilenameWithoutPath> <FilenameWithoutPath>cli.c</FilenameWithoutPath>
@ -549,10 +519,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>0</ColumnNumber> <ColumnNumber>31</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>91</TopLine> <TopLine>1</TopLine>
<CurrentLine>120</CurrentLine> <CurrentLine>11</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>.\src\config.c</PathWithFileName> <PathWithFileName>.\src\config.c</PathWithFileName>
<FilenameWithoutPath>config.c</FilenameWithoutPath> <FilenameWithoutPath>config.c</FilenameWithoutPath>
@ -782,8 +752,8 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>22</ColumnNumber> <ColumnNumber>22</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>85</TopLine> <TopLine>34</TopLine>
<CurrentLine>111</CurrentLine> <CurrentLine>46</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>.\src\drv_system.c</PathWithFileName> <PathWithFileName>.\src\drv_system.c</PathWithFileName>
<FilenameWithoutPath>drv_system.c</FilenameWithoutPath> <FilenameWithoutPath>drv_system.c</FilenameWithoutPath>

File diff suppressed because it is too large Load diff

View file

@ -86,6 +86,40 @@ const clivalue_t valueTable[] = {
static void cliSetVar(const clivalue_t *var, const int32_t value); static void cliSetVar(const clivalue_t *var, const int32_t value);
static void cliPrintVar(const clivalue_t *var); static void cliPrintVar(const clivalue_t *var);
/*
** The following two functions together make up an itoa()
** implementation. Function i2a() is a 'private' function
** called by the public itoa() function.
**
** itoa() takes three arguments:
** 1) the integer to be converted,
** 2) a pointer to a character conversion buffer,
** 3) the radix for the conversion
** which can range between 2 and 36 inclusive
** range errors on the radix default it to base10
** Code from http://groups.google.com/group/comp.lang.c/msg/66552ef8b04fe1ab?pli=1
*/
static char *i2a(unsigned i, char *a, unsigned r)
{
if (i / r > 0)
a = i2a(i / r, a, r);
*a = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"[i % r];
return a + 1;
}
char *itoa(int i, char *a, int r)
{
if ((r < 2) || (r > 36))
r = 10;
if (i < 0) {
*a = '-';
*i2a(-(unsigned)i, a + 1, r) = 0;
} else
*i2a(i, a, r) = 0;
return a;
}
static void cliPrompt(void) static void cliPrompt(void)
{ {
uartPrint("\r\n# "); uartPrint("\r\n# ");
@ -259,7 +293,7 @@ static void cliPrintVar(const clivalue_t *var)
value = *(int16_t *)var->ptr; value = *(int16_t *)var->ptr;
break; break;
} }
snprintf(buf, 16, "%d", value); itoa(value, buf, 10);
uartPrint(buf); uartPrint(buf);
} }