Browse Source

Added toggle_giveback shell command

As the name says, it toggles the GiveBack flag in the configuration
buffer.  The rest of the firmware doesn't use the flag for anything yet,
but it is correctly saved in flash.
Clara Hobbs 5 years ago
parent
commit
596d7433b0
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      src/shell.c

+ 13
- 1
src/shell.c View File

@@ -165,6 +165,18 @@ static void cmd_get_tmpcfg(BaseSequentialStream *chp, int argc, char *argv[])
165 165
     pdb_config_print(chp, &tmpcfg);
166 166
 }
167 167
 
168
+static void cmd_toggle_giveback(BaseSequentialStream *chp, int argc, char *argv[])
169
+{
170
+    (void) argv;
171
+    if (argc > 0) {
172
+        chprintf(chp, "Usage: toggle_giveback\r\n");
173
+        return;
174
+    }
175
+
176
+    /* Toggle the GiveBack flag */
177
+    tmpcfg.flags ^= PDB_CONFIG_FLAGS_GIVEBACK;
178
+}
179
+
168 180
 static void cmd_set_v(BaseSequentialStream *chp, int argc, char *argv[])
169 181
 {
170 182
     if (argc != 1) {
@@ -222,7 +234,7 @@ static const struct pdb_shell_cmd commands[] = {
222 234
     {"load", cmd_load, "Load the stored configuration into the buffer"},
223 235
     {"get_cfg", cmd_get_cfg, "Print the stored configuration"},
224 236
     {"get_tmpcfg", cmd_get_tmpcfg, "Print the configuration buffer"},
225
-    /* TODO {"toggle_giveback", cmd_toggle_giveback, "Toggle the GiveBack flag"},*/
237
+    {"toggle_giveback", cmd_toggle_giveback, "Toggle the GiveBack flag"},
226 238
     /* TODO {"toggle_var_bat", cmd_toggle_var_bat, "Toggle the Var/Bat flag"},*/
227 239
     {"set_v", cmd_set_v, "Set the voltage in millivolts"},
228 240
     {"set_i", cmd_set_i, "Set the current in milliamps"},

Loading…
Cancel
Save