mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-16 12:55:19 +03:00
Runtime ESC count / gpio / pin detection
Runtime ESC gpio/pin detection Runtime ESC count detection
This commit is contained in:
parent
621008cffc
commit
02b297afa7
13 changed files with 120 additions and 56 deletions
|
@ -149,7 +149,7 @@ static void cliFlashRead(char *cmdline);
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_SERIAL_1WIRE
|
||||
#ifdef USE_SERIAL_1WIRE_CLI
|
||||
static void cliUSB1Wire(char *cmdline);
|
||||
#endif
|
||||
|
||||
|
@ -234,7 +234,7 @@ typedef struct {
|
|||
|
||||
// should be sorted a..z for bsearch()
|
||||
const clicmd_t cmdTable[] = {
|
||||
#ifdef USE_SERIAL_1WIRE
|
||||
#ifdef USE_SERIAL_1WIRE_CLI
|
||||
CLI_COMMAND_DEF("1wire", "1-wire interface to escs", "<esc index>", cliUSB1Wire),
|
||||
#endif
|
||||
CLI_COMMAND_DEF("adjrange", "configure adjustment ranges", NULL, cliAdjustmentRange),
|
||||
|
@ -2195,25 +2195,26 @@ static void cliStatus(char *cmdline)
|
|||
printf("Cycle Time: %d, I2C Errors: %d, config size: %d\r\n", cycleTime, i2cErrorCounter, sizeof(master_t));
|
||||
}
|
||||
|
||||
#ifdef USE_SERIAL_1WIRE
|
||||
#ifdef USE_SERIAL_1WIRE_CLI
|
||||
static void cliUSB1Wire(char *cmdline)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (isEmpty(cmdline)) {
|
||||
cliPrint("Please specify a ouput channel. e.g. `1wire 2` to connect to motor 2\r\n");
|
||||
return;
|
||||
} else {
|
||||
usb1WireInitialize(); // init ESC outputs and get escCount value
|
||||
int i;
|
||||
i = atoi(cmdline);
|
||||
if (i >= 0 && i <= ESC_COUNT) {
|
||||
if (i >= 0 && i <= escCount) {
|
||||
printf("Switching to BlHeli mode on motor port %d\r\n", i);
|
||||
// motor 1 => index 0
|
||||
usb1WirePassthrough(i-1);
|
||||
}
|
||||
else {
|
||||
printf("Invalid motor port, valid range: 1 to %d\r\n", ESC_COUNT);
|
||||
printf("Invalid motor port, valid range: 1 to %d\r\n", escCount);
|
||||
// cliReboot();
|
||||
}
|
||||
}
|
||||
// motor 1 => index 0
|
||||
usb1WirePassthrough(i-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue