瀏覽代碼

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 年之前
父節點
當前提交
85f2dcc4e4
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1
    3
      src/shell.c

+ 1
- 3
src/shell.c 查看文件

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

Loading…
取消
儲存