1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

Decouple reading EEPROM from writing EEPROM. Now writeEEPROM() does

only what it's name implies and it's method takes no arguments.  This
avoids the 0/1 magic numbers which was a flag to decide whether the user
should be notified after the EEPROM has been read (!).

Introduced a method called readEEPROMAndNotify() which is used in all
cases where writeEEPROM(1) was previously called.

Additionally this avoid re-reading the profile when the reboot command
is issued which speeds up reboots.

Finally this avoid needless comments because the code tells you now what
it is going to do.
This commit is contained in:
Dominic Clifton 2014-04-21 01:18:15 +01:00
parent 3daaf66b14
commit a012cb1c82
7 changed files with 30 additions and 19 deletions

View file

@ -835,7 +835,8 @@ static void cliProfile(char *cmdline)
i = atoi(cmdline);
if (i >= 0 && i <= 2) {
mcfg.current_profile = i;
writeEEPROM(0);
writeEEPROM();
readEEPROM();
cliProfile("");
}
}
@ -845,7 +846,7 @@ static void cliSave(char *cmdline)
{
cliPrint("Saving...");
copyCurrentProfileToProfileSlot(mcfg.current_profile);
writeEEPROM(0);
writeEEPROM();
cliPrint("\r\nRebooting...");
delay(10);
systemReset(false);