From 8ed45bce36b9ed5c5f3b16922e0a9af027d302d2 Mon Sep 17 00:00:00 2001 From: Dominic Clifton Date: Sat, 8 Nov 2014 01:58:35 +0000 Subject: [PATCH] cli `exit` command now reboots without saving. This also prevents excessive wear to the eeprom/flash and makes it the difference between `save` obvious. Fixes #146 --- src/main/io/serial_cli.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index 23f71a8818..43044ef172 100644 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -90,6 +90,7 @@ static void cliMixer(char *cmdline); static void cliMotor(char *cmdline); static void cliProfile(char *cmdline); static void cliRateProfile(char *cmdline); +static void cliReboot(void); static void cliSave(char *cmdline); static void cliSet(char *cmdline); static void cliGet(char *cmdline); @@ -858,18 +859,14 @@ static void cliEnter(void) static void cliExit(char *cmdline) { - cliPrint("\r\nLeaving CLI mode\r\n"); + UNUSED(cmdline); + cliPrint("\r\nLeaving CLI mode, unsaved changes lost.\r\n"); *cliBuffer = '\0'; bufferIndex = 0; cliMode = 0; // incase a motor was left running during motortest, clear it here mixerResetMotors(); - // save and reboot... I think this makes the most sense - otherwise config changes can be out of sync, maybe just need to applyConfig and return? -#if 1 - cliSave(cmdline); -#else - releaseSerialPort(cliPort, FUNCTION_CLI); -#endif + cliReboot(); } static void cliFeature(char *cmdline)