|
|
@ -60,34 +60,35 @@ namespace FocusHooks {
|
|
|
|
|
|
|
|
|
|
|
|
bool eeprom (const char *command) {
|
|
|
|
bool eeprom (const char *command) {
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
|
|
|
|
CONTENTS,
|
|
|
|
FREE,
|
|
|
|
FREE,
|
|
|
|
DUMP,
|
|
|
|
|
|
|
|
UPLOAD,
|
|
|
|
|
|
|
|
} subCommand;
|
|
|
|
} subCommand;
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp_P (command, PSTR ("eeprom.dump")) == 0)
|
|
|
|
if (strcmp_P (command, PSTR ("eeprom.contents")) == 0)
|
|
|
|
subCommand = DUMP;
|
|
|
|
subCommand = CONTENTS;
|
|
|
|
else if (strcmp_P (command, PSTR ("eeprom.upload")) == 0)
|
|
|
|
|
|
|
|
subCommand = UPLOAD;
|
|
|
|
|
|
|
|
else if (strcmp_P (command, PSTR ("eeprom.free")) == 0)
|
|
|
|
else if (strcmp_P (command, PSTR ("eeprom.free")) == 0)
|
|
|
|
subCommand = FREE;
|
|
|
|
subCommand = FREE;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
|
|
switch (subCommand) {
|
|
|
|
switch (subCommand) {
|
|
|
|
case DUMP:
|
|
|
|
case CONTENTS: {
|
|
|
|
|
|
|
|
if (Serial.peek () == '\n') {
|
|
|
|
for (uint16_t i = 0; i < EEPROM.length (); i++) {
|
|
|
|
for (uint16_t i = 0; i < EEPROM.length (); i++) {
|
|
|
|
uint8_t d = EEPROM[i];
|
|
|
|
uint8_t d = EEPROM[i];
|
|
|
|
Focus.printNumber (d);
|
|
|
|
Focus.printNumber (d);
|
|
|
|
Focus.printSpace ();
|
|
|
|
Focus.printSpace ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
Serial.println ();
|
|
|
|
case UPLOAD:
|
|
|
|
} else {
|
|
|
|
for (uint16_t i = 0; i < EEPROM.length (); i++) {
|
|
|
|
for (uint16_t i = 0; i < EEPROM.length (); i++) {
|
|
|
|
uint8_t d = Serial.parseInt ();
|
|
|
|
uint8_t d = Serial.parseInt ();
|
|
|
|
EEPROM.update (i, d);
|
|
|
|
EEPROM.update (i, d);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
case FREE:
|
|
|
|
case FREE:
|
|
|
|
Serial.println (EEPROM.length () - EEPROMSettings.used ());
|
|
|
|
Serial.println (EEPROM.length () - EEPROMSettings.used ());
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|