Browse Source

Change the condition for printing voltage range

Now instead of checking the Var/Bat flag, it checks if either end of the
range is non-zero.
Clara Hobbs 7 years ago
parent
commit
d9d8e5d45a
2 changed files with 3 additions and 2 deletions
  1. 2
    1
      src/config.c
  2. 1
    1
      src/config.h

+ 2
- 1
src/config.c View File

69
     /* Print voltages and current */
69
     /* Print voltages and current */
70
     chprintf(chp, "v: %d.%02d V\r\n", PD_PDV_V(cfg->v), PD_PDV_CV(cfg->v));
70
     chprintf(chp, "v: %d.%02d V\r\n", PD_PDV_V(cfg->v), PD_PDV_CV(cfg->v));
71
     chprintf(chp, "i: %d.%02d A\r\n", PD_PDI_A(cfg->i), PD_PDI_CA(cfg->i));
71
     chprintf(chp, "i: %d.%02d A\r\n", PD_PDI_A(cfg->i), PD_PDI_CA(cfg->i));
72
-    if (cfg->flags & PDBS_CONFIG_FLAGS_VAR_BAT) {
72
+    /* If either end of the range is non-zero, print the range */
73
+    if (cfg->vmin != 0 || cfg->vmax != 0) {
73
         chprintf(chp, "vmin: %d.%02d V\r\n", PD_PDV_V(cfg->vmin),
74
         chprintf(chp, "vmin: %d.%02d V\r\n", PD_PDV_V(cfg->vmin),
74
                  PD_PDV_CV(cfg->vmin));
75
                  PD_PDV_CV(cfg->vmin));
75
         chprintf(chp, "vmax: %d.%02d V\r\n", PD_PDV_V(cfg->vmax),
76
         chprintf(chp, "vmax: %d.%02d V\r\n", PD_PDV_V(cfg->vmax),

+ 1
- 1
src/config.h View File

48
 /* Flags for configuration structures. */
48
 /* Flags for configuration structures. */
49
 /* GiveBack supported */
49
 /* GiveBack supported */
50
 #define PDBS_CONFIG_FLAGS_GIVEBACK 0x0001
50
 #define PDBS_CONFIG_FLAGS_GIVEBACK 0x0001
51
-/* Variable and battery PDOs supported (vmin and vmax valid) */
51
+/* Variable and battery PDOs preferred (FIXME: not implemented) */
52
 #define PDBS_CONFIG_FLAGS_VAR_BAT 0x0002
52
 #define PDBS_CONFIG_FLAGS_VAR_BAT 0x0002
53
 
53
 
54
 
54
 

Loading…
Cancel
Save