Browse Source

Make default tmpcfg VALID instead of EMPTY

There's not really any harm in writing a configuration with zero voltage
or current (and it was possible all along anyway), so why fight it?
Clara Hobbs 7 years ago
parent
commit
85f2dcc4e4
1 changed files with 1 additions and 3 deletions
  1. 1
    3
      src/shell.c

+ 1
- 3
src/shell.c View File

47
 
47
 
48
 /* Buffer for unwritten configuration */
48
 /* Buffer for unwritten configuration */
49
 static struct pdb_config tmpcfg = {
49
 static struct pdb_config tmpcfg = {
50
-    .status = PDB_CONFIG_STATUS_EMPTY
50
+    .status = PDB_CONFIG_STATUS_VALID
51
 };
51
 };
52
 
52
 
53
 static void cmd_license(BaseSequentialStream *chp, int argc, char *argv[])
53
 static void cmd_license(BaseSequentialStream *chp, int argc, char *argv[])
187
     char *endptr;
187
     char *endptr;
188
     long i = strtol(argv[0], &endptr, 0);
188
     long i = strtol(argv[0], &endptr, 0);
189
     if (i >= 0 && i <= UINT16_MAX && endptr > argv[0]) {
189
     if (i >= 0 && i <= UINT16_MAX && endptr > argv[0]) {
190
-        tmpcfg.status = PDB_CONFIG_STATUS_VALID;
191
         /* Convert mV to the unit used by USB PD */
190
         /* Convert mV to the unit used by USB PD */
192
         tmpcfg.v = PD_MV2PDV(i);
191
         tmpcfg.v = PD_MV2PDV(i);
193
     } else {
192
     } else {
206
     char *endptr;
205
     char *endptr;
207
     long i = strtol(argv[0], &endptr, 0);
206
     long i = strtol(argv[0], &endptr, 0);
208
     if (i >= 0 && i <= UINT16_MAX && endptr > argv[0]) {
207
     if (i >= 0 && i <= UINT16_MAX && endptr > argv[0]) {
209
-        tmpcfg.status = PDB_CONFIG_STATUS_VALID;
210
         /* Convert mA to the unit used by USB PD */
208
         /* Convert mA to the unit used by USB PD */
211
         tmpcfg.i = PD_MA2PDI(i);
209
         tmpcfg.i = PD_MA2PDI(i);
212
     } else {
210
     } else {

Loading…
Cancel
Save