mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 21:05:35 +03:00
Adding resource CLI command to see whats in use.
This commit is contained in:
parent
8b1cc05e1d
commit
cf6ca7293d
5 changed files with 60 additions and 11 deletions
|
@ -44,6 +44,8 @@
|
|||
#include "drivers/serial.h"
|
||||
#include "drivers/bus_i2c.h"
|
||||
#include "drivers/gpio.h"
|
||||
#include "drivers/io.h"
|
||||
#include "drivers/io_impl.h"
|
||||
#include "drivers/timer.h"
|
||||
#include "drivers/pwm_rx.h"
|
||||
#include "drivers/sdcard.h"
|
||||
|
@ -139,6 +141,7 @@ static void cliTasks(char *cmdline);
|
|||
#endif
|
||||
static void cliVersion(char *cmdline);
|
||||
static void cliRxRange(char *cmdline);
|
||||
static void cliResource(char *cmdline);
|
||||
|
||||
#ifdef GPS
|
||||
static void cliGpsPassthrough(char *cmdline);
|
||||
|
@ -298,6 +301,7 @@ const clicmd_t cmdTable[] = {
|
|||
CLI_COMMAND_DEF("profile", "change profile",
|
||||
"[<index>]", cliProfile),
|
||||
CLI_COMMAND_DEF("rateprofile", "change rate profile", "[<index>]", cliRateProfile),
|
||||
CLI_COMMAND_DEF("resource", "view currently used resources", NULL, cliResource),
|
||||
CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange),
|
||||
CLI_COMMAND_DEF("rxfail", "show/set rx failsafe settings", NULL, cliRxFail),
|
||||
CLI_COMMAND_DEF("save", "save and reboot", NULL, cliSave),
|
||||
|
@ -1860,6 +1864,10 @@ static void dumpValues(uint16_t valueSection)
|
|||
cliPrintf("set %s = ", valueTable[i].name);
|
||||
cliPrintVar(value, 0);
|
||||
cliPrint("\r\n");
|
||||
|
||||
#ifdef STM32F4
|
||||
delayMicroseconds(1000);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2993,6 +3001,48 @@ void cliProcess(void)
|
|||
}
|
||||
}
|
||||
|
||||
const char * const ownerNames[] = {
|
||||
"FREE",
|
||||
"PWM IN",
|
||||
"PPM IN",
|
||||
"MOTOR",
|
||||
"SERVO",
|
||||
"SOFTSERIAL RX",
|
||||
"SOFTSERIAL TX",
|
||||
"SOFTSERIAL RXTX", // bidirectional pin for softserial
|
||||
"SOFTSERIAL AUXTIMER", // timer channel is used for softserial. No IO function on pin
|
||||
"ADC",
|
||||
"SERIAL RX",
|
||||
"SERIAL TX",
|
||||
"SERIAL RXTX",
|
||||
"PINDEBUG",
|
||||
"TIMER",
|
||||
"SONAR",
|
||||
"SYSTEM",
|
||||
"SDCARD",
|
||||
"FLASH",
|
||||
"USB",
|
||||
"BEEPER",
|
||||
};
|
||||
|
||||
static void cliResource(char *cmdline)
|
||||
{
|
||||
UNUSED(cmdline);
|
||||
cliPrintf("IO:\r\n");
|
||||
for (unsigned i = 0; i < DEFIO_IO_USED_COUNT; i++) {
|
||||
const char* owner;
|
||||
char buff[15];
|
||||
if (ioRecs[i].owner < ARRAYLEN(ownerNames)) {
|
||||
owner = ownerNames[ioRecs[i].owner];
|
||||
}
|
||||
else {
|
||||
sprintf(buff, "O=%d", ioRecs[i].owner);
|
||||
owner = buff;
|
||||
}
|
||||
cliPrintf("%c%02d: %19s\r\n", IO_GPIOPortIdx(ioRecs + i) + 'A', IO_GPIOPinIdx(ioRecs + i), owner);
|
||||
}
|
||||
}
|
||||
|
||||
void cliInit(serialConfig_t *serialConfig)
|
||||
{
|
||||
UNUSED(serialConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue