mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
added printing detected sensors in 'status' in cli
took out leftovers of old dynamic mixer binary protocol - now cli sets it. added some mpu6050 DMP stuff - all disabled by default, only for testing stuff. ignore it. git-svn-id: https://afrodevices.googlecode.com/svn/trunk/baseflight@128 7c89a4a9-59b9-e629-4cfe-3a2d53b20e61
This commit is contained in:
parent
007e033364
commit
fd9d986169
10 changed files with 3332 additions and 2664 deletions
23
src/cli.c
23
src/cli.c
|
@ -39,6 +39,11 @@ const char *featureNames[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
// sync this with AvailableSensors enum from board.h
|
||||
const char *sensorNames[] = {
|
||||
"ACC", "BARO", "MAG", "SONAR", "GPS", NULL
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *param;
|
||||
|
@ -186,7 +191,7 @@ static void cliFeature(char *cmdline)
|
|||
uint8_t i;
|
||||
uint8_t len;
|
||||
uint32_t mask;
|
||||
|
||||
|
||||
len = strlen(cmdline);
|
||||
mask = featureMask();
|
||||
|
||||
|
@ -424,6 +429,9 @@ static void cliSet(char *cmdline)
|
|||
static void cliStatus(char *cmdline)
|
||||
{
|
||||
char buf[16];
|
||||
uint8_t i;
|
||||
uint32_t mask;
|
||||
|
||||
uartPrint("System Uptime: ");
|
||||
itoa(millis() / 1000, buf, 10);
|
||||
uartPrint(buf);
|
||||
|
@ -434,6 +442,19 @@ static void cliStatus(char *cmdline)
|
|||
itoa(batteryCellCount, buf, 10);
|
||||
uartPrint(buf);
|
||||
uartPrint("S battery)\r\n");
|
||||
|
||||
mask = sensorsMask();
|
||||
|
||||
uartPrint("Detected sensors: ");
|
||||
for (i = 0; ; i++) {
|
||||
if (sensorNames[i] == NULL)
|
||||
break;
|
||||
if (mask & (1 << i))
|
||||
uartPrint((char *)sensorNames[i]);
|
||||
uartWrite(' ');
|
||||
}
|
||||
uartPrint("\r\n");
|
||||
|
||||
uartPrint("Cycle Time: ");
|
||||
itoa(cycleTime, buf, 10);
|
||||
uartPrint(buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue