]> git.droids-corp.org - fpv.git/commitdiff
imuboard: add a command to reset eeprom
authorOlivier Matz <zer0@droids-corp.org>
Wed, 4 Mar 2015 20:32:30 +0000 (21:32 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Wed, 4 Mar 2015 20:32:30 +0000 (21:32 +0100)
imuboard/commands.c
imuboard/eeprom_config.c
imuboard/eeprom_config.h

index 447e3994a3f4bf043bb2005e6f81995b45f7da78..c42eed4cdc71a8e4f522fd417fd76ddace7aec25 100644 (file)
@@ -229,16 +229,20 @@ struct cmd_eeprom_list_result {
 static void cmd_eeprom_list_parsed(void *parsed_result,
                                void *data)
 {
-       (void)parsed_result;
+       struct cmd_eeprom_list_result *res = parsed_result;
+
        (void)data;
-       eeprom_dump_cmds();
+       if (!strcmp_P(PSTR("list"), res->cmd))
+               eeprom_dump_cmds();
+       else
+               eeprom_reset();
 }
 
 const char PROGMEM str_eeprom_list_eeprom[] = "eeprom";
 const parse_token_string_t PROGMEM cmd_eeprom_list_cmd =
        TOKEN_STRING_INITIALIZER(struct cmd_eeprom_list_result, cmd,
                                 str_eeprom_list_eeprom);
-const char PROGMEM str_eeprom_list_list[] = "list";
+const char PROGMEM str_eeprom_list_list[] = "list#reset";
 const parse_token_string_t PROGMEM cmd_eeprom_list_action =
        TOKEN_STRING_INITIALIZER(struct cmd_eeprom_list_result, action,
                                 str_eeprom_list_list);
index f3274d8e48219df33a06cd70ee2ce214c50ebee8..2eb39c176df5cf13bc7f86ccef3a3bc5d67778a2 100644 (file)
@@ -155,3 +155,8 @@ int8_t eeprom_delete_cmd(uint8_t n)
        eeprom_set_ncmds(max - 1);
        return 0;
 }
+
+void eeprom_reset(void)
+{
+       eeprom_set_ncmds(0);
+}
index 7aff8677d2a8a3babd76b093d8d2a7c8bed0e321..3f9fe68568a403056bb685b7fc123b997fb268fa 100644 (file)
@@ -44,5 +44,6 @@ void eeprom_dump_cmds(void);
 int8_t eeprom_insert_cmd_before(const char *str, uint8_t n);
 int8_t eeprom_append_cmd(const char *str);
 int8_t eeprom_delete_cmd(uint8_t n);
+void eeprom_reset(void);
 
 #endif