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

Minor CLI update to give a noreboot option so save and exit (#13904)

* Give a -n option to exit CLI

- means you can set any serial port to MSP, and then activate CLI on it using #, with an "exit -n" to return to MSP mode without a reboot required.
- https://webserial.io is a great utility for using CLI outside the configurator.
- future changes will include possible multiple CLIs being active at the same time, along with debug printf from anywhere in the code to an active debug cli.

* Altered to strcasecmp, and changed param required to noreboot

* Adding additional details to the commands
This commit is contained in:
J Blackman 2024-09-26 22:30:57 +10:00 committed by GitHub
parent 6b5b5cfbdb
commit 331801c7a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View file

@ -3594,6 +3594,9 @@ static void cliExit(const char *cmdName, char *cmdline)
cliMode = false;
// incase a motor was left running during motortest, clear it here
mixerResetDisarmedMotors();
if (strcasecmp(cmdline, "noreboot") == 0) {
return;
}
cliReboot();
}
@ -4250,6 +4253,9 @@ static void cliSave(const char *cmdName, char *cmdline)
writeEEPROM();
cliPrintHashLine("saving");
if (strcasecmp(cmdline, "noreboot") == 0) {
return;
}
cliReboot();
}
}
@ -6512,7 +6518,7 @@ const clicmd_t cmdTable[] = {
#ifdef USE_ESCSERIAL
CLI_COMMAND_DEF("escprog", "passthrough esc to serial", "<mode [sk/bl/ki/cc]> <index>", cliEscPassthrough),
#endif
CLI_COMMAND_DEF("exit", NULL, NULL, cliExit),
CLI_COMMAND_DEF("exit", "exit command line interface and reboot (default)", "[noreboot]", cliExit),
CLI_COMMAND_DEF("feature", "configure features",
"list\r\n"
"\t<->[name]", cliFeature),
@ -6571,7 +6577,7 @@ const clicmd_t cmdTable[] = {
#endif
CLI_COMMAND_DEF("rxfail", "show/set rx failsafe settings", NULL, cliRxFailsafe),
CLI_COMMAND_DEF("rxrange", "configure rx channel ranges", NULL, cliRxRange),
CLI_COMMAND_DEF("save", "save and reboot", NULL, cliSave),
CLI_COMMAND_DEF("save", "save and reboot (default)", "[noreboot]", cliSave),
#ifdef USE_SDCARD
CLI_COMMAND_DEF("sd_info", "sdcard info", NULL, cliSdInfo),
#endif
@ -6768,7 +6774,7 @@ static void processCharacterInteractive(const char c)
void cliProcess(void)
{
if (!cliWriter) {
if (!cliWriter || !cliMode) {
return;
}

View file

@ -476,6 +476,7 @@ static void mspProcessPendingRequest(mspPort_t * mspPort)
#endif
#ifdef USE_CLI
case MSP_PENDING_CLI:
mspPort->pendingRequest = MSP_PENDING_NONE;
cliEnter(mspPort->port);
break;
#endif