@ -208,15 +208,18 @@ EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) {
enum {
enum {
CONTENTS ,
CONTENTS ,
FREE ,
FREE ,
ERASE ,
} sub_command ;
} sub_command ;
if ( : : Focus . handleHelp ( command , PSTR ( " eeprom.contents \n eeprom.free " ) ) )
if ( : : Focus . handleHelp ( command , PSTR ( " eeprom.contents \n eeprom.free \n eeprom.erase " ) ) )
return EventHandlerResult : : OK ;
return EventHandlerResult : : OK ;
if ( strcmp_P ( command , PSTR ( " eeprom.contents " ) ) = = 0 )
if ( strcmp_P ( command , PSTR ( " eeprom.contents " ) ) = = 0 )
sub_command = CONTENTS ;
sub_command = CONTENTS ;
else if ( strcmp_P ( command , PSTR ( " eeprom.free " ) ) = = 0 )
else if ( strcmp_P ( command , PSTR ( " eeprom.free " ) ) = = 0 )
sub_command = FREE ;
sub_command = FREE ;
else if ( strcmp_P ( command , PSTR ( " eeprom.erase " ) ) = = 0 )
sub_command = ERASE ;
else
else
return EventHandlerResult : : OK ;
return EventHandlerResult : : OK ;
@ -241,8 +244,15 @@ EventHandlerResult FocusEEPROMCommand::onFocusEvent(const char *command) {
case FREE :
case FREE :
: : Focus . send ( Runtime . storage ( ) . length ( ) - : : EEPROMSettings . used ( ) ) ;
: : Focus . send ( Runtime . storage ( ) . length ( ) - : : EEPROMSettings . used ( ) ) ;
break ;
break ;
case ERASE : {
for ( uint16_t i = 0 ; i < Runtime . storage ( ) . length ( ) ; i + + ) {
Runtime . storage ( ) . update ( i , 255 ) ;
}
Runtime . storage ( ) . commit ( ) ;
Runtime . device ( ) . rebootBootloader ( ) ;
break ;
}
}
}
return EventHandlerResult : : EVENT_CONSUMED ;
return EventHandlerResult : : EVENT_CONSUMED ;
}
}