mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 04:15:44 +03:00
Cleanup EEPROM reset and validation methods so that it is obvious what
the code is doing. There are now no EEPROM read/write/reset/verify methods that take any arguments which removes magic boolean variables from method signatures. This also removes duplicate code in the cliDefaults and cliSave commands which results in smaller code also also due to the deduplication of a reboot message.
This commit is contained in:
parent
a012cb1c82
commit
bd95c38ff0
5 changed files with 39 additions and 29 deletions
|
@ -550,15 +550,6 @@ static void cliCMix(char *cmdline)
|
|||
}
|
||||
}
|
||||
|
||||
static void cliDefaults(char *cmdline)
|
||||
{
|
||||
cliPrint("Resetting to defaults...\r\n");
|
||||
checkFirstTime(true);
|
||||
cliPrint("Rebooting...");
|
||||
delay(10);
|
||||
systemReset(false);
|
||||
}
|
||||
|
||||
static void cliDump(char *cmdline)
|
||||
{
|
||||
int i;
|
||||
|
@ -842,14 +833,25 @@ static void cliProfile(char *cmdline)
|
|||
}
|
||||
}
|
||||
|
||||
static void cliReboot(void) {
|
||||
cliPrint("\r\nRebooting...");
|
||||
delay(10);
|
||||
systemReset(false);
|
||||
}
|
||||
|
||||
static void cliSave(char *cmdline)
|
||||
{
|
||||
cliPrint("Saving...");
|
||||
copyCurrentProfileToProfileSlot(mcfg.current_profile);
|
||||
writeEEPROM();
|
||||
cliPrint("\r\nRebooting...");
|
||||
delay(10);
|
||||
systemReset(false);
|
||||
cliReboot();
|
||||
}
|
||||
|
||||
static void cliDefaults(char *cmdline)
|
||||
{
|
||||
cliPrint("Resetting to defaults...");
|
||||
resetEEPROM();
|
||||
cliReboot();
|
||||
}
|
||||
|
||||
static void cliPrint(const char *str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue